Friday Facts #217 - Just another Friday Facts

Posted by Twinsen & Rseding91 on 2017-11-17, all posts

Hello, most of the team is out of the office today attending the Game Developers Session here in Prague, if you're around you can look out for some people wearing Factorio t-shirts.

As we were thinking about what to write in this Friday Facts, kovarex suggested "In the next Friday Facts we should write about how hard it is to write Friday Facts". Sometimes it is really difficult to find something interesting to write about. Thankfully we found some short things that that we thought you would like.

Passenger seat for vehicles (Rseding91)

Just a minor multiplayer feature.

Resource generation and game balance (Twinsen)

I wanted to have a look at how we generate resources and try to balance and improve it so it's a bit more fun. When playing the game, I noticed that I always need more iron than copper and I also felt that there is more copper than iron on the map, so I first wanted to look at that.

When we balance out any part of the game it's usually something like "that seems a bit low, let's increase it by 0.2-ish and see how it goes". While this worked surprisingly well so far, I like to take a more scientific approach and look at hard numbers when possible.

First I looked at resource requirements. In order to complete all non-infinite research you need:

  • 60,445 Science pack 1
  • 59,885 Science pack 2
  • 48,600 Science pack 3
  • 20,800 Production science pack
  • 27,925 High-tech science pack
  • 32,445 Military science pack
To make all this you need:
  • 3.5 million copper and 5.2 million iron. Ratio: 0.67 (in normal mode)
  • 10.4million copper and 10.9 million iron. Ratio: 0.95 (in expensive recipes mode)
I would say it's safe to assume that these are close to the number of resources needed to finish the game. Since you wont research everything, which will compensate for the cost of infrastructure and combat.
Here I see that there is a different ratio of copper to iron, and the ratio is different in expensive mode.

Now going to the map generation, I generated some 2048x2048 maps and calculated the total number of resources on them. For some reason there was always more copper. This seemed very strange since the map generation settings had the same values for both copper and iron. It turns out that some resources are always on top of others. Coal was on top of copper that was on top of iron that was on top of stone that was on top of uranium (alphabetical order). This meant that there will be more copper on average. To be precise, the maps had 1.5 billion copper and 1.3 billion iron. That's a ratio of 1.15 caused by overlapping. I changed the order of resources around a bit so Iron is on top.

To balance all this out, the plan is to change some some recipes in expensive mode, so that the required copper to iron ratio is roughly the same in normal and expensive mode. Then the map generator settings will be tweaked so it also reflects that ratio (of course while keeping in mind the difference caused by overlapping resources).

Now some might argue that what's the point of all this. Making things balanced does not mean more fun, for example making the player and the tank overpowered and unbalanced in combat made them way more fun. But for resources I believe it's more fun to find value in almost every resource patch you find as you explore, instead of "oh, another copper patch, how useless", especially if the player assigns the same value to it and has some expectation that they are balanced. Balancing all this is not a big deal, but it's just a subtle attention to detail that might make the game 1% more fun, and polishing all these little things will happen more and more as we approach 1.0.

While I'm looking at the resource generation, there are more things that I plan to improve. For example:

  • Tweaking the resource density (average number of resources per tile).
  • Making resources much more spread apart.
  • Reworking how the starting area works so that it always contains a predictable amount of resources. This means that every new map is feasible.
  • Making sure the starting area is not covered by trees.

More optimizations (Rseding91)

When we talk about game performance improvements it's almost always focused on the entity-update time as that is primarily what determines how fast the game can run. There is however one other important part and that's the "prepare" step that collects minimal information about the game to be rendered on screen. This step happens between the game being updated and the results being rendered on the screen which means the game has to be paused while it's run.

We haven't looked into improving this part of the game for quite some time because it runs in multiple threads and was always been "somewhat quick". Recently I decided to spend some time trying to improve it and found several easy optimizations. The end result being the prepare step now runs roughly 50% faster than it did before, leaving more time for the game logic and entity updates.

Lua API additions (Rseding91)

With every major update we keep improving the Lua mod API and 0.16 is no exception; between the larger tasks and bug fixing I've been working on requested Lua API additions. For those interested I've been keeping a public gist of the 0.16 changes and additions here.

I'm always reading the forums for new requests or changes to the API, so If you can make a valid argument for some new API feature (and provided it doesn't negatively impact the game performance when not used), please let us know on the Modding interface requests forum.

Let us know what you think by commenting in our usual topic at the forums.