ZenCoder's fix for PlayerBots

Tutorials and discussions about Mapping - Introduce your own ones!
User avatar
EvilGrins
Godlike
Posts: 8007
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

ZenCoder's fix for PlayerBots

Post by EvilGrins » Tue Apr 27, 2021 3:12 am

I'm not a coder, doing scripts is not my strong suit... but I copy & paste with the best of them!
Image
I was toying with this for awhile, before I actually tried it... and admittedly screwed up a map I'd been editing for a very long time.

The annoying thing about summoning playerbots, or editing them directly onto a map, is they can't be team assigned and they all show up on the scoreboard as "Player". This is especially annoying if you are working with more than one of them. But due to a recent map edit I've been working on, 1 of 4, I discovered there's been a work-around for this that I somehow never noticed before...

...which was especially annoying as I've been asking if this were possible for years and everybody told me it couldn't be done!

Part of the mapping edits I've been working on is this map:
https://unrealarchive.org/maps/unreal-t ... a6ea8.html
That map is especially interesting as it has a playerbot embedded into the map, but it's on the Red Team and it actually has a name. So I studied how that was setup to see if I could do it, while I did a review of more of ZenCoder's work to see if he'd done similar anywhere else.

As I've since learned, this method only works with one player model type at a time, you can setup multiple bots on the map this way but they each have to be a different model... which may explain why ZenCoder only had one on one team. But the basic code is pretty simple:
//=============================================================================
// Ronald.
//=============================================================================
class Ronald expands MaleOneBot;

function PostBeginPlay(){
PlayerReplicationInfo.PlayerName = "Ronald the Clone";
PlayerReplicationInfo.Team = 0;
}

With slight alterations, I've used that on 5 different player models for a few maps already... but as stated, I can only do that with one player model per team (if I've got a Boss model on 1 team I can't have one on the other team). Try to do 2 with that on any map, the map won't work and you'll have to start over from scratch.

I did find another map ZenCoder had done this on:
https://unrealarchive.org/maps/unreal-t ... ea07d.html
This time around it was the Abbey model and it was for more than one of the same model type.

That looks like this...
//=============================================================================
// Amazon.
//=============================================================================
class Amazon expands AbbeyBot;
var() int myTeam;

function PostBeginPlay(){

PlayerReplicationInfo.Team = myTeam;
if ( myTeam == 0 ) {
PlayerReplicationInfo.PlayerName = "Sheena";
multiskins[0] = texture'MyLevel.Amaz1T_0';
} else {
PlayerReplicationInfo.PlayerName = "Xena";
multiskins[0] = texture'MyLevel.Amaz1T_1';
}
}

The screenshot at the top of this post was my attempt to do it, and it worked. I'm doing a re-edit of the CTF-ColaWars map.

Now, I only know how to use it to the extent of making slight variables in what's there, but I'm no coder. I can't make them do auto-taunts, I can't alter their skill level (which is probably a good thing) but I can use them fairly basically for fillers.

Just wanted to share, and to those who told me this was impossible... I will have blood vengeance!

But, moving right along, there are still complications.

For the 1st version you have to skin the model after you place it on the map, but with the 2nd version you can skin it in the code so long as the skin is 1 texture for the entire model. However, if the model is a multi-texture deal then you're better off skinning it as with the 1st version...

...though those better at coding might be able to find work-around for that too.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758

User avatar
sektor2111
Godlike
Posts: 5340
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ZenCoder's fix for PlayerBots

Post by sektor2111 » Tue Apr 27, 2021 6:19 am

And where is the fix for Accessed None at dying stage for Bots not Bot ? There isn't fixed anything. Actually you can look at that map with the clown and see what else might be used.

Code: Select all

//=============================================================================
// Ronald.
//=============================================================================
class Ronald expands MaleOneBot;

