Play Factorio in multiplayer on a megabase map. And imagine how much insight you need to keep so many such complex game mechanics to be kept in sync and performant for even hundreds of players on same map.
Compare this to average bug ridden AAA game that has half of game mechanics falling apart in visible ways in single player spawning and despawning stuff randomly in failed hopes of keeping an illusion that the systems are sort of working!
A lot of triple A studios are havening trouble of implementing inventory game mechanics without introducing few item duplication glitches. Guys who are building Factorio are on another level they really made implementing game mechanics their core priority. For triple As their core priority is how to budget for making tons of assets and cramming them into the game.
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.
Most 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.
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.
Haven'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.
Factorio 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).
Have 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.
> 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.
I was using collision detection as an example to show just how stark the difference is. There are plenty of other examples:
- Rendering sprites can be done in software, rendering 3d models requires hardware acceleration (for the most part these days).
- User interaction/controls are much simpler in 2d than 3d. In 2d, inputs are (mostly) mapped to a fixed axis, in 3d, those inputs are relative to your perspective which often changes. This leads to awkward situations like Gimbal Lock, and other issues similar to it that can leave a user confused about what their input is going to do
- Implementing gameplay features is generally simpler in 2d than in 3d. A simple example of firing a weapon is straightforward in 2d, in 3d you have issues like where does the projectile start, (from the camera or the player?), how does that interact with animations/the player model itself? Those issues are practically non-existant in 2d, but can ruin a 3d game.
- Anything that deals with rotations in 2d is an order of magnitude more complicated in 3d.
Taking it farther, factorio isn't a "general purpose" sim, it's constrained to a grid with very little in the way of external forces to be considered continuously. There's no gravity, the player walking on a belt doesn't interrupt production, etc. Factorio (to it's credit) leans into this from a gameplay perspective.
> 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
Factorio isn't using one of those "engines" you speak of. They've been pretty vocal about how they've hand rolled the game and the engine underneath it.
> 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.
Actually, I didn't mention graphics, you did. _You're_ the person who is "confusing pretty 3d graphics". At the most fundamental level, simulating an extra dimension adds 50% more of a cost, but in reality the algorithms change and become orders of magnitude more complicated. Collision detection is a textbook example of this, hence me using it in the parent post.
Factorio is a technically impressive game, there is no doubt about that. But it's likely that if factorio was implemented in 3d it either wouldn't exist, or would be a substantially less polished experience (see Satisfactory for the closest example).
That 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.
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.
what 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.
The only thing physical about Factorio are vehicles and particle effects. That's not where the difficulty comes from. It's more about optimisation: their entity system minimises memory use (and caches misses), many things are special cased for speed…
Think about the sheer scale of a 10 rocket per minute megabase. The amount of inserters, robots, belts, factories, the pollution involved, the number of biters attacking the base constantly… The number of entities on such a base is enormous, yet they still manage to compute it all in real time at 60 ticks per seconds. That feat of engineering is just as impressive as a 3D physics engine — perhaps even a 3D rendering engine.
(Of course, a AAA game is more than just a physics/rendering engine.)
I have to agree with the OP, Factorio code is actually pretty complex. Lots of it comes from polish and creating the seamless player experience. It might not be as technically complex as 3D engine, but no AAA developer would care about optimizing the fluid or belt system to behave in a scalable way. It's really well thought out.
(Also, there is a saying that it takes a genius to do something in a simple way. So even if the resulting code might be simple, arriving to that point can be actually pretty complex endeavor.)
Most 3d action games have extremely few gameplay programmers, they just pick an off the shelf engine and then most of the technical work is optimizing the graphics pipeline.
Ive worked on AAA games for the last 8 years, and I made my own 2d games for 5 years before it. My current project has something in the region of 60-70 gameplay programmers, and has been this scale for the last 3 years. Writing gameplay code and engine code are two very different experiences with different constraints. There is plenty of technical work in writing good gameplay code.
I think it is more complex in most dimensions, except for render pipeline and asset size. Physics engines are off the shelf, even in AAA games, they're not really where the bulk of time is spent coding. Not to mention all the games you described have fixed maps and no multiplayer.
Really, most of the budget of AAA is spent on art and level design. They have sophisticated tech, but often it is not on an unreachable level.
Yes, I think Factorio's engine is more complex and difficult to implement well than a typical AAA game with rich graphics and "realistic" physics.
In Factorio, you have a very large number of active objects with very dense, complex, time-critical and deterministic interactions. In most other games, you have relatively few active entities. The game gives you the illusion of a rich living world, but a lot of the graphical bits floating around can't actually be interacted with. The physics system is a complex bit of math but is fairly isolated from the rest of the engine and has relatively few entities to process. If it gets things "wrong" in minor ways, the player is unlikely to tell.
Also, many AAA game physics and graphics engines work the same enough that engines can even be reused. There's a relatively small amount of bespoke system design. It's just following the same well-tread paths. Factorio's gameplay has enough novelty that the engine has to solve challenging somewhat unique problems.
Source: Senior software engineer at EA for eight years and wrote a best-selling book on software architecture for games.
One metaphor for The Sims I had while developing it was that it was like a pinball machine with lots of balls in play at once -- all the characters, bouncing around off of each other and the objects in the house, which can run autonomously without any user input, but then you can change the simulation's fate with the flippers (pie menus selecting actions overriding the default behavior).
But Factorio is like a pinball machine with MILLIONS of balls in play at the same time, and it perfectly and efficiently tracks each and every one of them.
There is one sad aspect to Factorio: There is only one character: you. Alone. On a planet. All by yourself. Destroying the environment. But once you get over that depressing aspect, it's great fun! ;)
> Yes, I think Factorio's engine is more complex and difficult to implement well than a typical AAA game with rich graphics and "realistic" physics.
I think this is maybe true, but it's not a fair comparison. The real comparison is how much effort would go into making factorio with all of its polish in a 3d world rather than a 2d world.
Factorio's technical impressiveness (?) Comes from how well it's designed and implemented. The limitations that it imposes are part of the reason it runs so well, and also what make it such a great game.
> The physics system is a complex bit of math but is fairly isolated from the rest of the engine and has relatively few entities to process. If it gets things "wrong" in minor ways, the player is unlikely to tell.
The difference between doing the above for physics and graphics is orders of magnitude in how expensive they are, and how complicated they are to implement. You're right that most people don't notice when they go slightly wrong, but they often go catastrophicly wrong. (Much more often in 3d than in 2d). Factorio skirts around this by not running a general purpose physics sim for the game logic, and constraining the problem space (which to me is even more impressive than getting a 3d physics engine right)
Satisfactory is 3D Factorio, by the makers of Goat Simulator.
It's a great game, but quite different than Factorio in many ways, and much simpler along certain dimensions, with less abstraction and meta-programming: no drones, no blueprints, etc.
The fact that Factorio is based on a two-dimensional grid vastly simplifies it and makes it more like a precise programming language or spreadsheet, than a free-form 3d graphics editor. I do love them both, though.
Don't get me wrong: 3D adds a lot of cool stuff, like the ability to make layers and build vertically way up into the sky. And you have much more freedom about where you place objects. But that makes it practically impossible to implement the kind of precise grid-based blueprints and drone construction and logistics system that Factorio has.
To its credit, Satisfactory would be practically unusable if it weren't for the wonderfully easy-to-use well designed construction tools, that make it a snap to route and connect conveyer belts and pipes in 3D. But that's a much messier user interface problem that the precise grid of tightly constrained tiles that Factorio uses. But it does live up to its name: building and connecting 3D conveyor belts and especially pipes is quite satisfying!
Here's a great example of how you can abuse the fantastic degree of freedom that Satisfactory provides -- but that freedom comes at a cost of user interface complexity and the lack of higher level automation and abstraction -- the features that make Factorio such addictive "programmer crack".
I Produced so Much Nuclear Waste the World Is Ruined Forever - Satisfactory
The Satisfactory developers must have been equally horrified and gratified to see how people abused their beautiful game in unintended ways, but they responded by optimizing it a lot so it still runs smoothly. But the scale of Factorio's world is still much larger than Satisfactory, even though it's more constrained.
And another thing about Satisfactory is that the world is hand designed and breathtakingly rich and beautiful, unlike Factorio's procedurally generated world (which has beautiful 2D graphics, but no human touch). But that makes it even more tragic that the goal is to cut down all the trees, peel up all the glowing slugs, and ruin the bucolic countryside with mega-factories belching out pollution and waste.
>Satisfactory is like a 3D version of Factorio, which lets you build huge multi-layer mega factories up into the sky. But it's not as deep and sophisticated as Factorio, and doesn't have drones or blueprints. (That would be a lot more difficult to accomplish in free-form 3D, than with Factorio's 2D tile grid.) It's kind of like the giant simple Legos for younger kids, as opposed to Factorio that's more like Lego Technic.
>Satisfactory is well worth playing if you yearn for a 3D version of Factorio, but I still keep going back to Factorio, which is more like "Dwarf Fortress" in its depth and sophistication. Satisfactory's world is breathtakingly beautiful, lovingly hand-crafted by artists instead of procedurally generated, which makes it all the more satisfying to despoil and ruin with huge mega-factories belching out smoke and radiation.
I've played quite a bit of both. Satisfactory is beautiful to look at, and you can tell it's a labor of love for the developers. But there are so many bugs compared to Factorio, even compared to Factorio early on in development. Part of the problem is that Factorio sets the bar incredibly high in terms of developmental rigor, but if I were to recommend one over the other, Factorio would get the nod from me.
I didn't want to bring satisfactory up myself but I completely agree with everything you've said. You're right that factorio leans into the spreadsheet-esque aspect of the game, and it uses that to it's advantage both from a gameplay and a technical perspective. Making satisfactory a 2d game wouldn't give you the same experience as factorio!
Where Satisfactory really shines is its 3d building tools. It makes building fun and easy and precise, and then you get to jump and climb and ride around on the stuff you built. It's very satisfying. That's hard stuff to get as right as they did.
I found the building controls _slightly_ clunky, (but I don't think I could improve on them hugely). I actually felt what you said in your original post was what really draws me to it; I genuinely felt like I didn't want to ruin the planet!
Most games at that scale begin to simplify individual objects into statistical averages. Factorio can’t do that, so every single object is tracked meticulously on one thread. Even down to the position of the arms on each loader, since where they are in their cycle affects the game overall.
It's easy to deal with a few zombies, since they're very slow and stupid, but as you get more and more of them all over the place, and then huge swarming waves of them, it's insanely challenging!
I love this game, but it's incredibly difficult, even on the easiest setting.
They Are Billions Gameplay - Zombie Defense Post Apocalyptic City Building
Check out the dynamics of how the waves of different kinds of zombies interact:
It unleashes and mixes layers of different kinds of zombies with different abilities and attacks. (@ 43:00)
The lighter ranged spell casting zombies are maintaining a distance, but then holes form in their layer, and phalanxes of darker hand-to-hand melee zombies squirt through and fill in the gap. (@ 45:00)
At 1:18:30 he admits that it's obvious the zombie waves will never end, so he lets them win!
Yeah a point & shoot game where you can choose your own clothing with various 3D rendering goodies that works at good enough FPS is way more complex implementation wise than a factorio clone with its 2D graphics. For gameplay, it's the other way round.
Factorio is a lot like Dwarf Fortress - the graphics are a very small part of the gameplay.
Interacting with the simulation is the majority of the gameplay - and the majority of the simulation is spent on that.
The thing that is interesting about Factorio is it is entirely deterministic (similar to old games that could "record demos" such as Doom or the original Starcraft) - this simplifies some things and complicates others.
Right, but the simulation isn't as complex as simulating rain in a 3D game or whatever.
Nobody is arguing that Factorio doesn't have complexity. But do you really think a one-man team could create Cyberpunk 2077?
A one-man team built Minecraft which includes Redstone, which allows for some amazing complexity. But that doesn't make it more complex (dev time wise) than an AAA FPS.
> Right, but the simulation isn't as complex as simulating rain in a 3D game or whatever
I think a naive implementation of factorio would be reasonably straightforward. But that implementation would have no chance to scale to the size of bases factorio manages. The complexity of factorio’s implementation comes from its simulation’s optimizations, particularly in the face of its hard determinism requirement. (Something most physics engines and rain shaders never need to think about.)
Making a good rain shader takes expertise but probably not a lot of time when you know what you’re doing (months not years). Making a game like factorio probably doesn’t take more specialised expertise than many devs here have, but even with all the requisite knowledge it would still take me years to implement something as feature rich, correct and performant as factorio’s simulator.
The gameplay is complex, but that does not mean the software must be complex. Take for example the ancient game of Go. It's a bunch of very simple rules with some stones, yet it's a highly complex game that could not be beaten with traditional software-solutions.