Friday Facts #155 - Settling into fall

Posted by Klonan on 2016-09-09, all posts

Hello,
Bugfixing for 0.14 has been going quite well this week, and while its still in experimental we've been adding some supplementary features before programming work begins properly on 0.15. With the summer ending, things have been settling back into a nice rhythm here in the office.

Improvements to scenarios

We have been playtesting and bugfixing all number of issues that the team challenge has shown us, the aspect of hosting our own server and constantly having people play has really shed some light on those more difficulties, as well as give us a lot thought for tweaks and optimizations.

Some of these changes you might has spotted in the recent change logs, including default team chat, player tags, AFK detection and the latency hiding of god/ghost controllers. A major change we introduced is the sending/saving of the scenarios when you join a server. This means that when you join a server with a custom scenario, you can then play that scenario from the start and host it yourself. We really hope this will generate some greater interest in the development of scenarios. Before it was quite difficult, in that even if you create an amazing scenario, it was often hard for players to actually find and play it.

Production challenge results - Week 1

We have had a lot of fun here at the office playing on the team challenge server. A lot of wasted hours and late nights in some cases. However we were impressed/embarrassed to find that there are a lot of players who simply demolished us in every round. Their playtime has definitely helped us identify a lot of issues, so special thanks to these top 5 players:
  1. EricWong
  2. MotionBlur
  3. AntiElite
  4. xenocyber
  5. NearlyDutch
It's been a really interesting and intense way to play Factorio, and these guys really showed us how high the skill ceiling can be, but surely there are some more players up for the challenge out there. We're going to be continuing our updates and fixes of the scenario, with possible extensions for new challenge types and other fun tasks. Below is an example of the entity spawning we worked on so that slower computers would not freeze for a moment while the round was started:

Its also incredibly interesting to see the different ways the teams build their setups, when given identical starting conditions. With the task items quite variable, along with the amount required, the styles and meta-game we've been seeing in just a single week is really exiting.

If you'd like to join in, simply find "Official Factorio Team Challenge" in the matching server (version 0.14 required) and click join. At the moment teams are random, so hope that you get some good teammates.

Circuit network optimizations for 0.15

Twinsen here again with more boring circuit network stuff. This time I talk bout how the circuit network got a lot faster for 0.15.
The way the circuit network worked before the optimization was something like this:
  • Every connected entity that has signals to send would sent the signals every game tick.
  • All these signals would get summed together based on how they are connected.
  • Finally any entity that reads signals will read from this sum and react accordingly, in every tick,.
This didn't change since it was added in December 2012. And it worked well, until people started making combinator contraptions with 40,000 lamps and 6,000 combinators, slowing down the game significantly.

Because of the way it worked, the circuit network would use almost the same amount of CPU even if nothing was happening(no signals were transmitted), so the first optimization is that, instead of transmitting, summing signals and evaluating circuit conditions every single tick, this is only done once signals are changed. This unfortunately meant that the circuit network code for all the connectable entities had to be partially rewritten, but it lead to UPS increasing 12 times in some circuit network-only saves.

Second thing was a simple optimization of the internal structure. Signals in a circuit network were stored as a std::map<SignalID, int32_t>. I sometimes heard opinions about how C++'s std::map is ridiculously slow and unoptimized, but I never really believed it. In my specific case, boost::container::flat_map not only was significantly faster but it also used less than half the memory. Finally this simple change lead to UPS doubling in some circuit network-only save.

The final result is that the game will be up to 2478% faster and the memory usage up to 10% lower.
For benchmarking, I used a save with a version of Xeteth's Combinator Display(used by Colonelwill's hall of fame). I also used the save used in the "Early Steam Build" video. So special thanks to the creators of those contraptions.

New Pump and HD pipes

A much anticipated feature of the last few Factorio versions has been the idea of a fluid wagon for transporting fluid via railway. Currently the only way of transporting fluids a long distance is through the use of a lot of pipes or by barreling them up, neither of which is incredibly interesting gameplay wise.

However before work can begin on the wagon itself, the small pump had to redesigned, to fit with the developing art style, and to integrate effectively with the gameplay mechanics the wagon will introduce. These past weeks Albert has been working on a new 2x1 pump, which will replace the current 1x1 pump for pipes, which will also be used for filling the fluid wagon at the station.

Also shown to are the HD pipes, which after a long fight with various technical issues, Vaclav has made ready for integration to version 0.15. For those of you running any older or less powerful machines, you won't have to worry about the new high fidelity graphics leaving you unable to update, as the HD sprites will be completely optional.

As always, if you have any comments or otherwise, please let us know on our forums.