Short Bot Note

Need some nice Mods? Here, you are right!
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

A bump:
After a small modification operated for a crash (not sure in MBot is that guilty) I decided to not add a single line, and because latent things are restrictive in code calls, I was heading to speak with Bot as Mover does (external timings).
Someone told that Bot won't jump from Lift - it's True - but... a custom Bot will do that somehow :| .
Brain assistant number 2 will tell to Bot about a random option to jump from lift in certain conditions (lift speed, distance to exit, etc.). By testing a bit DM-Terra, looks like MBot is using this feature with a random rate and it lands pretty cute. I have some problems trying to do this as long as by logging velocity I figure mover having it but the Bot was like stuck on it, then I solved problem by calling a null Base before doing jump, else Mover is very loving Bot and copying Mover velocity at Bot nearby his jump capability - finally it might jump almost like player does with an additional Z velocity. Of course it won't jump from high-speed lifts, now I have to write something for different Zone gravity (even I don't really need such things).
Brain number 2 is active by ONLY using XCGE, at it looks as follows:

Code: Select all

class XC_Boost expands Info;

var MBot_D Ow;
var bool bWasCarrier;
var int BlkCycles;

native(3540) final iterator function PawnActors( class<Pawn> PawnClass, out pawn P, optional float Distance,
optional vector VOrigin, optional bool bHasPRI);

native(3541) final iterator function NavigationActors( class<NavigationPoint> NavClass, out NavigationPoint P,
optional float Distance, optional vector VOrigin, optional bool bVisible);

native(3542) final iterator function InventoryActors( class<Inventory> InvClass, out Inventory Inv,
optional bool bSubclasses, optional Actor StartFrom);

function DoTracking()
{
	local Pawn P;

	if ( Ow != None && Ow.Health > 0 && !Ow.bHidden )
	{
		if ( Ow.IsInState('Roaming') || Ow.IsInState('Wandering') )
		{
			if ( Ow.Enemy == None || !Ow.ValidSight( Ow.Enemy ))
			{
				foreach PawnActors ( class 'Pawn',P,Ow.SightRadius,Ow.Location )
				{
					if ( Ow != P && Ow.ValidSight(P) && P.Health > 0 && P.bCollideActors
						&& !P.bHidden && P.DrawType == DT_Mesh )
					{
						if (Ow.AttitudeTo(P) < ATTITUDE_Ignore)
						{
							Ow.SeePlayer(P);
//							log (Ow.GetHumanName()@see@P.GetHumanName());
							break;
						}
					}
				}
			}
		}
	}
}

function CheckCarry()
{
	local AlternatePath Ap;

	if ( Ow.PlayerReplicationInfo != None && Ow.PlayerReplicationInfo.HasFlag != None
		&& Ow.IsInstate('Roaming') && Ow.Health > 0 && !Ow.bHidden )
		bWasCarrier = True;
	if ( bWasCarrier )
	{
		if ( Ow.PlayerReplicationInfo != None && Ow.PlayerReplicationInfo.HasFlag == None
		&& Ow.IsInstate('Roaming') && Ow.Health > 0 && !Ow.bHidden )
		{
//			log ("Find Alternate Path for"@Ow.GetHumanName());
			bWasCarrier = False;
			if ( Ow.AlternatePath == None )
			{
				foreach NavigationActors( class 'AlternatePath', Ap )
				{
					if ( FRand() > 0.3 && Ap.Team != Ow.PlayerReplicationInfo.Team )
					{
						Ow.AlternatePath = Ap;
						break;
					}
				}
			}
		}
	}
}

