Official Battle Tanks Community
How to make bot shuffle? - Printable Version

+- Official Battle Tanks Community (https://btanks.net/forum)
+-- Forum: Battle Tanks - Warcraft III (https://btanks.net/forum/forumdisplay.php?fid=3)
+--- Forum: Hosting BT with Hostbots (https://btanks.net/forum/forumdisplay.php?fid=25)
+--- Thread: How to make bot shuffle? (/showthread.php?tid=725)



How to make bot shuffle? - fudtone - 2010-02-16

how do I make the bot do !sp for each game it autohost?


Re: How to make bot shuffle? - Velocity2k - 2010-02-16

You have to edit the source code.

Just add a ShuffleSlots( ) in the CBaseGame::EventGameStarted( ) function (and recompile).


Re: How to make bot shuffle? - fudtone - 2010-02-16

Thank you for that.

Any way to make it only the auto-hosted games?


Re: How to make bot shuffle? - Velocity2k - 2010-02-16

It's hard to detect an autohosted game. You can check if m_AutoStartPlayers is greater than 0. But then the bot will also shuffle games where you use the !autostart x command.

With some more programming there is also a better solution. For example you can define a boolean variable and set it when the bot creates a autohost game.


Re: How to make bot shuffle? - fudtone - 2010-02-16

Ill stick with your original solution if I can.

So editing the game.ccp would look like this?

Code:
{
    CBaseGame :: EventGameStarted( );

    // record everything we need to ban each player in case we decide to do so later
    // this is because when a player leaves the game an admin might want to ban that player
    // but since the player has already left the game we don't have access to their information anymore
    // so we create a "potential ban" for each player and only store it in the database if requested to by an admin

    for( vector<CGamePlayer *> :: iterator i = m_Players.begin( ); i != m_Players.end( ); i++ )
        m_DBBans.push_back( new CDBBan( (*i)->GetJoinedRealm( ), (*i)->GetName( ), (*i)->GetExternalIPString( ), string( ), string( ), string( ), string( ) ) );

ShuffleSlots( );
}



Re: How to make bot shuffle? - Velocity2k - 2010-02-16

I've put it in game_base.cpp. Maybe you want to have it look like this:
Code:
void CBaseGame :: EventGameStarted( )
{
    if( m_AutoStartPlayers != 0 )
        ShuffleSlots( );

    CONSOLE_Print( "[GAME: " + m_GameName + "] started loading with " + UTIL_ToString( GetNumHumanPlayers( ) ) + " players" );
...
}
This will shuffle the slots after the countdown and only if it's an autohosted game or a game with !autostart x.

EDIT: You could also make the shuffle configurable through a mapconfigWink.


Re: How to make bot shuffle? - fudtone - 2010-02-17

Seems to be working. Thank you.