Kicking bots properly
In an online server when a bot is kicked a blank name still exists in the score screen. I tried both client.drop() and client.delete(). And .delete() doesn't even remove the bots at all from the server. The score menu gets properly updated when the next map is loaded if bots were kicked in the previous match. There are no such problem in an offline server.
Does anybody have any idea why .drop/.delete doesn't work properly in an online server before I spend more time looking into it? It would be really helpful to me as my bot mod makes use a lot of this feature. My bot mod currently uses .drop().
There's also a thread about this but no good solution was posted:
https://www.tribesnext.com/forum/index.php/topic,1047.0.html
Does anybody have any idea why .drop/.delete doesn't work properly in an online server before I spend more time looking into it? It would be really helpful to me as my bot mod makes use a lot of this feature. My bot mod currently uses .drop().
There's also a thread about this but no good solution was posted:
https://www.tribesnext.com/forum/index.php/topic,1047.0.html
Comments
In practice however ai.drop() only handles cleanup on the server side: you also need to notify the client that there's work to be done. Clients need to receive a 'MsgClientDrop' chat message when the bot is removed in order for it to run the player/lobby cleanup handler -- for human players normally this is triggered by the "X has left the game." message, but it's often also sent as a blank message (see functions kick() or ban() in server.cs and try running kick(ai); to see).
To be more specific, adding a line similar to this to the AI drop sequence would ensure clients register their removal from the game:
As an additional note: there was definitely a bit overlooked in regards to removing bots from the game, so something you may also note if doing this often on a long running server is that their associated tagged strings and targets will not be cleaned up with the default handling (i.e. you'll eventually hit the max allocation if you're running the server for weeks and replacing the bots every match). You should be able to fix this by copying the appropriate parts of the GameConnection onDrop cleanup over to AIConnection::onAIDrop.