function CheckMovement()
{
	local Weapon W;
	local float ZPower;
	local Actor TheGoal;
	local LiftExit Le;
	local vector Direction;

//	log ("MoveCheck");
	if ( Ow != None && Ow.Health > 0 )
	{
		if ( ( Ow.Enemy == None || !Ow.LineOfSightTo(Ow.Enemy)) && Ow.IsInState('Roaming')
		&& Ow.MoveTarget != None && Ow.SpecialPause == 0 && !Ow.Region.Zone.bWaterZone
		&& FastTrace( Ow.Location+vect(0,0,40),Ow.MoveTarget.Location )
		&& !FastTrace(Ow.Location+vect(0,0,-25),Ow.MoveTarget.Location )
		&& !Ow.bCamping )
			if ( VSize( Ow.Velocity ) < 10 )
				BlkCycles++;
			else
			{
				if ( BlkCycles > 0 )
					BlkCycles--;
			}
			if ( BlkCycles >= 8 ) //aprox. 2+ seconds obstructed ?
			{
				Ow.BigJump(Ow.MoveTarget); //Try a jump
				BlkCycles = 0;
			}
		if ( Ow.MoveTarget != None && !Ow.Region.Zone.bWaterZone && Ow.SpecialPause == 0 )
		{
			if ( FastTrace(Ow.MoveTarget.Location,Ow.Location )
				&& VSize(Ow.MoveTarget.Location - Ow.Location) < 10 
				&& Ow.IsInState('FallingState') )
			{
				Ow.Velocity.X = 0;
				Ow.Velocity.Y = 0;
				Ow.GotoState('FallingState','PlayFall');
				Ow.SpecialPause = 0.3;
			}
		}
		if ( Ow.Enemy == None && Ow.IsInState('Wandering') && Ow.MoveTarget == None && Ow.Weapon != None && Ow.Weapon.AIRating < 0.3 )
		{
			foreach InventoryActors(class'Weapon', W)
			{
				if ( W.AIRating > Ow.Weapon.AIRating && W.Owner != None && W.Owner == Ow )
				{
					Ow.SwitchToBestWeapon();
						break;
				}
			}
		}
		if ( Ow.MoveTarget != None && Mover(Ow.Base) != None 
		&& ( Mover(Ow.Base).Velocity.Z > 80 && Mover(Ow.Base).Velocity.Z < 400 )
		&& FRand() < 0.7 && !Ow.Region.Zone.bWaterZone )
		{
			log (Self.Name@Ow.getHumanName()@jumping from lift);
			log (Ow.getHumanName()@ has velocity z@Ow.Velocity.Z);
			log ("Lift Velocity on Z is"@Mover(Ow.Base).Velocity.Z);
			foreach RadiusActors(class'LiftExit',Le,300,Ow.Location )
			{
				if (Le.Location.Z > Ow.Location.Z && FastTrace(Le.Location,Ow.Location+vect(0,0,18)))
				{
					TheGoal=Le;
					break;
				}
			}
			if ( TheGoal != None )
			{
				ZPower = Ow.JumpZ;
				Ow.JumpZ = ZPower+Mover(Ow.Base).Velocity.Z+50;
				Ow.StopWaiting();
				Ow.SetBase(None);
				Ow.MoveTarget = TheGoal;
				Ow.Destination = Ow.MoveTarget.Location;
				log (Ow.GetHumanName()@has@TheGoal);
				Ow.GotoState('Roaming','Moving');
				Ow.BigJump(Ow.MoveTarget);
				Ow.MoveTarget = TheGoal; //Regain this after jump
				Ow.JumpZ = ZPower; //restore jump
			}
		}
		if ( Ow.MoveTarget != None && Ow.MoveTarget.Location.Z+40 < Ow.Location.Z )
		{
			if ( Ow.Velocity.Z > 10 && Ow.Base == None )
				Ow.Acceleration = Ow.AccelRate * Normal(Ow.Destination - Ow.Location);
		}
	}
}

Auto State Boosting
{
Begin:
	Sleep(1.00);
//	log(Self.Name@start Tracking@Ow.GetHumanName());
Looping:
	Sleep (0.3);
	if ( Ow == None )
		Goto('End');
	DoTracking();
	CheckCarry();
	CheckMovement();
	GoTo('Looping');
End:
	Destroy();
}

defaultproperties
{
	bGameRelevant=True
}
And it is spawned like replication as follows:

Code: Select all

event PostBeginPlay()
{
	SeekXCGE();
	if ( bXCGE )
		Spawn(class'XC_Boost',Self,,vect(0,0,0)).Ow = Self;
}

function SeekXCGE()
{
	if ( int(ConsoleCommand("Get ini:Engine.Engine.GameEngine XC_Version")) >= 19 )
	{
		if ( int(ConsoleCommand("Get ini:Engine.Engine.GameEngine XC_Core_Version")) >= 7 )
		{
			bXCGE=True;
		}
	}
}
And now I have to test a couple of maps to see in which ones jumping from lifts is not nice.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

Another bump regarding to translocator.
Function TranslocatetoTarget might get another stupid simple love - problem caused by TranslocStart which is trying harder to convince Bot to translocate even if target is very closer and reachable causing a translocation loop looking like Bot is on drugs - even losing flag at this point - Epic what was wrong with you, guys ??
In simple words, if goal is reachable and it is under 300 UU range, translocator is a waste of time, seriously has no logic - unless you want to telefrag an enemy (any). If you don't translocate to an unreachable directly and a higher spot then quit doing it because it's a nonsense, just move to damn target using
Polge wrote:current locomotion method.
@default TranslocStart -> fuck off, bitch! Finally I have realized what I needed for months - stupid me.

