jswigart / omni-bot

Omni-bot is a first person shooter bot frameworkfor AI controlled multiplayer opponents in several popular FPS games and engines
http://www.omni-bot.com
75 stars 23 forks source link

ET Bots don't kill themselves during warmup for class change #19

Closed Totten98 closed 3 years ago

Totten98 commented 3 years ago

Hey guys, I've been trying to make this work but I'm hopeless now, I need some help. In my ET:Wolf server I have some maps in panza mode. The problem is that when those maps ends the bots don't change class during the next map warmup. This cause that at the start of the map all bots are soldier and it's not good. I've been searching through the bots file and found out this on the goal_classmanager.gm file:

// cs: let them /kill in warmup so transitions from snipe or panzer maps wont take forever for correct classes to be used
if ( !this.OnlyWhileDead || GetGameState() != "Playing" ) {
    this.CheckForClassChange();
}

This is exactly what I need. Too bad that it does not work :'( I'm running ET 3.00 with Jaymod 2.2.0, EnhMod V1.0.9e and omni-bots 0.87.

Can someone help me? Thanks, Totten.

plastovicka commented 3 years ago

How long is the warmup on your server ? It should be at least 10 seconds.

Totten98 commented 3 years ago

Thanks for replying! It's 30 second right now, i also tried with 60 tho. Still does not work :/

Totten.

plastovicka commented 3 years ago

Do they change class if anybody kills them during warmup ? What happens if you kill them all by a console command bot kt 1;bot kt 2 ?

Totten98 commented 3 years ago

Thanks again for the fast reply :D No, they just kill themselves and respawn. I tried both with !splata (kills all player), and with your command. They only change class after their first death when the game is already started.. :'(

Totten.

plastovicka commented 3 years ago

Maybe the problem is in GetPriority function in the goal_classmanager.gm file. You can try to delete if:

this.GetPriority = function()
{
    this.Priority = 1.0;
    block(0);
};
Mateos81 commented 3 years ago

A note perhaps not usefull; on V1 Rocket (Beta 2), I often have a couple of bots selfkilling after the match has started, Allied side (also 30 seconds warmup, they join during the 1st 10 seconds of the warmup) These waypoints have roles from the beginning, with a CrucialClass set

Totten98 commented 3 years ago

Maybe the problem is in GetPriority function in the goal_classmanager.gm file. You can try to delete if:

this.GetPriority = function()
{
  this.Priority = 1.0;
  block(0);
};

Nothing, i changed the code but they do not kill anyway during the warmup :/ I also tried changing the warmup time to 60 seconds just to be safe and still nothing.

Totten98 commented 3 years ago

I think the problem is actually in the file et_classmanager.gm. I think this function always returns null on the warmup:

member EvalClassChange = function(bot)
{
    // update class counts
    team = bot.GetTeam();
    ClassManager.UpdateClasses(team);

    //evaluate this bot
    botClass = bot.GetClass();
    botEval = ClassManager.EvaluateClass(team, botClass, Server.ClassCount[team][botClass] - 1);
    isDead = GetEntFlags(bot.GetGameEntity(), ENTFLAG.DEAD, ENTFLAG.LIMBO);

    //evaluate all classes
    newClass = null;
    foreach ( class and num in Server.ClassCount[team] )
    {
        if (class!=botClass) // don't change to same class
        {
            eval = ClassManager.EvaluateClass(team, class, num);
            if (eval >= botEval && (eval > botEval || isDead && RandInt(0,3)==0) )
            {
                botEval = eval;
                newClass = class;
            }
        }
    }

    return newClass;
};

I'm probably wrong but it's worth mentioning.

Totten98 commented 3 years ago

I found a workaround to this problem. I noticed that if the server reload the map 2 times the bots will kill in the warmup, so i edited my map rotation file to be like this:

set d1 "set g_gametype 2 ; map goldrush ;set nextmap vstr d2; wait 128; reset_match"
set d2 "set g_gametype 2 ; map oasis ; set nextmap vstr d3; wait 128; reset_match"
set d3 "set g_gametype 2 ; map railgun ; set nextmap vstr d1; wait 128; reset_match"
vstr d1

Basically I just added wait 128; reset_match to run every time a new map loads and this let the bots kill during the warmup (don't ask me why xD) This is not a "fix" but a good workaround if somebody has to problem too.

Thanks everybody for helping. Totten.