News for hackers. Stuff that matters.
Re:Factorio Developer Discusses Optimizations Used by bombcar on Monday May 08, 2023 @11:13PM (#35869791)
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.

Re:Factorio Developer Discusses Optimizations Used by hlandau on Tuesday May 09, 2023 @02:41AM (#35870902)
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.
Re:Factorio Developer Discusses Optimizations Used by jsheard on Tuesday May 09, 2023 @06:26AM (#35872208)
Floats can be problematic even between different IEEE754 architectures, for example some SSE/AVX instructions give slightly different results on AMD and Intel processors. They are only specified with a minimum precision so you can't count on the least significant bits to be consistent.
Re:Factorio Developer Discusses Optimizations Used by armchairhacker on Tuesday May 09, 2023 @09:10AM (#35873787)
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.

Re:Factorio Developer Discusses Optimizations Used by tomatotomato37 on Tuesday May 09, 2023 @09:38AM (#35874127)
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)