Friday Facts #54 - Bug in bug reporting of other bug

Posted by kovarex on 2014-10-03, all posts

Hello,

as you could get from the caption, the work during the week was pretty frustrating at times, but the more rewarding it felt when the problems were finally fixed. This time I decided to give you another peek to our different kind of bug battles.

The hardest bug solved this week

To describe this bug I need to first explain the system. Lets say you need to save the relations (arrows) between the objects as in the diagram. The rocket is aiming the player, the player is mining the resource as well as the mining drill. The working sound watches the mining drill and the mining drill targets the result chest.

To be able to do that, we give a number to every object that is a target of some arrow, then instead of the arrow we just save the number. When the game is reloaded, the numbers can be used to setup the arrows again.

But what if this kind of arrow is used for something like working sound of the entity? It can be problematic, because the working sound is not part of the game state, and two players in multiplayer hear different machines as they are on different locations. This results in different numbers for the object, making the save different -> desynchronisation.

This one took us quite some time to find, because there was error in the desynchronisation reporting code, it removed the player from the map before making the desynchronisation report, so we were inspecting the wrong bug (missing player in one of the games) most of the time. So basically it was a bug in bug reporting of other bug. But once the problem was addressed the fix was very easy, and we are one step closer to reliable multiplayer game, although we can't really know how many steps are still needed to be done :)

Tests are starting to kick-in

We spent part of our working time on writing the unit + integration tests, and it is quite obvious that we should have started with that earlier. There are so many things that are so easy to test automatically. Good example of test that have great ratio of coverage versus work needed to write is test that iterates through all the entities specified in the game. It tries to create every entity, save it, load it, and check if the state of it is exactly preserved. So simple thing and it helped to find 2 bugs we created in the past 2 weeks already. Apart the functionality the tests are able to store the crc checksum values of the key points in test scenarios to a file, so we can run the same tests on different computers to check that the tests run exactly the same on different systems and hardware. It might get very helpful in the future, where we could package the test binary into the standard Factorio installation, so players can test whether Factorio is working correctly on their system.

The work on the content additions

Míra finished the refactoring, that merged most of the game functionality of Furnace and Assembling machine. The problem was, that the only conceptual difference between those two is, that Furnace chooses the recipe automatically, while assembling machine needs the recipe to be set by the user. Apart saving the code duplications, it will increase mod options mainly as it will allow the furnace to have all the functionality of assembling machine, like pipe connections, configurable working visualisations and different inventory sizes.

Kuba started to work on the changes to make the tank possible (In the meantime, when he is not fixing multiplayer code). The simple version of it is working, but there needs to be done a lot of small details. And we also need to figure out, how expensive should it be to make :)

I (kovarex) am supposed to start working on the gates, which includes the implementation of the special code for the merging of wall/gates shadows to avoid strange looking shadow overlaps. But as I'm cooperating on the multiplayer bug hunting mainly the work on it can start later then I expected, but I still believe we can squeeze it to 0.11 :)

This is the work in progress of rework of the flying robot graphics. Looks like a great improvement to me :)

The regular comment thread at our forums is ready.