4 ms·
Specifically, think of one particular optimisation that most 3D games can make that Factorio can't: don't process stuff you can't see. Factorio is of course con
by rkangel 6y ago
Specifically, think of one particular optimisation that most 3D games can make that Factorio can't: don't process stuff you can't see. Factorio is of course continually running the entire factory, regardless of which bit of it you are looking. I am amazed it is as reliably performant as it is.
- maxfurman 6y agoMost 3D games don't _render_ objects that you can't see. They still must simulate their actions each tick so that they will be in the right place when you can see them.
- rkangel 6y agoThey might if they're just off camera. They don't if they're in the next town.
- Sohcahtoa82 6y agoDepends on the game. I imagine Grand Theft Auto doesn't simulate any cars that are more than slightly farther than the render distance. I've seen videos showing that Cyberpunk 2077 will even not simulate things just because they left your view. People and cars will just disappear after you turn around for a second.
- zerd 6y agoThey often don't, which is annoying to no end. You turn around, turn back, and the car/body that you just saw is now gone.
- gradys 6y agoThat optimization makes the 3D games more complex, not less. What Factorio does is impressive and surely comes with its own challenges, but it isn't necessarily more complex.
- yoz-y 6y agoHaven't played much factorio but I imagine that simulating the factory is more akin to a game of life, wireworld or a graph signal processing. I.e.: in one tick you process all inputs of each entity, and put them to outputs, maybe having a queue on each. This will always scale linearly, and you can also parallelise this quite comfortably. In comparison collision detection and AI need to rely on a lot of trickery (and thus bugs) because naïve approaches explode in complexity.
- ashtonkem 6y agoYes, it’s as simple as moving tick by tick. But there is a lot of stuff. Like everything else, conceptually simple things become difficult at scale.
- falcolas 6y agoFactorio has collision detection and AI as well. Biters. They have to do pathing, collision; all of the usual stuff AI enemies have to do. Plus, each item on a conveyor belt has collision as well - they can tell when they run up against each other and will stop. Inserters can't put items on a full belt, but if there's a space they will sneak the item in (moving items around it if necessary).
- maccard 6y agoHave you written any collision deta code? The difference between collision detection between two boxes in 2d , and two convex hulls in 3d is many orders of magnitude. Compare [0] to [1]. Being 2D makes factorio many many times simpler than an equivalent 3d game. None of that has any bearing on the quality of the game,it's an excellent game, and a great technical product to boot. [0] https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection https://developer.mozilla.org/en-US/docs/Games/Techniques/2D... [1] https://caseymuratori.com/blog_0003 https://caseymuratori.com/blog_0003
- falcolas 6y ago> The difference between collision detection between two boxes in 2d , and two convex hulls in 3d is many orders of magnitude. It's a damned shame nobody's written some kind of amalgamation of libraries, let's call it an engine, so every game developers out there doesn't have to write the same collision code a thousand times. /s It's bugging me away how many folks are confusing pretty 3D graphics with technically complex and efficient simulations (such as piped fluids) on billions of objects.
- mywittyname 6y ago> don't process stuff you can't see. There are absolutely optimizations that can be made to process items that aren't visible on the screen. Everything is deterministic, cyclical and can be represented as a graph. Given the initial number of resource at a node in the graph, and a time duration, you can calculate exactly where each resource will be at any time.
- leetcrew 6y agowhat kinds of optimizations are you thinking of? I don't think the engine can do stuff like defer simulating offscreen events to process them in a batch several ticks later. anything happening anywhere on the explored map could potentially affect things in the player's view. several systems (eg, trains, electricity) need to respond immediately to changes in the global state.