Settings

Theme

Factorio Developer Discusses Optimizations Used

old.reddit.com

50 points by justinnhli 3 years ago · 5 comments

Reader

armchairhacker 3 years ago

It’s really nice to see that the solutions they use are really simple.

It seems like no tricky optimizations or complex algorithms, they just tick everything active every frame. The key is that they don’t tick things they don’t have to, and don’t render off-screen sprites, so “ticking” an entity is updating a tiny datastructure and maybe a few other datastructures it points to.

  • tomatotomato37 3 years ago

    They do gloss over some RAM/processor cache optimizations near the end that in my experience can get a bit wacky implementing, but yeah seems overall very simple.

    I especially like the rule that nothing can exceed O(N)

bombcar 3 years ago

Factorio is interesting because it is a deterministic simulation of all the entities (this is how multiplayer works; they're all running the same simulation and only passing "commands").

RAM speed is often the limiting "factor"(io) as to how fast the simulation can run or how large you can build.

  • hlandau 3 years ago

    This is a very common way to handle multiplayer for RTS-style games. The inputs of the computation are the same, and the computation to update the game state is deterministic, so only the inputs are needed by every client. The disadvantage is if the logic deviates even slightly due to a bug you get a desync. If using floats I could also imagine there being issues with IEEE 754 architectures versus non-IEEE 754 architectures.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection