4 ms·
I feel like games like Factorio don't really need that low-level optimizations to warrant for C++. It would be possible to implement it on Go/Java/C#, so would
by deepsun 4y ago
I feel like games like Factorio don't really need that low-level optimizations to warrant for C++. It would be possible to implement it on Go/Java/C#, so would be easily portable to whatever platforms.
"Write once, run anywhere" :)
- donatj 4y agoFactorio I think is particularly poorly suited to memory managed languages. My factory is enormous, hundreds of thousands of machines all doing their thing in real time. Thousands of robots flying around delivering goods. I think that really does in fact demand high level optimization.
- bombcar 4y agoFactorio does really weird things with memory (the deterministic simulation effectively reads all memory every tic) that makes it not perform like many applications are expected to.
- deepsun 4y agoDon't see any problem there, how does it relate to portability? Anyway games are going to pre-allocate large arrays and work on them, for cache affinity. That doesn't depend on C++ vs. Java. No need to create a separate object for each item in your factory, but rather a row in the array(s). And even if you do create a new object for each item, it's better to do that on heavily optimized heap, than manually allocating/deallocating memory in the same thread. You end up writing that heap in C++ anyway.
- camjw 4y ago> I feel like games like Factorio don't really need that low-level optimizations to warrant for C++. Clearly someone has not grown the factory large enough.
- kortex 4y agoWe don't know exactly what techniques are under the hood, because it is closed source (for now...I really hope they open source it one day because I want to marvel at it), but from reading all their FFF blog posts and just knowing how smooth this game runs in spite of the mind-boggling number of discrete operations a megabase can execute, I'm very confident they are doing a ton of optimizations to reduce allocation, reuse data structures, etc. I doubt they would be able to achieve that performance with a memory managed runtime. Besides, their game is already one of the most cross-platform capable games I've ever seen. There's not a lot of feasible platforms that Go/Java would open up.
- cmovq 4y agoFactorio is a great example of a game that benefits from having a custom engine. For comparison, Cities Skylines (Unity) becomes CPU bottlenecked with a large enough population. Making large cities practically unplayable even on the most powerful consumer CPUs. Also, choice of programming language isn’t what makes porting games difficult. It’s the platform specific graphics, input, window management, sound, etc. All of which aren’t handled by switching to one of the languages you mentioned.
- ubercow13 4y agoWhy? It seems like the opposite is true - see the other comment under this post about buying a 13900k just to play Factorio. It seems to me like Factorio is exactly the kind of game that would benefit from a low level language, as it's relatively simple graphically and all the complexity is in the simulation, making it CPU-bound.
- orost 4y agoNo, Factorio is a perfect example of a game that benefits from as much optimization as possible. It's an unlimited-scope game where expanding forever is the natural course of action so any improvement in performance directly translates to improved gameplay experience because it means you can expand for longer before it starts to degrade. In this kind of game, no matter how well it runs, there will be someone who has built enough that they're wishing it would run even better.