deterministic lockstep

Post all other topics which do not belong to any other category.
User avatar
TheKillerChicken
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Sat Mar 02, 2019 7:06 am

deterministic lockstep

Post by TheKillerChicken »

I do not know if this is the right location, but I am curious why Factorio uses a deterministic lockstep setup. Was there not any other alternative, or is it due to how the engine handles everything?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3757
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: deterministic lockstep

Post by boskid »

Because amount of state changes each tick is so large that multiplayer would not be feasible otherwise.
User avatar
TheKillerChicken
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Sat Mar 02, 2019 7:06 am

Re: deterministic lockstep

Post by TheKillerChicken »

I see, now that makes sense. Thank you for this info.
User avatar
TheKillerChicken
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Sat Mar 02, 2019 7:06 am

Re: deterministic lockstep

Post by TheKillerChicken »

Sorry, another question, is there a reason why the server/client must have the exact same data and CRCs?
Loewchen
Global Moderator
Global Moderator
Posts: 9914
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: deterministic lockstep

Post by Loewchen »

TheKillerChicken wrote: Sun Mar 30, 2025 9:14 pm is there a reason why the server/client must have the exact same data and CRCs?
Otherwise you would not play the same game.
User avatar
MEOWMI
Filter Inserter
Filter Inserter
Posts: 350
Joined: Wed May 22, 2019 12:21 pm
Contact:

Re: deterministic lockstep

Post by MEOWMI »

TheKillerChicken wrote: Sun Mar 30, 2025 9:14 pm Sorry, another question, is there a reason why the server/client must have the exact same data and CRCs?
Once you have deterministic lockstep, the entire game can be simulated perfectly, without errors, and any remaining errors are due to existing errors in data or data corruption, and any one error will eventually cascade into completely different game states (read up on the butterfly effect if you're still unsure). Usually caused either by faulty starting data, faulty hardware, or by problems in data transmission during multiplayer. Any of them would be comparatively rare cases, but either way, at that point in program development, it's easily worthwhile to add checks to ensure that the data is and remains the same, considering that after that, you have nearly perfect multiplayer that just works.

Lockstep basically requires complete data integrity, so you implement checks for it if you are designing a game with lockstep in mind.
User avatar
TheKillerChicken
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Sat Mar 02, 2019 7:06 am

Re: deterministic lockstep

Post by TheKillerChicken »

MEOWMI wrote: Sun Mar 30, 2025 9:32 pm
TheKillerChicken wrote: Sun Mar 30, 2025 9:14 pm Sorry, another question, is there a reason why the server/client must have the exact same data and CRCs?
Once you have deterministic lockstep, the entire game can be simulated perfectly, without errors, and any remaining errors are due to existing errors in data or data corruption, and any one error will eventually cascade into completely different game states (read up on the butterfly effect if you're still unsure). Usually caused either by faulty starting data, faulty hardware, or by problems in data transmission during multiplayer. Any of them would be comparatively rare cases, but either way, at that point in program development, it's easily worthwhile to add checks to ensure that the data is and remains the same, considering that after that, you have nearly perfect multiplayer that just works.

Lockstep basically requires complete data integrity, so you implement checks for it if you are designing a game with lockstep in mind.
Interesting. I did not know that. That solves that mystery for me.
Post Reply

Return to “General discussion”