This implements minimal functionality to host a 'dedicated server' locally.
Core features:
- Well, it provides a NetServer, which centralises messages and relays commands. You can start the game, choose your settings, and so on. It works exactly like hosting normally, but the NetServer is provided by an external process instead of a thread.
- By itself, NetServer is quite useless. It does not run the simulation, so can't detect OOS, can't be used to rejoin an active game, etc.
- It is, however, very lightweight. On my machine, starting with -mod -dedicated, I never go above 40Mb of ram. CPU is virtually 0.
Additional features (mostly TODO):
- This starts a 'headless' client, which is used, via a simple JS script, for more advanced interactions. This JS script can be used to process chat messages, & ultimately posible simulation commands & so on. This client also costs essentially 0 RAM/CPU, since it doesn't run the game either.
- Not that I've coded any advanced interaction so far.
- Why not just use the netServer? This reduces the # of changes that must be made, I think. But this is definitely debatable.
- This connects to the lobby, making it possible (TODO) to register the game on the lobby once the controller joins. This would largely complete the 'dedicated server' part.
TODOs & extensions:
- Headless clients are not very useful beyond core dedicated server functionality. By running a 'full' observer, the server could provide a recovery point in case all clients crash. The server could also confirm who is OOS, things like that. However, that would use up more resources, even if doing so non-graphically (which I'd recommend), so should definitely remain optional IMO.
- Headless clients could probably be used by the ratings bot to gather more information on a game and reduce likelihood of cheating.
- Probably want more logging
- Probably want more configurability
Explicitly not in scope here:
- Starting a dedicated server using a lobby bot. That would technically be quite easy at this point, you'd just need to start a pyrogenesis instance with appropriate settings and forward those to the requester, but it needs some python, and I'd rather do it separately.