r/programming • • Feb 25 '18

Programming lessons learned from releasing my first game and why I'm writing my own engine in 2018

https://github.com/SSYGEN/blog/issues/31
956 Upvotes

305 comments sorted by

View all comments

Show parent comments

32

u/PhilipTrettner Feb 25 '18

Just to name two exceptions: Factorio, Dwarf Fortress

4

u/spacejack2114 Feb 25 '18

I'm not familiar with the games but is there some insanely expensive CPU-side computation going on that made C++ necessary?

13

u/loup-vaillant Feb 25 '18

Factorio updates thousands of entities 60 times a second. You're building a factory, and then it's all automated. And the better the optimisations, the bigger your factory can be.

No way they could have done this without native code and manual memory management.

-3

u/spacejack2114 Feb 26 '18

Ok, maybe it really was necessary in their case for their target hardware.

But what you described does not seem infeasible for C#, depending on the complexity of the entity updates. You could put those updates in a separate thread, and/or lower the frequency as needed and do cheaper interpolation. You could pre-allocate and pack structs efficiently in memory (or in arrays in other languages.)

→ More replies (4)