simulated function PostBeginPlay() //Doing these NORMALLY and not like that. All the rest are having shadow and this prick was on another planet
{
	if ( ROLE == ROLE_Authority )
	{
		PlayerReplicationInfo.PlayerName = "Ronald the Clone";
		PlayerReplicationInfo.Team = 0;
	}
	if ( Level.NetMode != NM_DedicatedServer )
		Shadow = Spawn(class'PlayerShadow',self);
}

state Dying
{
ignores SeePlayer, EnemyNotVisible, HearNoise, Died, Bump, Trigger, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, WarnTarget, LongFall, SetFall, PainTimer;

	function ReStartPlayer()
	{
		if( bHidden && Level.Game.RestartPlayer(self) )
		{
			Velocity = vect(0,0,0);
			Acceleration = vect(0,0,0);
			ViewRotation = Rotation;
			ReSetSkill();
			SetPhysics(PHYS_Falling);
			GotoState('Roaming');
		}
		else
			GotoState('Dying', 'TryAgain');
	}
	
	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
							Vector momentum, name damageType)
	{
		if ( !bHidden )
			Super.TakeDamage(Damage, instigatedBy, hitlocation, momentum, damageType);
	}
	
	function BeginState()
	{
		SetTimer(0, false);
		Enemy = None;
		AmbushSpot = None;
		bFire = 0;
		bAltFire = 0;
	}

	function EndState()
	{
		if ( Health <= 0 )
			log(self$" health still <0");
	}

Begin:
	Sleep(0.2);
	if ( !bHidden )
	{
		SpawnCarcass();
		HidePlayer();
	}
TryAgain:
	Sleep(RandRange(1.00,3.5)); //Fixed by Legend 2000 and unused anywhere in stock - Shame on you !
//	Sleep(0.25 + DeathMatchGame(Level.Game).NumBots * FRand()); //Trash removed, I don't have plans for DeathMatchGame, maybe DeathMatchPlus.
	ReStartPlayer();
	Goto('TryAgain');
WaitingForStart:
	bHidden = true;
}
To not forget that name can be defined as configurable preventing recompiling everything all the time.

User avatar
EvilGrins
Godlike
Posts: 8007
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: ZenCoder's fix for PlayerBots

Post by EvilGrins » Tue Apr 27, 2021 4:25 pm

I'll take a look at all that, copied to notepad.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758

User avatar
sektor2111
Godlike
Posts: 5340
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ZenCoder's fix for PlayerBots

Post by sektor2111 » Tue Apr 27, 2021 4:41 pm

Let me introduce what DeathmatchPlus does when it is adding a bot to the game and this one won't roam without weapon spreading errors - Yeah "coders", just learn from Epic if your guru has died because of some Non-Covid reasons:

Code: Select all

		BroadcastMessage( NewBot.PlayerReplicationInfo.PlayerName$EnteredMessage, false );

		ModifyBehaviour(NewBot);
		AddDefaultInventory( NewBot );
		NumBots++;
		if ( bRequireReady && (CountDown > 0) )
			NewBot.GotoState('Dying', 'WaitingForStart');
		NewBot.AirControl = AirControl;
It's not about a Pawn managing itself, it's about letting game to work as it should...

User avatar
EvilGrins
Godlike
Posts: 8007
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: ZenCoder's fix for PlayerBots

Post by EvilGrins » Tue Apr 27, 2021 6:43 pm

So this stuff you added is clearly based on the stuff for the singular version (Ronald) but would it be implemented the same for version 2?
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758

Red_Fist
Godlike
Posts: 1882
Joined: Sun Oct 05, 2008 3:31 am

Re: ZenCoder's fix for PlayerBots

Post by Red_Fist » Tue Apr 27, 2021 6:44 pm

What does this do, or mean ?

"his one won't roam without weapon spreading errors"

And what is the reason for this bot in the first place ?, no one said what it is suppose to do differently.
Binary Space Partitioning

User avatar
OjitroC
Godlike
Posts: 2427
Joined: Sat Sep 12, 2015 8:46 pm

Re: ZenCoder's fix for PlayerBots

Post by OjitroC » Tue Apr 27, 2021 6:55 pm

