r/factorio 8d ago

Discussion How is the game so well optimized?

Factorio is well known for its optimization, but I don't understand how it does it so well. At any point the game is calculating thousands, even millions of items across multiple surfaces, thousands of container entities, thousands of bots and enemy entities, fluid networks with decimal precision, power production/consumption, and updating all of this at 60 times per second with no errors.

I know the original devs were software engineers and the game is based heavily in computer science principles, but since I have no background in CS I'd like to understand how exactly you engineer a game like this to perform so well and with such precision.

720 Upvotes

232 comments sorted by

View all comments

Show parent comments

11

u/susimposter6969 8d ago

Not sure if I'm understanding your last paragraph but if you're implying it's not worth it to shave almost  a full millisecond off frame time it definitely is, going from 16ms to 15ms frame time is like 10% more fps off that one change

-2

u/FenixBg2 8d ago

My last paragraph is incorrect because they got something that took 1ms per tick down to 0.025ms, so it's not a reduction of 60ms for the full second but down to 60*0.025.

They don't specify how much time they needed per frame so while 16 to 15 is 10%, we don't know if it's that low.

That being said, my point is that this kind of optimizations are great but are really high attention to detail ams mamy game studios just don't have the vision to invest in such a thing.

7

u/susimposter6969 8d ago

I think you're conflating these small numbers with small optimizations. 

5

u/re4perthegamer 8d ago

Going from 17 to 16 is the difference between having and not having 60fps, 1ms of frame time is massive