Recursive Blueprints

by DaveMcW

Automate blueprints to build a self-expanding factory.

Content
1 year, 6 months ago
0.13 - 1.1
30.1K
Blueprints

g Gliding wall of lasers. Race to the Edge with Recursive BPs

6 years ago

Hey guys,

Recently we had a community "Race to the Edge" event organized by JD Plays. The idea was to get to the edge of a ribbon 1000 tiles high world with some extreme modded biter settings. The edge is 1 mil tiles away. This event took us 25 days and 500+ hours for the whole community to get there.

This race was a perfect candidate for recursive blueprints mod. So, I decided to give it a try.

Challenges of the original playthrough:
- kill all biters to reduce the number of active chunks and ups usage
- refueling stations. 3x nuclear fuel in a loco can get it to 500k max
- file size and memory limitations. need to regularly remove all ore and trees from the map
- travel times. every 100k tiles increase the travel time by 20 minutes in each direction. roundtrip to 1mil is about 7 hours long.

Goal of the project:
Automate getting to the edge of the map with recursive blueprints mod.
To deal with the challenges from the above, especially the ups related ones, 2 extra goals were added:
- automate the killing of every single biter on the map
- make it a small gliding front unit that self deconstructs while moving further, leaving only rail track with big power poles behind.

What was done
To kill every single biter artillery was not enough. Arty is doing well when destroying biter bases, but leaves lots of homeless biters behind. It was decided to build a wall of lasers of the map height. And to implement gliding, while building a next section of the wall with 30 tiles offset, remove the rear one.

High level algorithm is following:
1. wait for all the conditions for new iteration, including materials delivery
2. remove rear section of the wall
3. build a front section of the wall
4. repeat 2-4 for N times
5. build a new machine and station closer to the front
6. send the parked train away
7. remove current machine and station

The above algorithm involved switching between different construction and deconstruction orders based on some conditions, which was beyond any implementations that I found in community archives for recursive bps mod.

So I had to build some “Turing machine” algorithmic framework that would let me:
- have some global “memory”. constants and variables
- implement step logic with custom output per step to either send commands to recursive bps mod or modify global variables
- each step has its own advancement conditions (enough materials, less than 100 bots in the air etc.)
- ability to create loops. like iterate steps 2-4 for N times.
- step timer. for time based conditions
- stop/reset button for debugging
When framework was done, implementing the algorithm was a question of time.

The result
After fixing all the bugs (it’s an algorithm, it has bugs) until about 200k tiles, I managed to let it run flawlessly until 560k. Since it’s stable, and since the map gets more memory intensive and ups gets lower, I see no point in pushing further towards the edge.
It took 167 hours to get to 560k, so it will be about 300 hours total to get to 1mil. Out community effort took 500+ hours.

A test save file (https://drive.google.com/file/d/10mywNXJDFcZf4PWDzLnmv1rPyJilrXf_/view?usp=sharing).
To let it start, just turn on the white constant combinator. I’m not sharing the 560k one, since it will not work without custom mods from our community map.

JD was kind enough to record his video review of the attempt. https://youtu.be/s7RWq5fHiDk
I’ve recorded a quick video showcasing how it works. Sorry for my editing skills, it’s my first time with video editing. https://www.youtube.com/watch?v=B4GMNaC_5lY

JD’s community discord: https://discord.gg/xZTdJP. I’m active there.

Reddit post with the discussion around: https://www.reddit.com/r/factorio/comments/9wot7d/gliding_wall_of_lasers_race_to_the_edge_with/

Thanks for reading and let me know if any questions.

5 years ago

pls reupload the test save

5 years ago

Beyond amazing!

I'm planning my own Walking Wall of Death.
My design requirements are a bit different though. The purpose is to take space from the natives for my gigafactory and to place solar fields. And maybe also some temporary miners initially. It's supposed to be pretty much place and forget to quickly go from a mid-tech base to megabase. It is not meant to be a completely self-building factory though, its focus is to be of practical use. I will manually plonk down blueprints for the solar, laser and artillery factory etc. And I don't really have a reason to move my computation circuit, the blueprint deployer or the factory that produced the materials for the walls. It is not meant to go for hundreds of kilotiles, just enough to get enough space and resources for a gigabase.

Also, it's not played on a ribbon world. Since I'm making a square my area increases by the radius squared and so there's a somewhat short radius that is more than enough to give me more energy and space than any other base ever built, so I can stop before that. I can skip trains for quite a while and robomine in one single network until my base is fairly big. Algorithmically setting up a rail network should be easy enough to get working when done in a grid layout though. The mining part of the walking wall of death is just temporary though, it's for feeding the module producing factory that is needed to later build the gigafactory. But I can most likely transport the building materials from the main base to the wall by robot.

Initially, I plan on using the Lua Combinator to control the blueprint deployer. While it's easy to write a pure function that only affects its circuit network output on a local save, Lua Combinator has mod level privileges and so would pretty much never be encountered on an open multiplayer map. So I might do a combinator circuit later. But combinator circuits are quite boring and tedious to create so that's a low priority.

New response