Factorissimo2


Factorissimo adds factory buildings to Factorio. Place them down, walk in, build your factories inside!

Content
3 years ago
0.14 - 1.1
222K

g What's the reason for max_surfaces?

7 years ago

Is there any reason why Factorissimo stops placing different factories into different surfaces when the factory count reaches max_surfaces?

7 years ago

Yes. Factorio has a hardcoded limit of 256 surfaces per world, so Factorissimo needs to reuse surfaces at some point if it wants to support an unlimited number of factory buildings.

Factorissimo1 didn't care about that limit and just made a new surface per factory, so when you placed your 256th factory it would just crash. Since the original code was written without me knowing of this 256 surface limit, it depended a lot on the fact that each factory had its own surface, so it was really hard to update it to support having multiple factory buildings on one surface. This was one of the most important reasons for the complete rewrite.

Now you might wonder why the max_surfaces config option is 100 by default, and not, say, 255 or 250 or just 1.

If a player leaves a factory building while his personal construction robots are still busy, then they will not exit with the player, but search for the nearest available roboport or personal roboport on the surface. If no roboport exists on the surface, then they will simply hover in place until the player reenters the factory.

Now suppose all factory buildings were on the same surface. A player abandons his construction bots in one factory building, and then he enters a different factory building. The robots notice that there is now a roboport on the surface, and they will attempt to fly over the void to reach the player. Even disregarding that this totally breaks the immersion, the robots will quickly run out of juice and be lost in the void for a good amount of time, all the while hindering the player because they keep affecting his deployed bot count so he can't deploy new construction bots.

To avoid this issue almost completely, factory building interiors must be spread out over a lot of surfaces instead of all being on the same surface.

Now the max_surfaces value is 100 instead of 255 simply because it's polite and considerate to leave some surfaces for other mods that might want to use their own surfaces too. The most obvious example here is of course Factorissimo1. If the max_surfaces value is 100, then players can upgrade to Factorissimo2 on the same world even after they've already built over 150 Factorissimo1 buildings.

7 years ago

Thanks for the detailed answer. I didn't know that Factorio had the hardcoded limit of 256 surfaces, which was why I wondered why go over the trouble of reusing surfaces.

6 years ago
(updated 6 years ago)

As a Factorissimo2 player who was wondering why the surface number reset to 1 at building #101 I really appreciate finding this detailed explanation (I'm also happy to find this isn't a bug). Thanks MagmaMcFry for an awesome mod which has clearly been well thought out in all the little details! As a software engineer myself I can truly appreciate how much work that is. You rock!

4 years ago

FYI, I think the surface limit is much higher now. https://lua-api.factorio.com/latest/LuaGameScript.html#LuaGameScript.create_surface

Could you avoid the busy construction robot problem by including a roboport in each factory building? Like there is a built-in accumulator. I don't know if it is a good idea or if people would want it or how you would want to do it. I'm more wondering if it would take care of the problem.

New response