Or because I want to write some stuff - probably I'll make it divided in 2 pieces and/or randomizing a bit things - it might worth trying some stunts.
Spectra
Masterful
Posts: 542
Joined: Tue Jan 22, 2013 5:23 pm
Personal rank: Nullified!
Location: (X) Unable To Locate....

Re: Short Bot Note

Post by Spectra »

A question. How do I check when the bot is near or on the ledge?? I added few lines to make them dodge intentionally during combat.
I don't want them to accidentally fall in the dead zones.
User avatar
OjitroC
Godlike
Posts: 3605
Joined: Sat Sep 12, 2015 8:46 pm

Re: Short Bot Note

Post by OjitroC »

sektor2111 wrote: Another bump regarding to translocator ... In simple words, if goal is reachable and it is under 300 UU range, translocator is a waste of time, seriously has no logic - unless you want to telefrag an enemy (any). If you don't translocate to an unreachable directly and a higher spot then quit doing it because it's a nonsense, just move to damn target
I have noticed that MBot_C does tend to use the translocator rather more than MBot_B in situations where it is not necessary and, in TDM, this is somewhat annoying as there is a tendency for the bots to telefrag the player (me). So it would be good if this could be adjusted somewhat!
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

I did not screw default tactical behavior, just because I see it pretty well compared with a Monster which might dodge into some hole, these are tracing codes which are not my favorites, as I know so far combat moves are located in state TacticalMove, there is the key.

Next problem. Version D has a different... attitude, it won't translocate with Flag Triggered by TranslocStart when crap is part of road dropping Flag and neither if target point is directly reachable closer.
In presence of XC_Engine 19+, MBot_D will use brain no. 2 pulling it from being a total ass during latent movements, so to speak it will aim targets, it might randomly jump from a lift moving on Z axis, it will adjust landing location for a bit of accuracy in some domestic BT cases - not perfect but still better. In small slants (a la MH-Canyon) might operate a required jump for getting over obstruction if GroundSpeed decreases under 10 (stuck) and legs are obstructed. Else it traces in 5 points a so called reachable inventory trying to not be that stupid related to stuff located nasty through "grids" - (CTF-LavaGiant morphed into a MH crap with lousy items around RedFlag). Also in presence of XC_Engine 19+ often used iterators are changed with those from XCGE.
MBot_D has a better deal in Arena maps. Example RocketLauncher arena > If Bot has the weapon-type from map and has enough ammo it won't get busy with craps, will start testing pawns in hunting purpose - this has a limitation to 32 pawns according to Pri array. I'm using currently this MBot_D in my games.
Due to a random crash in server without timerfix I have added a tick-break in state attacking trying to slow-down a high speed state change. It doesn't seems to make it slower in reactions, but it did not crash later.
[attachment=0]MBot_D.zip[/attachment]
Get this one into account if you want...
Attachments
MBot_D.zip
(4.93 MiB) Downloaded 93 times
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

It's probably being enough finished (until next issues) called MBot_E aka Modified Bot Update "E" located here

Setting up:
Open File User.ini and checkout section:

  • BotClasses[0]=BotPack.TMale1Bot
    BotClasses[1]=BotPack.TFemale2Bot
    BotClasses[2]=BotPack.TMale2Bot
    BotClasses[3]=BotPack.TMale1Bot
    BotClasses[4]=BotPack.TFemale1Bot
    BotClasses[5]=BotPack.TFemale1Bot
    BotClasses[6]=BotPack.TMale2Bot
    BotClasses[7]=BotPack.TFemale2Bot
    BotClasses[8]=BotPack.TMale1Bot
    BotClasses[9]=BotPack.TFemale1Bot
    BotClasses[10]=BotPack.TMale2Bot
    BotClasses[11]=BotPack.TMale1Bot
    BotClasses[12]=BotPack.TFemale2Bot
    BotClasses[13]=BotPack.TFemale2Bot
    BotClasses[14]=BotPack.TMale2Bot
    BotClasses[15]=BotPack.TFemale1Bot
    BotClasses[16]=BotPack.TMale1Bot
    BotClasses[17]=BotPack.TFemale2Bot
    BotClasses[18]=BotPack.TMale2Bot
    BotClasses[19]=BotPack.TFemale1Bot
    BotClasses[20]=BotPack.TMale1Bot
    BotClasses[21]=BotPack.TFemale1Bot
    BotClasses[22]=BotPack.TMale2Bot
    BotClasses[23]=BotPack.TFemale2Bot
    BotClasses[24]=BotPack.TMale1Bot
    BotClasses[25]=BotPack.TFemale1Bot
    BotClasses[26]=BotPack.TMale2Bot
    BotClasses[27]=BotPack.TFemale2Bot
    BotClasses[28]=BotPack.TMale1Bot
    BotClasses[29]=BotPack.TFemale2Bot
    BotClasses[30]=BotPack.TMale2Bot
    BotClasses[31]=BotPack.TFemale1Bot
