Closed NicEastvillage closed 1 month ago
Great question - and the answer is mostly that I forgot about loadout generators. Whoops
Wdym, we all forgot about it
We can always allow bots to build a second exe, we pass the predicted name/index/team via environment variables, and the separate exe can generate the loadout... but how would the exe return the loadout?
I think it would be best if it constructed the loadout flatbuffer and just pushed it to stdout, it's a pretty small flatbuffer so if we mandate that it starts with a custom prefix and ends with a newline that would be easy to parse for.
I don't want to use TCP because opening a new connection just for that would be a bit messy and slow as the connection will be live for < 1s and only to receive one packet is a bit silly.
I think we should add a loadout field to the ready packet instead. We could also add an override field in the matchsettings packet to override the loadout in the ready packet.
While that's possible, that would require despawning and respawing the car in the match for every car with a loadout generator. It's something to discuss.
We discussed this on Discord and landed on the following solution. If a bot config has the setting loadout_generator=true
(name up for debate), then core will wait for the bot's process to send a SetLoadout
message describing its loadout before starting the match. The loadout can thus be generated in the initialize_agent()
method and take the bot's name, index, and more into account.
Additionally, we may allow bots to send SetLoadout
messages during a match (meme potential), but this can also be entire disabled in the match settings akin to state setting and rendering. Since the car will require respawning, we will have to experiment with whether we can make a smooth loadout change using state setting.
Regarding naming; I think the bot toml field that indicates if a bot wants to generate its loadout should be generates_loadout=true
(it is no longer a thing, but a behavior), and changing loadout during a match should be called hot-swapping loadout. Notice also that we use "loadout" instead of "appearance". In v4 both terms were used. Let's try to make it consistent in v5, i.e. replace occurrences of appearance with loadout.
v4 has a feature called loadout generators, where people can have the same bot look different each match based on name, index, and more. In v4 this was done by making a Python script and adding the path to it in the bot config file. v5 does not come with Python. How do we support this feature in v5?