logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Bot AI Challenge (Read 2003 times)
GcSkaarj
Full Member
***
Offline


G S T H

Posts: 159
Location: Terraniux
Joined: Oct 21st, 2009
Gender: Male
Bot AI Challenge
Apr 17th, 2010 at 2:55am
Print Post  
I have a a somewhat coplex map design (for Bots) , so before to try to enable a working pathnode trajectory, I want to know first if it's possible for the bots to do it. For understanding better, I upload a screenshot of  a very simple map, but it have the desired concept:



As you can see, there is a "treasure" room that is only reachable if you turn it on the switch, so the desired bot behavior is:
1) From point A jump to B
2) Touch the switch and move to the D point
3) Get the items on C and return to D for getting his/her normal pathnode way.

Well, when i'm trying to do this, first I dont know how to "teach" a bot to press the button, and if I remove the bars, the bot will stay forever in the treasure room (in a more complex closed room)... Seems the bots are very "greedy" haha.
  
Back to top
 
IP Logged
 
[]KAOS[]Casey
Ex Member


nedm

Gender: Male
Re: Bot AI Challenge
Reply #1 - Apr 17th, 2010 at 3:29am
Print Post  
This should require bots with better OrderObject code to do this most likely. You could put some extreme hacks in that will get it to work but it will be ugly.
  
Back to top
 
IP Logged
 
Pitbull™
Forum Administrator
*****
Offline



Posts: 1072
Location: Between Venus & Mars
Joined: Oct 4th, 2002
Gender: Male
Re: Bot AI Challenge
Reply #2 - Apr 17th, 2010 at 9:06am
Print Post  
Not sure if this will work but this code tells the bots to spring the trap in my Ut conversion of DM-Pressure.

Code
Select All
/=============================================================================
// TrapSpringer.
//=============================================================================
class TrapSpringer extends Inventory;

var() name TrapTag; //tag of trap - could be zone, mover, or a trigger which counts touches
var() name TriggerTag;	// tag of trigger for trap
var Actor Trap[8];
var Actor TrapTrigger;
var() bool bShootIt;
var int trapnum;

function PostBeginPlay()
{
	local int num;
	local Actor A;

	// hack fix for DM-Pressure
	if ( TrapTag == 'DisFat' )
		TrapTag = 'dapressurezone';

	Super.PostBeginPlay();
	DrawType = DT_None;

	if ( (TrapTag == '') || (TriggerTag == '') )
	{
		Destroy();
		return;
	}

	ForEach AllActors(class'Actor', TrapTrigger, TriggerTag)
		break;

	trapnum = 0;
	ForEach AllActors(class'Actor', A, TrapTag)
		if ( A.IsA('ZoneInfo') )
		{
			Trap[0] = A;
			TrapNum = 1;
			return;
		}
		else if ( A.IsA('Mover') || A.IsA('Trigger') )
		{
			Trap[trapnum] = A;
			trapnum++;
			if ( trapnum == 8 )
				return;
		}
}

//=============================================================================
// AI inventory functions.

function float CalcDesire( Pawn Bot, Pawn Enemy )
{
	TrapTrigger.SpecialHandling(Bot);
	return 1.5;
}

event float BotDesireability( pawn Bot )
{
	local Pawn P;
	local int i,j;
	local float dist;

	if ( (Trap[0] == None) || (TrapTrigger == None) )
	{
		Destroy();
		return -1;
	}

	if ( bShootit && ((Bot.bFire !=0) || (Bot.bAltFire != 0)) )
		return -1;

	dist = VSize(Bot.Location - Location);

	if ( dist > 1600 )
		return -1;

	for ( j=0; j<trapnum; j++ )
		if ( Trap[j] != None )
		{
			if ( Trap[j].IsA('ZoneInfo') )
			{
				for ( P=Level.PawnList; P!=None; P=P.NextPawn )
					if ( (P.Region.Zone == Trap[j]) && FoundTrapTarget(Bot, P) )
						return CalcDesire(Bot, P);
			}
			else if ( Trap[j].bBlockActors || Trap[j].bBlockPlayers )
			{
				for ( P=Level.PawnList; P!=None; P=P.NextPawn )
					if ( (P.Base == Trap[j]) && FoundTrapTarget(Bot, P) )
						return CalcDesire(Bot, P);
			}
			else if ( Trap[j].bCollideActors )
			{
				for ( i=0 ;i<4; i++ )
				{
					P = Pawn(Trap[j].Touching[i]);
					if ( (P != None) && FoundTrapTarget(Bot, P) )
						return CalcDesire(Bot, Pawn(Trap[j].Touching[i]));
				}
			}
		}
	return -1;
}

function bool FoundTrapTarget(Pawn Bot, Pawn P)
{
	return ( P.bIsPlayer && (P != Bot) && (P.Health > 0)
			&& (!Level.Game.bTeamGame || (P.PlayerReplicationInfo.Team != Bot.PlayerReplicationInfo.Team)) );
}

//
// Become a pickup.
//
function BecomePickup()
{
	SetCollision( true, false, false );
}

//
// Become an inventory item.
//
function BecomeItem()
{
}

//
// Give this inventory item to a pawn.
//
function GiveTo( pawn Other )
{
}

// Either give this inventory to player Other, or spawn a copy
// and give it to the player Other, setting up original to be respawned.
//
function inventory SpawnCopy( pawn Other )
{
	return None;
}

//
// Set up respawn waiting if desired.
//
function SetRespawn()
{
}

//=============================================================================
// Pickup state: this inventory item is sitting on the ground.

auto state Pickup
{
	singular function ZoneChange( ZoneInfo NewZone )
	{
	}

	// When touched by an actor.
	function Touch( actor Other )
	{
		local Actor A;

		if( (Event != '') && (Pawn(Other)!=None)
			&& Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) )
			foreach AllActors( class 'Actor', A, Event )
				A.Trigger( Other, Other.Instigator );
	}

	function BeginState()
	{
		BecomePickup();
	}

Begin:
	BecomePickup();

Dropped:
}

 

  

LOADING HATERS..████████████] 99% Complete.

Green River
Old Unreal
Back to top
WWWGTalk  
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: Bot AI Challenge
Reply #3 - Apr 23rd, 2010 at 6:33pm
Print Post  
LiftExits and a LiftCenter with the lift tag set to your switch might do the trick.
  
Back to top
WWW  
IP Logged
 
GcSkaarj
Full Member
***
Offline


G S T H

Posts: 159
Location: Terraniux
Joined: Oct 21st, 2009
Gender: Male
Re: Bot AI Challenge
Reply #4 - Apr 24th, 2010 at 2:17am
Print Post  
GreatEmerald wrote on Apr 23rd, 2010 at 6:33pm:
LiftExits and a LiftCenter with the lift tag set to your switch might do the trick.


Well, the whole process seems to complex that I have changed the design of the map, and I like more the new one, (in this picture the only change is that now can be entered by an alternate one-way door to C too, so the switch is only for "human" players) but I have problems with the one-way parameter in the pathnodes (it is in the opposite direction and for the moment I can't figure out how to invert it)
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo