Make bots respawn faster
Make bots respawn faster
Is there a way to program a mutator that makes bot respawn in a couple of seconds, kind of like ut2004? If there isn't a mutator like that out there, I would be interested in making a little mutator for that. What direction should I take to learn about bot spawning delay?
Thanks in advance.
Thanks in advance.
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Make bots respawn faster
^ That's not what he wants (those are all spawn protections afaik). He wants to customize the bots respawn time.
@gamer13:
As for defining how much time it takes for bots to respawn, using a mutator alone, unfortunately is not possible in UT1.
I just checked UT's code on that part, and it's all hardcoded, all of it, with no direct possibility to change such values externally.
The only slightly possible way would be to create your own bots so you could modify their respawn code directly within the Dying state, but then you would have to create subclasses for all existing bots: male soldier, female soldier, boss (Xan), etc... and then replace the standard ones by their subclassed counterparts.
Plus, any custom bot from someone else wouldn't obey your respawn rules at all.
@gamer13:
As for defining how much time it takes for bots to respawn, using a mutator alone, unfortunately is not possible in UT1.
I just checked UT's code on that part, and it's all hardcoded, all of it, with no direct possibility to change such values externally.
The only slightly possible way would be to create your own bots so you could modify their respawn code directly within the Dying state, but then you would have to create subclasses for all existing bots: male soldier, female soldier, boss (Xan), etc... and then replace the standard ones by their subclassed counterparts.
Plus, any custom bot from someone else wouldn't obey your respawn rules at all.
Re: Make bots respawn faster
Is there maybe a way to apply "forced respawn" on bots. Because it seems like it only applies to human players. Or am I thinking of the concept of "forced respawn" wrong.
By the way, I really liked your tutorial Ferali.
Thanks much.
A little side note; here are my video tutorials on YouTube on 3D art.
By the way, I really liked your tutorial Ferali.
Thanks much.
A little side note; here are my video tutorials on YouTube on 3D art.
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Make bots respawn faster
Bots are always forcefully respawned. The "force respawn" setting in UT only applies to human players because in this case the respawn may be dependent on the player's input to do so.gamer13 wrote:Is there maybe a way to apply "forced respawn" on bots. Because it seems like it only applies to human players. Or am I thinking of the concept of "forced respawn" wrong.
However, yes, immediate respawns are generally possible, only making them taking a specific amount of time is not, all you would have to do is to trigger the function ReStartPlayer() once the bot is in its Dying state.
But it requires a bit of careful coding, since to not bug things out, you also have to check for some things the bot checks itself before respawning, as you can check in the bot Dying state original code:
http://uncodex-ut.host56.com/Source_botpack/bot.html (check line 7219: state Dying onwards)
As you can see, you have to check if the game ended and manage other small things to keep the fluidity of the bot code.
Thanks, more will come later on.gamer13 wrote: By the way, I really liked your tutorial Ferali.
Very nice tutorials I must say. Thanks for the contributiongamer13 wrote: A little side note; here are my video tutorials on YouTube on 3D art.
Re: Make bots respawn faster
After I made changes to the code in Notepad++, would I save the code from UnCodeX into a .uc (that's in C:\UnrealTournament\<project name>\Classes)file and then compile to a .u files with UMake? I tried doing that and I keep getting this error:
"Can't find files matching ..\UTServerAdmin\Classes\*.uc
History: UMakeCommandlet::Main"
Or is Botpack a totally different ball park in terms of compiling a new alternate botpack.u file.
Thanks
"Can't find files matching ..\UTServerAdmin\Classes\*.uc
History: UMakeCommandlet::Main"
Or is Botpack a totally different ball park in terms of compiling a new alternate botpack.u file.
Thanks
-
- Inhuman
- Posts: 958
- Joined: Wed Mar 31, 2010 9:02 pm
- Personal rank: I am quite rank.
- Location: MrLoathsome fell out of the world!
Re: Make bots respawn faster
From that error, it appears that the paths are not set correctly.
Looks like UMake is looking for your project in the UnrealTournament\UTServerAdmin folder, which
is probably not where it should be.
Also re: Botpack
I am fairly sure that is not something that should be changed and recompiled at all.
What you need to do is create a new class that will extend whatever it is in Botpack that you
want to modify.
No doubt Ferlidragon will be covering that topic soon as he gets more of his excellent tutorials completed.
Edit - Back on topic, and to expand on Ferlidragons earlier comments.
As he mentioned, the code that controls that is buried very deep in the engine.
And, it is a bit complex. It has been a while since I looked at that stuff, but I believe it does do
some checks, based on the number of players/bots in the map and also the number of available SpawnPoints.
It also tries to select a SpawnPoint from the list of available candidates that is out of view of any of the
other Players or Bots on the map.
I have noticed that in some maps, the bots take longer to re-spawn than in others. Some maps it seems to
happen instantly, others, not so much. Depending upon the number of bots/players on the map and who knows
what else. For the most part, it hasn't been much of an issue for me.
Even if it could be adjusted, I am not sure if it should be......
Looks like UMake is looking for your project in the UnrealTournament\UTServerAdmin folder, which
is probably not where it should be.
Also re: Botpack
I am fairly sure that is not something that should be changed and recompiled at all.
What you need to do is create a new class that will extend whatever it is in Botpack that you
want to modify.
No doubt Ferlidragon will be covering that topic soon as he gets more of his excellent tutorials completed.
Edit - Back on topic, and to expand on Ferlidragons earlier comments.
As he mentioned, the code that controls that is buried very deep in the engine.
And, it is a bit complex. It has been a while since I looked at that stuff, but I believe it does do
some checks, based on the number of players/bots in the map and also the number of available SpawnPoints.
It also tries to select a SpawnPoint from the list of available candidates that is out of view of any of the
other Players or Bots on the map.
I have noticed that in some maps, the bots take longer to re-spawn than in others. Some maps it seems to
happen instantly, others, not so much. Depending upon the number of bots/players on the map and who knows
what else. For the most part, it hasn't been much of an issue for me.
Even if it could be adjusted, I am not sure if it should be......
blarg
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Make bots respawn faster
Original UT files should not be recompiled ever due to Epic's copyright and online mismatches.
Therefore you don't recompile Botpack, instead you should create a new package with the kind of things you want to do.
Perhaps you're trying to change the bot code directly? If so, that's not the way I meant that should be done, instead you should make a mutator or something, which checks each bot state (in this case the Dying state), and then by making the same validations the bots do, just trigger their respawn immediately through the call of ReStartPlayer() on them.
Therefore you don't recompile Botpack, instead you should create a new package with the kind of things you want to do.
Perhaps you're trying to change the bot code directly? If so, that's not the way I meant that should be done, instead you should make a mutator or something, which checks each bot state (in this case the Dying state), and then by making the same validations the bots do, just trigger their respawn immediately through the call of ReStartPlayer() on them.
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Make bots respawn faster
My apology for necro-bump.
What's up with respawning ?
In state "Dying" there is a "sleep" code - similar to what is being used at lifts when ALL A.I. PAWN is just waiting. Here is another internal constant capable to tell you how much time is remaining from this "wait". All it does Engine is to change this value when is called "StopWaiting". Your Uscript will do that too if you know how to do such a compilation. It's about variables and capability to access them. Probably this is one of those constants which means only goofing because changing it smartly won't do any damage, you simply can stop even NON Pawns from "waiting", function "StopWaiting" is only for Pawns but... Stopping a "Sleep" cycle is definitely doable, not widely needed but... it's not impossible.
Allow me to print a small snippet...
What is needed here then ?
A mutator walking through Pawns and capturing their state. When Pawn is "Dying" or whatever "Dead", and this value is positive you might go for two tries:
#1 Call StopWaiting(DiedPawn).
#2 Change DiedPawn.LatentFloat = -1, just like that - compiling this is not my problem, it's yours.
What's up with respawning ?
In state "Dying" there is a "sleep" code - similar to what is being used at lifts when ALL A.I. PAWN is just waiting. Here is another internal constant capable to tell you how much time is remaining from this "wait". All it does Engine is to change this value when is called "StopWaiting". Your Uscript will do that too if you know how to do such a compilation. It's about variables and capability to access them. Probably this is one of those constants which means only goofing because changing it smartly won't do any damage, you simply can stop even NON Pawns from "waiting", function "StopWaiting" is only for Pawns but... Stopping a "Sleep" cycle is definitely doable, not widely needed but... it's not impossible.
Allow me to print a small snippet...
Huh ? Do you still think that I'm talking crap ? Okay, then let's see something else...Bot wrote: CampTime = FMin(5, InventorySpot(MoveTarget).markedItem.LatentFloat + 0.5);
Code: Select all
void APawn::execStopWaiting( FFrame& Stack, RESULT_DECL )
{
guardSlow(APawn::execStopWaiting);
P_FINISH;
if( GetStateFrame()->LatentAction == EPOLL_Sleep )
LatentFloat = -1.0;
unguardSlow;
}
What is needed here then ?
A mutator walking through Pawns and capturing their state. When Pawn is "Dying" or whatever "Dead", and this value is positive you might go for two tries:
#1 Call StopWaiting(DiedPawn).
#2 Change DiedPawn.LatentFloat = -1, just like that - compiling this is not my problem, it's yours.
- UT Sniper (SJA94)
- Inhuman
- Posts: 753
- Joined: Thu Jun 24, 2010 10:35 pm
- Personal rank: Retard
- Location: England
- Contact:
Re: Make bots respawn faster
I made(I think you or someone else helped) a small mutator a while ago to make bots respawn instantly(or with a min time, to stop crazy amount of telefrags), to mess around on my server/offline, it's not a great way of doing it but it is fun to play maps with 100s of bots at the same time, or even just a full 16 being active the whole time.
Code: Select all
class InstantRespawnBots expands Mutator config(InstantRespawnBots2);
var config float MinTimeBetweenSpawns;
struct PlayerRespawnHistory{
var int PlayerId;
var float LastRespawnTime;
};
var PlayerRespawnHistory RespawnHistory[255];
function updatePlayerSpawnTime(Pawn Other){
local int PlayerId;
local int i;
PlayerId = Other.PlayerReplicationInfo.PlayerId;
for(i = 0; i < 255; i++){
if(RespawnHistory[i].PlayerId == PlayerId){
RespawnHistory[i].LastRespawnTime = Level.TimeSeconds;
return;
}else{
if(i != 0){
if(RespawnHistory[i].PlayerId == 0){
RespawnHistory[i].PlayerId = PlayerId;
RespawnHistory[i].LastRespawnTime = Level.TimeSeconds;
return;
}
}
}
}
}
function float GetLastSpawnTime(int PlayerId){
local int i;
for(i = 0; i < 255; i++){
if(RespawnHistory[i].PlayerId == i){
return RespawnHistory[i].LastRespawnTime;
}
}
return 0;
}
function bool PreventDeath(Pawn Killed, Pawn Killer, name damageType, vector HitLocation)
{
local float LastSpawnTime;
local float Delta;
local bool bPrevent;
bPrevent = false;
if(Killed.PlayerReplicationInfo != None){
LastSpawnTime = GetLastSpawnTime(Killed.PlayerReplicationInfo.PlayerId);
Delta = Level.TimeSeconds - LastSpawnTime;
if(Delta >= MinTimeBetweenSpawns){
Level.Game.Killed(Killer, Killed, damageType);
Level.Game.DiscardInventory(Killed);
Level.Game.RestartPlayer(Killed);
updatePlayerSpawnTime(Killed);
bPrevent = true;
}
}
//if ( NextMutator != None )
//return NextMutator.PreventDeath(Killed,Killer, damageType,HitLocation);
return bPrevent;
}
- papercoffee
- Godlike
- Posts: 10447
- Joined: Wed Jul 15, 2009 11:36 am
- Personal rank: coffee addicted !!!
- Location: Cologne, the city with the big cathedral.
- Contact:
Re: Make bots respawn faster
srsly... 9 year old thread?
sektor2111 are you bored?
You could have open a new thread referencing this one here.
Now it's exhumed. *sigh*
sektor2111 are you bored?
You could have open a new thread referencing this one here.
Now it's exhumed. *sigh*
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Make bots respawn faster
Okay, point taken. So I need to created another topic with the same subject and the same title - NOTED. Or perhaps I won't post any solution even if I know one.
- papercoffee
- Godlike
- Posts: 10447
- Joined: Wed Jul 15, 2009 11:36 am
- Personal rank: coffee addicted !!!
- Location: Cologne, the city with the big cathedral.
- Contact:
Re: Make bots respawn faster
Thank you for the attached file. (InstantRespawnBots2.zip)UT Sniper (SJA94) wrote: ↑Tue Oct 18, 2022 9:29 am I made(I think you or someone else helped) a small mutator a while ago to make bots respawn instantly(or with a min time, to stop crazy amount of telefrags), to mess around on my server/offline, it's not a great way of doing it but it is fun to play maps with 100s of bots at the same time, or even just a full 16 being active the whole time.
InstantRespawnBots2.zip
Code: Select all
class InstantRespawnBots expands Mutator config(InstantRespawnBots2); var config float MinTimeBetweenSpawns; struct PlayerRespawnHistory{ var int PlayerId; var float LastRespawnTime; }; var PlayerRespawnHistory RespawnHistory[255]; function updatePlayerSpawnTime(Pawn Other){ local int PlayerId; local int i; PlayerId = Other.PlayerReplicationInfo.PlayerId; for(i = 0; i < 255; i++){ if(RespawnHistory[i].PlayerId == PlayerId){ RespawnHistory[i].LastRespawnTime = Level.TimeSeconds; return; }else{ if(i != 0){ if(RespawnHistory[i].PlayerId == 0){ RespawnHistory[i].PlayerId = PlayerId; RespawnHistory[i].LastRespawnTime = Level.TimeSeconds; return; } } } } } function float GetLastSpawnTime(int PlayerId){ local int i; for(i = 0; i < 255; i++){ if(RespawnHistory[i].PlayerId == i){ return RespawnHistory[i].LastRespawnTime; } } return 0; } function bool PreventDeath(Pawn Killed, Pawn Killer, name damageType, vector HitLocation) { local float LastSpawnTime; local float Delta; local bool bPrevent; bPrevent = false; if(Killed.PlayerReplicationInfo != None){ LastSpawnTime = GetLastSpawnTime(Killed.PlayerReplicationInfo.PlayerId); Delta = Level.TimeSeconds - LastSpawnTime; if(Delta >= MinTimeBetweenSpawns){ Level.Game.Killed(Killer, Killed, damageType); Level.Game.DiscardInventory(Killed); Level.Game.RestartPlayer(Killed); updatePlayerSpawnTime(Killed); bPrevent = true; } } //if ( NextMutator != None ) //return NextMutator.PreventDeath(Killed,Killer, damageType,HitLocation); return bPrevent; }
I saw the video, very cool... "with 100s of bots".
How do I put more than 16 bots (I know... Maybe I am a n00b in these intelligences, but ;P until my aim is not that bad).... "100 bots how?" ((PS: Thank you for digging up the "defunct").)
- sektor2111
- Godlike
- Posts: 6410
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: Make bots respawn faster
That's why is good sometimes to work in the same place without redundant posting. However I tried to explain a solution for "respawn faster", here is pointed a method for "instant respawn". For delaying this respawn not instant respawn all things can be done different. I think Buggie can do something suitable in his mutator.
Last edited by sektor2111 on Wed Oct 19, 2022 5:18 pm, edited 1 time in total.