Hacker News new | past | comments | ask | show | jobs | submit login

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.

[0] https://developer.mozilla.org/en-US/docs/Games/Techniques/2D...

[1] https://caseymuratori.com/blog_0003


> 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).


Yes, 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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: