Friday Facts #297 - New resource icons

Posted by Twinsen, v453000 on 2019-05-31, all posts

Inserters are now smarter Twinsen

A few days ago I was investigating a rather minor bug report related to "Rotational Asymmetry in Belt/Inserter interactions" (aka Inserter was not behaving identically when rotated). This was a classic case of floating point equality comparison.

The Inserter would move it's arm and then it would pick up the item if the current arm orientation is equal to the desired arm orientation. Because of some chain of calculations related to rotation, some precision was lost and the equality check would fail for 1 tick, delaying the item pickup for 1 tick in some Inserter rotations. So I fixed that by finishing the inserter movement if it's close enough. Now the inserters should be a tiny bit faster in some rotations, plus all rotations should again be symmetrical and identical.

While analyzing the code and Inserter behavior for that bug, I also noticed that inserters with stack bonus would do nothing for 1 tick after picking up an item from a belt. I changed it so inserters will start moving to a new target immediately after they pick up something. This also sped up the Stack Inserter by a tiny bit.

Both the speedups were enough to fix another bug that was often regarded by the other devs as "not a bug": A Stack Inserter was not fast enough to pick up all the items placed on a belt by another Stack Inserter. Furthermore, because of different timings, the amount of items a Stack Inserter would pick up would depend on how far that Stack Inserter was from the item source:

We released the change on Thursday. Something strange was quickly discovered after release...


From Nefrums speedrun stream.

As someone from Twitch chat noted "Inserters are so fast now, they even don't care about the side of belt". Remember that I fixed the rotation problem by finishing the Inserter movement if it's close enough. Well, what ended up happening was what now the Inserter would stop 0.0001 degrees short of perfectly vertical. That was of course closer to the other belt lane so the item would be dropped there. Previously it was always dropped perfectly vertical, and the lane decision algorithm would choose the right lane. The fix was easy and it's probably released by the time you are reading this.

So with everything fixed, inserters are now more consistent, predictable and intuitive, things that I think are important for a precise game like Factorio. Some situation might end up being slightly slower or will consume a bit more electricity, but generally inserters are now faster.

New resource icons v453000

In FFF-179 we presented new resource graphics for Factorio 0.15. When the resource graphics were finished, we tried to cut pieces from them and compose these into new item icons - but the results were not better than what we already had and we needed to do many more things for 0.15, so we kept the resource icons as they were for the time being.

Recently we have started work on higher resolution for icons, and the resource icons are one of the first families to get a revisit.

As mentioned in FFF-179, to save time when creating the resource graphics we used various randomization methods to get a new batch of re-randomized resource pieces easily. This method has one big drawback for icons - it’s very hard to preview and control in Blender.

However the random generation allows us to generate many random pieces of resources very quickly...

...and combine them in Photoshop into icons with perfect control over every pixel.

However when we put these icons in the game, on belts they seem to suffer a lot from repetitiveness just like the older versions did.

There was one more thing regarding resource icons that we tried to do for 0.15 but did not have enough time for - resources would get randomized variations of icons when drawn on belts.

Rendering more variations and assembling new icons was relatively easy at this point, so we made some more versions.

With randomized variations the resources look much more natural and unrefined, which makes a lot of sense as The Factory has not processed them into perfect uniform products yet.

The new icons are not ready just yet, but we hope to have them for the 0.17 stable.

As always, lets us know what you think on our forum.