Friday Facts #229 - Taiwan report & Lamp staggering

Posted by Twinsen, Klonan on 2018-02-09

Taipei Game Show 2018 (Twinsen)

After a long 14 hour flight back, Albert, kovarex and I arrived back from Taipei, after our attendance at the Taipei Game Show. Jitka started her vacation by staying there to visit the Taiwan island.
We stayed there for 7 days (2 days in the business area, 3 days in the convention area and 2 days of free time where we visited the city).

In the business area we met many potential business partners and got way too many business cards. We made some friends among the other indie developers and tried all kinds of fun, weird, interesting and some bad indie games.

The convention area was very crowded, with 350,000 visitors slowly trying to make their way through the fairly small convention hall. I can't speak for the others, but I still enjoyed myself. Even though it was crowded, most of the games were in Chinese, and I only got to try one AAA game, there is something about being surrounded by games, gamers, and game developers that makes me feel great.
Our booth was in the indie area. We had many people coming to try the game but also many fans wanting to speak with us and congratulate us for making a great game. AndrewIRL who lived there for a few years, invited us for dinner to "the best restaurant in the city", and we were not disappointed.

Factorio is not an easy game to demo, since it takes at least 30 minutes to kind of understand what the game is about. But having the trailers looping on the screen, and having subtitles for the gameplay trailer meant that the people got a fair idea about what the game is about and how complex it is. While not the best, we had people start by playing the campaign. Most of them were leaving after the first level but some of them were also getting addicted and playing for multiple hours. We gave free Steam keys to some of the people who were more engaged with the game. It was a learning experience to see people play the game for the first time and to see the most common problems with the campaign, the interaction, the UI and the Traditional Chinese translation.

The days were super exhausting though, many of us collapsing at the accommodation and sleeping for 10 hours. Luckily we had 2 more days to relax and enjoy the city before flying back. We mostly split up and each of us visited what they were most interested in, with me going through the electronics markets and riding a rented bike through the rainy streets.

To give credit where credit is due, I'd like to thank the game show for inviting us and sponsoring our booths, and Razer for conveniently lending us the laptops we used to demo the game.
Financially there is no point in us going to a game show, our attendance did not bring us any extra sales in Asia, as expected. The point of going there, for us, is to visit the show floor, play and see random games, make gamer friends, meet fellow developers, meet big fans of the game and maybe make some business partners.
Since many of you mentioned PAX and some of us are interested in going there, we are trying to see if we can attend PAX East this year (April 5-8th). So you might have another opportunity to come and take selfies with some of the Factorio devs.


From left to right: Jitka, Albert, Twinsen, kovarex.

Lamp staggering returns (Klonan)

It was always a nice aesthetic touch, and we have had it for a long while, but during the most recent 0.16 one small feature has been absent. That is of course, the lamp staggering: During the day/night transition, lamps will turn on and off and different times. For example, this is how it looked it 0.15:

During the development of 0.16, there was a move by kovarex to optimize the lamps. By all means the optimization was a success, but along the way the lamp staggering was removed. This didn't go unnoticed, but a proper solution was quite tough. A simple way we tried (even in the first 0.16 release) was to just visually turn the lamps on at different times. It looked the part, but unfortunately was technically incorrect, as the lamps would look 'on', but not actually consume any electric power until the required darkness at which point they all started consuming power.

Due to its incorrectness, this visuals-only solution was reverted, so for most of 0.16 this is what it looks like:

It is also obvious in this GIF, that they turn on way too late, it is already very dark before they turn on.

So anyway, there is a problem here, in that we want the lamps to turn on 'correctly', but it needs to not basically undo all the optimization. To give a brief summary of the optimization, the lamps no longer have to update themselves, the electric network just knows how many lamps there are. When it gets dark enough, the electric network knows that all the lamps will turn on, so just multiplies the consumption of the lamp by how many there are. This is similar to the solar panel and accumulator optimization. To work correctly, the rendering of the lamp, and the electric network update, have to know exactly when a lamp will be turned on, without being able to share any information with each other.

So first we define two values, how dark is it when they start turning on, and how dark it is when they should all be turned on. This gives us a darkness interval where the staggering will take place. Then when a lamp is built, we assign it a specific time in this interval at which it will turn on, and then also keep that value in a list in the electric network. This way, the lamp will visually turn on, at the same time as the electric network will know an additional lamp is consuming electricity. The result unsurprisingly, looks similar to how it was before, and the lamps don't turn on too late:

A side benefit, now each lamp prototype can define its own intervals, so it's easy to adjust for the intrepid modders out there. The other problem was also cleanly resolved alongside the staggering, so now the lamps turn on at a reasonable time once again. You can look forward this minor change with 0.16.23, which will be released on Monday.

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