Question about Factorio inner engine.
Question about Factorio inner engine.
Hi there, my name is Mark, and I am currently working on my own open-source multiplayer Factorio/Rimworld like MMO in C++ (sounds weird, but trust me, it makes much more sense in-game). I read a lot of articles about how most of the engines handle a problem with STL (that is underperforming heavily, especially in MSVC implementation) in a way of re-inventing a wheel and making their own STL containers from ground up. Are you using STL, or you are reimplementing it. And if so, could you explain just a bit what are the benefits of doing that. I would really like to know what you, could tell me about this specific topic, and how did you approach it while working on one of the best optimized games I've seen there
Re: Question about Factorio inner engine.
[Koub] I've moved this to off topic.
Also, I encourage you to read (or at least to have a look to) all the FFF : a significant part of them contain insights on technical aspects.
Also, I encourage you to read (or at least to have a look to) all the FFF : a significant part of them contain insights on technical aspects.
Koub - Please consider English is not my native language.
- BlueTemplar
- Smart Inserter
- Posts: 3234
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Question about Factorio inner engine.
If you're programming for Windows, you're part of the problem.MSVC
BobDiggity (mod-scenario-pack)
Re: Question about Factorio inner engine.
How exactly containers could be bottlenecks? All operations have well known difficulty : O(1), O(logN), O(N). STL containers are simple as stick. They are very poorly designed, but not slow. What exactly do you need? Vector and map. If you are constantly removing elements from a middle of a vector, it's your fault. 99% performance issues are caused by incorrect use of containers, not their inner implementation.
People write their own containers if :
Good luck with your game, brudda!
People write their own containers if :
- They need specific architecture.
- They are students.
- They are stupid.
- For fun.
Good luck with your game, brudda!
- BlueTemplar
- Smart Inserter
- Posts: 3234
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: Question about Factorio inner engine.
We use STL a lot (containers, filesystem, unique_ptr, optional, function ... we don't use algorithms much; we try to avoid variant for compilation speed), but we also have lot of custom containers. Most of them used to be boost containers, but we removed dependency on boost to speed up compilation and reimplemented containers we were using ourselves. Out of those the most important for us is probably IntrusiveList.
If you are starting a new project, you might want to look into existing "STL for games" implementations, for example EASTL.
It is easy to replace a container if it proves to be too slow for whatever reason, but it is really hard to change low level stuff. So I think it is important to figure out what your goals are early on (multithreading? autosaves on background? ...) so you don't design yourself into a corner.
And most important of all is to get stuff going and see progress and results quickly, otherwise you'll probably lose motivation and abandon the project.