Red_Fist wrote:
Tue Apr 27, 2021 6:44 pm
What does this do, or mean ?

"his one won't roam without weapon spreading errors"
Read that as the bot won't roam around without a weapon and so won't spam the log with 'bot1 has no weapon' errors.
Red_Fist wrote:
Tue Apr 27, 2021 6:44 pm
And what is the reason for this bot in the first place ?, no one said what it is suppose to do differently.
The bot is on a Team but independant - not controlled by the Player in terms of reacting to orders (at least, I don't think it does) - it will roam around, following the paths, picking up stuff, attacking members of the opposing team, etc. It adds something different to the CTF game in much the same way as the DeathMatch Titans or Skaarj Berserkers do or, indeed, as Team Cannon do - so it is support for the bots and humans of its team.

User avatar
EvilGrins
Godlike
Posts: 8007
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: ZenCoder's fix for PlayerBots

Post by EvilGrins » Tue Apr 27, 2021 9:26 pm

Red_Fist wrote:
Tue Apr 27, 2021 6:44 pm
And what is the reason for this bot in the first place ?, no one said what it is suppose to do differently.
It behave just like a normal bot but if you had your bot selection at 0 so only human players were on the specific map these were edited on... they'd still be there.

I don't know why ZenCoder developed them, but I can see advantages to them for some things I've done before in the past by editing playerbots directly onto maps for certain situations.

They're rather like the NPC character bots:
viewtopic.php?f=5&t=14002
In certain aspects but not so limited as this can be done with any bot class, even for custom models.
OjitroC wrote:
Tue Apr 27, 2021 6:55 pm
not controlled by the Player in terms of reacting to orders (at least, I don't think it does)
I've had mixed results on that. Sometimes they do what i tell them to, but usually not.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758

User avatar
OjitroC
Godlike
Posts: 2427
Joined: Sat Sep 12, 2015 8:46 pm

Re: ZenCoder's fix for PlayerBots

Post by OjitroC » Tue Apr 27, 2021 10:37 pm

EvilGrins wrote:
Tue Apr 27, 2021 9:26 pm
I don't know why ZenCoder developed them,
To give 'flesh and blood', as it were, to the stories for Burger Wars and HotSexDisco - see the readmes.

User avatar
sektor2111
Godlike
Posts: 5340
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ZenCoder's fix for PlayerBots

Post by sektor2111 » Wed Apr 28, 2021 5:51 am

Red_Fist wrote:
Tue Apr 27, 2021 6:44 pm
What does this do, or mean ?

"his one won't roam without weapon spreading errors"

And what is the reason for this bot in the first place ?, no one said what it is suppose to do differently.
This means to LOOK at LOG file, exactly - I told about LOGS hundreds of times. See what map's junk does.
First of all DeathMatchplus adds Bot and sends him immediately in Dying-WaitingForStart and sets jumping capability while this code is only changing the stupid name doing nothing else at pawn, and it will be like a rock unable to jump on a lousy box until dies and respawns. Bot from map will start roaming immediately without any weapon and... doing ScriptWarnings because code is based on Weapon :loool: . Heh, "coders"...
In servers, the prick has no reason to move as long as player is not there and... I witnessed such games running out of players but roamed by Bots going nowhere in a few hours because UE1 was never supposed to do this - Bots are added After Player in net-games and not Before. A plain vanilla server out of players and add-ons (TickFix, etc) is lowering tick-rate when is empty and this is affecting Pawns roaming around and poorly written combat states. You cannot dream how much I tested these things...
EvilGrins wrote:
Tue Apr 27, 2021 9:26 pm
I've had mixed results on that. Sometimes they do what i tell them to, but usually not.
Then Bot added in Team Follows Orders but Not OLD BOT which is rooted in class BOTS - read well: "B-O-T-S" not BOT aka "B-O-T".
Map_Bot1.PNG
Map_Bot2.PNG
These are two different things and no they are not working in the same way. Only Bot is using ImpactHammer and Translocator and UT_JumpBoots, the old one doesn't do these.

Challenge: Make Map's Bots type - not Bot - to gain enemy flag and bring it at Home... Let's see what Coder do... then it comes my turn as non-coder. Don't forget to destroy virus line:

Code: Select all

Sleep(0.25 + DeathMatchGame(Level.Game).NumBots * FRand());
We are in DeathMatchPlus not DeathMatchGame. Game-type should not mess here but... it's butt.

DeathMatchPlus not only adds a default Inventory but it will set JumpZ capability. This capability allows Pawn in Hard-Core difficulty to jump on a box having 64 UU height or such a heavy spot. If you ask me about paths over such Box I assure you that EDITOR will do this path automated if you are aware about "How-To". As long as here and there is claimed that I cannot write properly a sentence in english, I will allow others to write this "turturial".

Edit: Party is ON for Bot known as XAN - let me know if here he does a mountain of warnings or not...
DM-NotThatSmall_XB.7z
You do not have the required permissions to view the files attached to this post.

User avatar
OjitroC
Godlike
Posts: 2427
Joined: Sat Sep 12, 2015 8:46 pm

Re: ZenCoder's fix for PlayerBots

Post by OjitroC » Wed Apr 28, 2021 11:38 am

sektor2111 wrote:
Wed Apr 28, 2021 5:51 am
Challenge: Make Map's Bots type - not Bot - to gain enemy flag and bring it at Home...
Ronald the Clone isn't in the map to capture the flag - it's there to support the Red (McD) team and attack Blue (BK) team 'players' - it's all a bit of fun to fill out the Burger Wars theme and story - I don't think it should be taken too seriously.

User avatar
sektor2111
Godlike
Posts: 5340
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ZenCoder's fix for PlayerBots

Post by sektor2111 » Wed Apr 28, 2021 12:13 pm

What If I say that he can do random captures in smaller maps ?

User avatar
OjitroC
Godlike
Posts: 2427
Joined: Sat Sep 12, 2015 8:46 pm

Re: ZenCoder's fix for PlayerBots

Post by OjitroC » Wed Apr 28, 2021 1:07 pm

sektor2111 wrote:
Wed Apr 28, 2021 12:13 pm
What If I say that he can do random captures in smaller maps ?
I'd say that could be interesting!

I'd also say the more an UnrealShare bot becomes like a Botpack bot the point in having it in the map becomes less unless it becomes exactly like a Botpack Bot and can do everything that that Bot can do. In particular it would need to respond to orders - for me, when playing team games (CTF and TDM in particular) there is nothing more frustrating than bots on my team that don't fully respond to what I want them to do (MBots are of course better at this).

Personally I just see the 'PlayerBots' as having the same role as the DM Titans, Warlords or Skaarj Berserkers - as hazards or disruptors for teams to take account of and deal with accordingly but not as something considered to be an active and full part of one's team. Basically they are mobile 'Team Cannons' as it were - they spice up the map, they provide an additional 'hazard' to negotiate.

User avatar
sektor2111
Godlike
Posts: 5340
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: ZenCoder's fix for PlayerBots

Post by sektor2111 » Wed Apr 28, 2021 1:28 pm

To be honest was easier to setup a Berserker for a capture compared with Bots type. These are roamers for items and don't know what else is goal. Berserker can do clumsy captures but... it requires only stock things, no add-on script is needed.

User avatar
EvilGrins
Godlike
Posts: 8007
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA

Re: ZenCoder's fix for PlayerBots

Post by EvilGrins » Wed Apr 28, 2021 4:07 pm

sektor2111 wrote:
Wed Apr 28, 2021 12:13 pm
What If I say that he can do random captures in smaller maps?
Oh, he does flag captures on this big map too... though not often.

One thing I've noted while doing these kinda tests on this is I don't see any listings of playerbots for Nali or WarCows or Skaarj Hybrids in the BotPack. I would've figured they'd just be there due to the patches that put them into the game... or I'm seriously looking in the wrong part.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758