Friday Facts #84 - The wedding day preparations

Posted by kovarex on 2015-05-01

Hello fellow builders,

There is this commotion about the paid mods on Steam. (It had been cancelled already). I understand that the implementation was far from optimal, as people would be suddenly expected to pay for mods that were free until now. It was also sad, that the modders were to get only 25% percent of the money. But I personally think, that there is nothing wrong about the idea generally. If a reasonable price tag on a great mod allows the creator to develop the mod full time, create professional content, and people are willing to pay for it, everyone wins.

Free mods would still exist so it would be up to the players to choose. I'm NOT saying we are going to allow paid mods for Factorio anytime soon. But I'm not denying this possibility in the far future.


0.12 is our wedding day

Albert is the one who said this sentence for the first time. Now it is starting to define the mood in the office. As 0.12 means applying to steam, it needs to be as good as possible. It pushes us forward to do as much improvements and polishing as we can, because we can't let our wedding day to be ruined. We started to uncover all the small buried things we just postponed, but we have to finish them now. This means that the amount of changes in 0.12 is starting to look scary big, but with all the team reinforcements it seems like we could still deliver in reasonable time, which is important, because no one should miss his own wedding day. :)


The optimisations II (Technical)

The first info about the optimisations done were given 2 weeks ago. I went kind of crazy and continued working on the improvements, and here are the main things that have been done:

Smoke simulation optimisation

The smoke simulation optimisation is based on simple but very effective idea, let me explain how the smoke movement works:

The smoke particle is moved every tick (60 times per second). The movement is based on it's movement vector (a). The speed of the smoke is slowed down every tick, by multiplying the speed by a modifier (q = 0.995).

If I wanted to calculate what is the position of the smoke in n ticks in the future, the movement in the first tick is a (movement vector), in the 2nd tick, it is a + a*q (movement multiplied by the slowdown), in the 3rd tick it is a + a*q + (a*q)*q and so on:

And just a common high school knowledge gives you this formula:

Usage of the formula lets me know the position of the smoke without the need to update it every tick. The wind and animation movements had to be taken into consideration as well, but these can be calculated easily as well. So in the current 0.12 version, the smoke position is updated only once per 120 ticks (2 seconds), but when you look at the movement, it still looks as smooth before, as the rendered position is calculated using the formula as well. This helped the performance a lot, as trains, boilers, generators furnaces are all emitting the smoke.

Optimisations of the electric network

The solar panels and accumulators are now merged in the electric network, so they don't have to be simulated individually. The electric network distribution calculations are also heavily simplified by this. That basically means, that the amount of solar/accumulators have no effect on the speed of the factory update times any more.

Optimisation of the enemies

Huge factories that emit great amount of pollution are attracting a lot of large groups of enemies. The player often doesn't even know about it in this phase, as they just get killed by the automated defences. But the simulation of these units can be also quite performance heavy.

The optimisations we made here is quite pragmatic. We added 4th level of biters and spitters (Behemoth biter/ Behemoth spitter) that are extra strong. So instead of group of 20 big biters, 3 behemoths can be sent. The power of the attack is similar, but the computation required is greatly reduced.

Conclusion

The optimisation phase of 0.12 is finished for now. The results are that the update times of the factories we use are 3 times lower compared to 0.11. This means that people can theoretically build 3 times bigger factories before it starts to slow down. But keep in mind, that your factories might have different layouts, so it can vary greatly.


The combat robots

We previewed the new combat robots graphics a long time ago. They didn't make it to 0.11, but we didn't forget about these, and they will definitely get to 0.12. The reason of the delay is, that we did want the attack graphics to be really an improvement. One of the attacks is a continuous electric beam. To make it look good, we decided to make it as a tileable beam animation. It will give us a lot of freedom if we want to use on other places in the game.


As usual, let us know what you think at our forums.