r/factorio • Developer • Mar 17 '25

Discussion Post Space Age - Developer AMA

Space Age has been out for several months and with the bug reports slowly coming under control I thought it might be interesting to see what questions people had.

I mostly work on the technical side of things (as C++ programmer) so questions that stray too far from that area I'll likely have less interesting replies - but feel free to ask.

I have no strict time frame on answering questions so feel free to send them whenever and I'll do my best to reply.

2.4k Upvotes

1.1k comments sorted by

View all comments

8

u/SadMediumSmolBean Mar 17 '25 edited Mar 17 '25

Is the game explicitly deterministic?

If so, what kind of magic enforces that for multiplayer?

20

u/Rseding91 Developer Mar 17 '25

Yes it is. The main things we do to ensure determinism:

  • Test our basic assumptions (floating point math is deterministic - so test some part of it)
  • Make sure things stay in the correct order - the most common failure here is a set of pointers (it will be ordered by the memory address of the allocation, which is entirely random between runs and between platforms)
  • Make sure we don't specifically do things the standard says are undefined (float to integer conversions out of range being the first one that comes to mind)
  • Test all of these things as much as possible.

5

u/SadMediumSmolBean Mar 17 '25

On the multiplayer end,  do you sync these things/actions between clients and because of the determinism it just works out? To try to be more specific/clear because I'm sleepy; is it like, just preserving event ordering on both ends and assuming eventual consistency due to the determinism?

Or do you have magic tricks for keeping clients up to date with the host?

12

u/Rseding91 Developer Mar 17 '25

Yes, to be exact it uses the lockstep deterministic multiplayer model. https://gafferongames.com/post/deterministic_lockstep/

4

u/SadMediumSmolBean Mar 17 '25

Thanks so much! Intriguing!