Friday Facts #347 - New hope demo levels

Posted by Klonan, V453000 on 2020-05-15

New hope demo levels Klonan

A few weeks ago we discussed the changes to the demo and tutorial in the game (FFF-342). One piece of feedback we received after publishing the news was about the old 'New hope' campaign levels, and specifically the 'Abandoned rail base/Broken rail map'.

It seems a lot of you in the community really really enjoyed the new hope campaign levels, and several of the team here share the same feelings. After we scrapped the plans for a new campaign and reverted to the old demo, we had initially dismissed the idea to revive the New hope campaign...

However due to popular demand... we have decided to bring back the favourites, the first 2 levels of the new hope campaign. This time though, they will also be included in the demo version of the game. This represents a very significant increase in scope for the demo, increasing the demo content to include research, red science, green science, trains, and much more.

These levels should be ready for release within a week (but no promises).

Level 04 - Science and Automation

This mission is a continuation of demo mission 03 where you build radars to scan the surrounding areas. You start with a small factory already operational. The radar detects a distress beacon and you must build a car to get there in time before the signal dissipates. This level introduces the labs and science packs, as well as providing the first taste of real automation.

At the end of the level, you pack your supplies in the car, and drive off to locate the distress beacon, before it fades out for good.

Level 05 - Abandoned rail base

This level starts with you pulling up to the base, however you arrived too late and the base is already destroyed. Your goal is to re-establish the science production and rebuild the rail network.

After rebuilding the railway and the mining outposts, you must produce a large number of materials to finish the level. At the end of the level, there is a notice that this is the end, and we would recommend playing Freeplay next.

Whats new?

The main work over the last weeks has been bringing the ancient maps up to date with modern Factorio. For instance now that we have more specific remnants, the ruined bases really look much nicer.

Also we have made a big effort to update the tile and map generation to make use of the new terrains, cliifs, and decoratives, most effectively...

Replacing terrain in a map V453000

The original Abandoned rail base level was nice, but it aged with all the changes to terrain generation that happened since.

Click to view full resolution

The goal is to recreate the gameplay of the original level, but replace the terrain with modern one, including decoratives and cliffs.

The most gameplay-defining elements are entities and water on the map. Cliffs would be as well, but those didn’t exist when this level was introduced.

Tiles and decoratives we’ll just replace, and trees we’re going to try to get close enough. Of course, a lot of things like pollution absorption numbers have changed since the level was introduced so it won’t be absolutely the same regardless.

Click to view full resolution

The first step I took was finding the random map seed that I want to use for the level. I do this by generating a random map in Freeplay, and I run a take_screenshot command, with two requirements:

  • The name of the output image is the seed of the map so I can reproduce the image just by reading the image name.
  • The resolution to 1 pixel = 1 tile so I can easily align it in Photoshop and read the coordinates (even though Photoshop uses a different coordinate system, at least staying in the same units helps).

Click to view full resolution

I take the same resolution screenshots from the original mission with and without tiles, and put the random seed images on top.

Having the visual preview with being able to move the image allows me to find the desired seed and offset quite quickly and position it really precisely.

Now of course we can’t just paste the entities from the original level to this random surface as there are some conflicting areas, like the huge lake in the middle of the map.

Click to view full resolution

So we have to remove unwanted lakes and resource patches.This is done by generating multiple maps with the same seed, but one without water (starting area only) and resources, and transferring areas between them.

Next up we can add water from the original level.

Click to view full resolution

This step is quite special, in the original mission I replaced water by concrete, and created a blueprint from it. There’s better ways I could have done this, but for some reason I didn’t want to deal with offsets in this piece of script, and I’ve already used this method in some other place earlier so this solution came to my mind first.

Click to view full resolution

Another script replaces all the concrete with real water. The bigger issue is that the original level had water all the way to the edge of the map (you can for example see the sharp edge on the right) and the water generation changed as well so manual edits are in order.

Click to view full resolution

When we have water, it’s finally time to clone in the original entities.

Click to view full resolution

To avoid conflicts, I use the clone_area tool which also removes entities in the destination surface. I’ve been able to go through this whole process in a single working day thanks to all the map editor features Rseding added and Lua commands we’ve created when working on the now cancelled campaign. Tools, experience and knowledge are hard to cancel. :)

And then we draw the rest of the owl. Fix places where the automated cloning hasn’t been good enough, add more ruins to be explored, tweak the gameplay and we will have a finished scenario.

Bots throw cliff explosives Klonan

Recently we made some improvements to the cliff explosive effects. However one thing we missed was that the bots needed to be updated separately, due to them using different logic to create the explosion. While it was an easy fix (copy paste some Lua definitions), it feels like it is treating the symptom rather than treating the cause. It isn't good to have the same thing defined in two separate places.

So never one to pass up a nice opportunity to have some fun, Rseding changed the way the 'Blow up cliff' job works, so it will always use the correct effect:

Now instead of the robot hovering over the cliff, it will throw the same cliff explosive projectile as the player would. Not only this fixed the issue for good, but it looks a lot cooler.