Campaign doesn't balance bots in team games according to g_campaign_forceteam and forced team for bots
I'm building a campaign in which the player is meant to play alongside a predefined team against another specific team. I do this by setting a custom bots.txt for each level, as well as forcing the player into the team designated to them. For example: Set "g_campaign_forceteam 1; bot_config_file bots_mycampaign_mylevel.txt" in the level's mutator-sets field, where bots_mycampaign_mylevel.txt contains 5 bots for the blue team and another 5 for the red team.
Currently the campaign system is unable to properly assign each bot to the correct team in time. First of all, teams aren't initially balanced to begin with: If for instance you set the level's bot number to 6, you only sometimes get 3 bots in the red team and 3 in blue, at times the teams will be unbalanced so you see something like 2 bots on red and 4 on blue. Ideally the code should check g_campaign_forceteam and if it's set, leave a space for the player in the team where they're going to be spawned (if there's an impair number of bots, ignore and leave them equal otherwise).
Further more, once the player joins the match, bots are moved to different teams in an attempt to fix the balance. When this is done however, the system no longer regards the team of that bot. This means that a bot configured to only be on the red team may end up in the blue team and vice versa.
This is breaking my campaign so I'm hoping a solution won't be difficult to find. Here's a bot file I put together for testing this issue: It's built to contain 5 bots on one team and 5 on the other, use it together with g_campaign_forceteam and an uneven bot number (3, 5, 7, etc) in a TDM campaign level.
//red team
Red_1 megaerebus 0 0 0 1 1 1 1 0.5 1 1.5 0.5 0 0.75 0.5 0.75 1
Red_2 megaerebus 0 0 0 1 0 1.5 1 1 1 1 0 0 -0.25 0.5 0.5 0.25
Red_3 megaerebus 0 0 0 1 -0.5 0 0 -1 0 -0.5 -1 0 0.5 0.5 -0.5 0
Red_4 megaerebus 0 0 0 1 0 0 -0.5 0 0.5 1 0.5 0 -0.5 0.25 0.75 0.5
Red_5 megaerebus 0 0 0 1 0 0 -0.5 -1 0 0 0.5 -0.5 -1 0 0 -0.5
//blue team
Blue_1 megaerebus 0 0 0 2 1 -1 -1 0 1 1 2 1 0.5 1.5 1.5 1.5
Blue_2 megaerebus 0 0 0 2 1.5 -0.5 -0.75 0.5 0.75 0.5 2 1.5 1 1 1.5 1.5
Blue_3 megaerebus 0 0 0 2 1 0.5 0 0.5 1 0.5 1 0.5 0 0 1 0.5
Blue_4 megaerebus 0 0 0 2 1.5 1 1.5 1 0.5 1 1 0.5 1.5 1 1 1
Blue_5 megaerebus 0 0 0 2 1 1 1 0 0 0.5 1 0 0 0.5 -0.25 0.75
EDIT by terencehill: set the example config as raw text.