Friday Facts #347 - New hope demo levels
Author: Klonan,
published 4 years ago,
[i][url=https://factorio.com/blog/post/fff-347]Read this post on our website.[/url][/i]
[h1]New hope demo levels (Klonan)[/h1]
A few weeks ago we discussed the changes to the demo and tutorial in the game ([url=https://factorio.com/blog/post/fff-342]FFF-342[/url]). 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 [i]really[/i] 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).
[h3]Level 04 - Science and Automation[/h3]
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 [i]real[/i] automation.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/631381f1bfe70a1662320e45a1a376a6ce33361f.jpg[/img]
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.
[h3]Level 05 - Abandoned rail base[/h3]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/9bd6dc560cc288a325d4ddea56ce6591e45c3c85.jpg[/img]
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.
[h3]Whats new?[/h3]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/ae5164c3258fa78af3fe9872ccb056a42295d473.jpg[/img]
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...
[h1]Replacing terrain in a map (V453000)[/h1]
The original Abandoned rail base level was nice, but it aged with all the changes to terrain generation that happened since.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/26b2f1251cc5613bd6188bb2039882a6b628a544.png[/img]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/2aa160443fdfd1e133b25ad7d673aaeb3b7936fd.png[/img]
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:[list]
[*]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).
[/list]
[img]https://clan.cloudflare.steamstatic.com/images//12002589/7dd752f190317a542cb4224391c378fd47da71b9.png[/img]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/6da4da4913919417fc0791764d25bd6c71dcf831.png[/img]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/f99eff0bf8030bbe9491892cd4737884995e923b.png[/img]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/4156e86ca916a8dbaef8ab7a9bb16f892e582b49.png[/img]
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.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/11962faba5aa044bf5ee9486ccc3bf1f3974adc2.png[/img]
When we have water, it’s finally time to clone in the original entities.
[img]https://clan.cloudflare.steamstatic.com/images//12002589/5a1987e1fc3d18e81973f3cd2ce01502f7a55c95.png[/img]
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. :)
[img]https://clan.cloudflare.steamstatic.com/images//12002589/55144c365ea3357567b1417daef4e8ac3e18f7ad.gif[/img]
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.
[h1]Bots throw cliff explosives (Klonan)[/h1]
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:
https://cdn.factorio.com/assets/img/blog/fff-347-robot-throw.mp4
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.