These are going to be replaced (Copy-Paste) with these:

  • BotClasses[0]=MBot_E.MTMale1Bot
    BotClasses[1]=MBot_E.MTFemale2Bot
    BotClasses[2]=MBot_E.MTMale2Bot
    BotClasses[3]=MBot_E.MTMale1Bot
    BotClasses[4]=MBot_E.MTFemale1Bot
    BotClasses[5]=MBot_E.MTFemale1Bot
    BotClasses[6]=MBot_E.MTMale2Bot
    BotClasses[7]=MBot_E.MTFemale2Bot
    BotClasses[8]=MBot_E.MTMale1Bot
    BotClasses[9]=MBot_E.MTFemale1Bot
    BotClasses[10]=MBot_E.MTMale2Bot
    BotClasses[11]=MBot_E.MTMale1Bot
    BotClasses[12]=MBot_E.MTFemale2Bot
    BotClasses[13]=MBot_E.MTFemale2Bot
    BotClasses[14]=MBot_E.MTMale2Bot
    BotClasses[15]=MBot_E.MTFemale1Bot
    BotClasses[16]=MBot_E.MTMale1Bot
    BotClasses[17]=MBot_E.MTFemale2Bot
    BotClasses[18]=MBot_E.MTMale2Bot
    BotClasses[19]=MBot_E.MTFemale1Bot
    BotClasses[20]=MBot_E.MTMale1Bot
    BotClasses[21]=MBot_E.MTFemale1Bot
    BotClasses[22]=MBot_E.MTMale2Bot
    BotClasses[23]=MBot_E.MTFemale2Bot
    BotClasses[24]=MBot_E.MTMale1Bot
    BotClasses[25]=MBot_E.MTFemale1Bot
    BotClasses[26]=MBot_E.MTMale2Bot
    BotClasses[27]=MBot_E.MTFemale2Bot
    BotClasses[28]=MBot_E.MTMale1Bot
    BotClasses[29]=MBot_E.MTFemale2Bot
    BotClasses[30]=MBot_E.MTMale2Bot
    BotClasses[31]=MBot_E.MTFemale1Bot
For adding them in a server they have to be added also in packages not only in User.ini:
  • ServerPackages=MBot_E
Else they are going to be invisible/borked. For XCGE servers (v19) some features are unlocked and faster iterators are used.
This update contains a more domestic behavior at lifts/elevators with horizontal movement - IT IS about movers properly tagged not craps based on guessing (- tutorial hints might be described if are demanded). Source code it's included in case of modifications needed. These are currently my Bots with a tiny difference, at position 2 I'm using a boss >> BotClasses[1]=MBot_E.MTBossBot >> BotSkins[1]=BossSkins.boss1 >> BotSkills[1]=4.000000 >> BotAccuracy[1]=0.700000 >> CombatStyle[1]=0.700000 >> Alertness[1]=0.700000 >> Camping[1]=-0.300000 >> StrafingAbility[1]=0.600000 >> BotJumpy[1]=1 >> BotNames[1]=Xan_A >> BotFaces[1]=BossSkins.boss5Xan.
All features are available in presence of XCGE v19 by Higor - I'm guessing Windows based servers don't have issues at this point. Even if some server features are disabled, MBot_E will hook iterators and will use them.
Last edited by sektor2111 on Sun May 21, 2017 2:46 pm, edited 1 time in total.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

Update bump.

Version E has now a conformed update for some reasons:
- I forgot PlayerShadow - client side;
- New iterators have additional parameters;
- Tiny change at PickLocalInventory - when Bot smells something around was interested to reach at item even with a price of a failure because... not all far items are reachable by jumping.

Download links are in previous post.
Reminder MBot_E works without XCGE but it will have a few things disabled in that case.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

New bump.

I'm pretty much satisfied with this MBot_E (so far), from now on I'll do other detailed checks because I got something pissing me off:

Code: Select all

