Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The main thing is that synchronizing the state is hard: with hundreds of units and low latency being important, there's big advantages to having a deterministic simulation and relaying the player's commands instead of the whole game state, in fact unless you know everyone playing the game has a very good internet connection it's the only viable option. As an added bonus, it also allows you to hide small amounts of latency without rollbacks or stuttering by having a small delay on command execution. Once you've got that it's obvious that the best way to make a replay file is to save the stream of commands, and this also doubles as a save file, as opposed to making a seperate mechanism for saving and loading state which might introduce it's own bugs.

(It's not impossible to do both: while it's not strictly an RTS, Factorio has the same difficulty of synchronising the whole game state in multiplayer, but also has the disadvantage of quite long-lived and simulation-intensive games. So it uses a hybrid approach: it has a deterministic engine and a game state save, and when someone joins a multiplayer server, the server snapshots and sends the game state, which may take a few minutes, then it sends a replay to catch that player up to the current state of the game. But this is something that took them a lot of work to get into a reliable state and was kind of forced onto them by the constraints they had to work with)



Thank you for explaining.

> there's big advantages to having a deterministic simulation and relaying the player's commands instead of the whole game state, in fact unless you know everyone playing the game has a very good internet connection it's the only viable option.

If I understand, running it all on a server and just updating player UIs doesn't work for an RTS because some user Internet connections bottleneck the updates, putting those users at a disadvantage. You need to keep as much on the client as possible.


Yeah, the bandwidth requirements quickly become very high. With modern internet connections you could maybe keep up with an old-school RTS.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: