Friday Facts #388 - Smaller things for 2.0

Posted by kovarex, raiguard, Klonan on 2023-12-08

Hello,
we have shown some bigger things recently, so it is time to also show some smaller things, because the bigger things wouldn't shine that good without the smaller things working properly!


Billions of years' worth of Factorioraiguard

We had always thought that having a normal 32-bit unsigned integer to track the number of ticks passed would be enough for everyone. You have 60 ticks per second, which makes it 2.2 years of continuous playing on a single game save. But Factorio is a game about automation, so it was inevitable that someone would leave their factory running in the background and eventually overflow the tick counter.
This obviously will not do!

In 1.1, boskid had already unified the usage of the tick type to be encapsulated in a class and semi-prepared for a change in the underlying type. This meant that moving to a 64-bit unsigned integer wasn't as painful as you might imagine, and the new theoretical limit on save file time is 9.7 billion years.

This change was relatively straightforward on the game engine side, but it presented some issues with the modding API. Factorio uses Lua 5.2, which has a single number type implemented as a double-precision floating point number (double). As the value in a floating-point number grows larger, the level of detail that the type is able to contain decreases. The maximum integer value that a double can represent with full accuracy is 2^52, or 2.37 million years' worth of ticks.

Newer versions of Lua contain a dedicated integer type that would allow for full precision, but upgrading Factorio's Lua version is not feasible due to numerous modifications and bugfixes we have made to the language internally. This means that Lua scripts can only specify exact tick values up to 2^52, and can specify "maximum possible tick" using math.huge.

More than 2 million years seems to be enough for us to not be around any more when the bug reports start appearing.


Logistic requests enabled tweak related to recovering corpse

We have this feature, that when you respawn after dying, your personal requests are disabled, to avoid being re-supplied with stuff before finding your corpse. But the annoying problem is, which happened to us many times, is that we just forgot to re-enable the requests again after recovering the corpse, and have to figure out what is going on, and why aren't we supplied with our stuff.

Since everything annoying needs to be automated, we of course had to fix it. So now when you recover your corpse, the settings you had before dying are reinstated (unless you changed it in the meantime).


Smart number format

Often times you want to set some constant number, like "I want 7.5 stacks here", and doing the calculation MANUALLY is of course unacceptable. So we made it that you can type mathematical expressions directly in the textfields.

It was basically a 1 line change since we already have the code to parse math expressions to define the infinite technology cost. We just needed to define some constants (k for 1000, M for 1 000 000 and so on) and parse the text when confirmed by the player. This means you can do different kind of things:

  • 10k
  • 10*50k
  • 10+50
  • 10^6
  • etc.


Max range indicator

It is the classic underground belt building micro, that you need to go past the max distance to verify to yourself that you are placing the underground at the optimal place. Counting to 4 is easy, but with higher tier belts bringing in more complicated numbers (6 and 8), it is hard to train the visual intuition about how far they reach.

The solution is so simple and so nice, we wonder how we ever lived without it. When the underground connection is at max distance, we tint it to this reassuring green, letting you know immediately you have reached perfection.

Before: Have to go past the end and take a step back

After: Color of the underground connection changes to indicate max distance


The underground connection turns green when it is at max range


Chart tags improvements

StrangePan spent some time improving the features of the custom chart tags. We now have the ability to quickly drag them around, copy them (by using the pipette keybinding) and put them down even when zoomed in (so you can get that perfect alignment).


Save sorting

Quite an obvious call as well, we now show the 'last time modified' in the load/save game dialog, and have the button to switch sorting between alphabetical and most recent.


Manual lamp colors

It is nice to set the mood in your Factory, or to use a custom color without having to go through the boilerplate of setting up a combinator to set the color.

Naturally it also allows many colors not possible with current circuit network, so we'll see what people do with that :).


Color of robots on the map

It can happen from time to time, that some of your poor personal construction robots get left behind and forgotten. They quickly run out of electricity and their low-energy slow mode is often too little to ever catch you again. Such a sad fate.

This is why we added more colors to the robots map visualisation, the green ones are your personal ones. You can relatively easily find the lost souls this way. There are also other colors for other situations, such a logistic bots delivering to you, construction bots of spiders/other players, etc.


Can you guess which robot colors mean what?


Smarter deconstruction planner + force building

Cliff explosives are not unlocked from the start of the game, and with the expansion they are even more delayed. To avoid nonsensical marking of cliffs for deconstruction when you force build on top of them, we changed it so that the cliffs are only marked for deconstruction once the cliff explosives have been researched.


Cliffs are ignored for deconstruction when you don't have cliffs explosives unlocked.

This also applies to the super force building, whereby it won't try to place landfill unless you have it unlocked.


As always, let us know what you think at the usual places.