MTFemale1Bot ...............MTFemale1Bot0 (Function MBot_E.MBot_E.TacticalMove.PickRegDestination:0D0A) Accessed None
There I think I did a sort of wrong MH attraction deal + Bot Code seems to do funky things when enemy is falling from map or something is triggering a void in some combat situation. So to speak, next days I'll conform an update for tiny improvements (MH deal is already changed... When Bot doesn't have a load, will do a restart (like when was killed) in purpose to gain ModifyPlayer chain for loading a default thing... I'll announce when future update will occur.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

Link shown here viewtopic.php?f=34&t=6300&start=60#p94484 has now an update related to that combat problem... I think mission "Bot rewriting" can camp a while if other major problems are not detected.
Ugly02
Posts: 1
Joined: Sun Jul 30, 2017 3:53 pm

Re: Short Bot Note

Post by Ugly02 »

sektor2111 wrote:If you were asking what I've been doing last time, then I'll answer... maybe I did something - or maybe not very. I have modified Bot class into subclasses in purpose to create other Bots able to join normally in games like defaults but having small modifications. I cannot say then stuff is ready, maybe other people want more so stuff is available with full compilable resources. MBOT.zip (is the name of archive) - MBot comes from let's say Modified Bot or My Bot.

Short description tech related:
- wrapping (or so called sanity check) "if (Weapon != None)" else if I forgot whatever state feel free to put that where is missing;
- function CanFireAtEnemy() - looks like Bot has more mercy with doors (Doors are innocent LOL);
- state roaming has a few modifications - Don't like ? Put back default;..:
a) PickDestination will call at a moment something to gain Navigation Rachat de crédit even at 3500 UU range (if has been nasty boosted out - MH-ArdenValley.... cases);
b) Being loaded a bit with weaponry in DM will attempt to hunt an enemy (even ScriptedPawn);
c) It is not interested in a very very closer InventorySpot - attempt to remove stupid engine load while skating between 2 closer nodes - it's mapping fault but... whatever I did not loaded UScript more because at a moment with a wrong code will cause a nasty lag - this state is very powerful;
- faster in high skill - higher jump - I wanted them more challenging without using "adds";
- Because I did not find any valid information about "FindBestInventoryPath()" used intensive by Bot I was unable to debate things different so...

Being a child of Common Bot:
- will use JumpSpots and the rest of stuff common for Bot only - READ AGAIN;
- will use Bot specific A.I. weaponry code;
- will respond at TeamGamePlus A.I. directives as normal Bots are doing.
More Info has been placed in package. Package is stored in a G00gledrive folder which might be updated from time to time depending on needs which is here:

I have other works started and functional in big parts (shared there as well) - feel free to mess with them if you can understand what is about.
Because MBot can be configured in User.ini it might hold different skins or things compatible with common Bot.

Edit: Adjusted according to fore-mentioned inventory issue.
Edit2: Latest update is MBot_C >> download/file.php?id=7021
Ok thank you very much for the information :)
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

MBot is now public with version E and for the moment I have an F in testing stage. Main purpose of F version is quit pushing each-other blocking themselves in small places - also if game/server uses XCGE. So your quote is outdated :| .
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Short Bot Note

Post by Gadavre »

Hi! Could you help me with Code for my Mod? I would like the Bot to be always in the state'Roaming' in Deathmatch. I tried to write code, but the Bots still attacked each other.I can't do anything :(
Last edited by Gadavre on Sun Oct 15, 2017 1:28 pm, edited 1 time in total.
User avatar
sektor2111
Godlike
Posts: 6403
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Short Bot Note

Post by sektor2111 »

Gadavre wrote:I would like the Bot to be always in the state'Roaming' in Deathmatch.
Confusing. Do you mean to not attack each-other ? Purpose of ignoring everything ?

Extra Edit:
Version F is in download folder. Probably next version will have similar stuff like in XCGE case but it will work slower then. Maybe some people have big troubles with XCGE so they will need something more clean...
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Short Bot Note

Post by Gadavre »

sektor2111 wrote:
Gadavre wrote:I would like the Bot to be always in the state'Roaming' in Deathmatch.
Confusing. Do you mean to not attack each-other ? Purpose of ignoring everything ?
yes!Bots can only collect pickups. But they should not attack each other and players.There is no weapon in the Mod.
Last edited by Gadavre on Sun Oct 15, 2017 1:42 pm, edited 1 time in total.
User avatar
Gadavre
Skilled
Posts: 169
Joined: Sun Jan 18, 2015 7:55 am

Re: Short Bot Note

Post by Gadavre »

I've already written the code, but I can not make the Bots friendly in Deathmatch. Is it possible to make bots friendly? I make Game Type

I do not even know what kind of Mods or Mutators I could look to find this code...
Post Reply