Currently I'm manually truncating the 'log.txt' file and then restarting the altitude server process before starting pyaltitude to get a clean state so bots are initialized properly. I previously looked at parsing the history of the log when starting pyaltitude, but the log rotates itself, so if you ever need to restart pyaltitude after a rotate of the altitude server log, you wouldn't get those initial bots addClient events. It also wouldn't know of any players that were currently in any of the arenas; only of those that came in afterwards. I think there are two possible answers. One is to just make a solution that works along the same way I have been going. Add some part of the log.txt truncate and altitude server restart to the code or perhaps all of it. The other possibility is to consider leaving the log intact and using /listPlayers on startup to get the initial player list and then fill in from there. It only begins with minimal fields (ip, vaporID, nickname) and restarting mid game would surely cause bugs for players, but for bots it might do the trick. Then we wouldn't have to deal with managing processes and truncating log files, etc.
I rename log.txt on startup to provide this same functionality. It is also good if you want to troubleshoot something in the log file, to have a log file dedicated to a single session.
Currently I'm manually truncating the 'log.txt' file and then restarting the altitude server process before starting pyaltitude to get a clean state so bots are initialized properly. I previously looked at parsing the history of the log when starting pyaltitude, but the log rotates itself, so if you ever need to restart pyaltitude after a rotate of the altitude server log, you wouldn't get those initial bots
addClient
events. It also wouldn't know of any players that were currently in any of the arenas; only of those that came in afterwards. I think there are two possible answers. One is to just make a solution that works along the same way I have been going. Add some part of thelog.txt
truncate and altitude server restart to the code or perhaps all of it. The other possibility is to consider leaving the log intact and using/listPlayers
on startup to get the initial player list and then fill in from there. It only begins with minimal fields (ip, vaporID, nickname) and restarting mid game would surely cause bugs for players, but for bots it might do the trick. Then we wouldn't have to deal with managing processes and truncating log files, etc.