I spent an insane amount of time optimizing Tight Spot Lv 5. This is the result.

Post pictures and videos of your factories.
If possible, please post also the blueprints/maps of your creations!
For art/design etc. you can go to Fan Art.

Post Reply
Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

I spent an insane amount of time optimizing Tight Spot Lv 5. This is the result.

Post by Kayser »

Inspired by this post: https://www.reddit.com/r/factorio/comme ... hallenges/
I got hooked on the idea of optimizing the design of Tight Spot Level 5 (hard), to see how far I could get. As the post says, it isn't really "hard" per se to clear the level, even on hard difficulty. So, it's more interesting to try and get as high score (coins) as possible.

This is the result:
Score
Base Design
Blueprint:


I intend to cover some design details that I'm proud of in a few upcoming posts. If you’ve never tried Tight Spot, I recommend you try the scenario for yourself to see what score you can get before reading on.

I'm sure some of you can do better, and I’d be interesting to compare designs.

PS.
If you never tried the Tight Spot game mode or just want a reminder, it's about building a base to produce as much as possible of a predefined product on a small map with limited time and resources. This is what the map for the fifth (and currently final) level looks like:
Tight Spot Level 5 map.png
Tight Spot Level 5 map.png (1.38 MiB) Viewed 1847 times
Your goal is to produce as much Blue Science as possible in 15 minutes, and you get 1,500 points/coins for each bottle delivered to the steel chest in the middle:
Tight Spot Level 5 product.png
Tight Spot Level 5 product.png (4.62 KiB) Viewed 1847 times
These are the items available (each costing a different amount of coins to buy):
Tight Spot Level 5 items.png
Tight Spot Level 5 items.png (103.45 KiB) Viewed 1846 times
Last edited by Kayser on Fri Dec 15, 2023 9:01 pm, edited 6 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Optimize Core for Speed

Post by Kayser »

The core, where the blue science (BS) bottles are produced, includes a wooden distribution box that serves as a logistics hub for all ingredients needed. All sulfur, engines, and red circuits are fed into the box, and the BS assemblers take what they need from it. This basic set-up is compact and features a fast and decently balanced distribution of the ingredients to the BS assemblers, with almost no ingredients locked up on belts or in other places. Distribution speed is crucial as all ingredients are scarce and produced just in time.

Inserters are used more than belts throughout the base, mostly for speed. Some inserters need to be fast ones just to produce the last few bottles on time.

Finally, also for speed, all BS are put directly in the drop-off steel chest.
Tight Spot core layout.png
Tight Spot core layout.png (1.11 MiB) Viewed 1634 times
Last edited by Kayser on Tue Dec 12, 2023 10:18 pm, edited 7 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Switch Petroleum to Produce Sulfur Just in Time

Post by Kayser »

Because we are limited by the amount of oil available on the map, we want to control how petroleum is split between sulfur and plastic. Without any control, too much petroleum will go to sulfur, and we'll be left with a lot of wasted sulfur in the end. Unacceptable!
too much sulfur.png
too much sulfur.png (3.04 KiB) Viewed 1766 times
To limit sulfur production, we put a pump on its petroleum input, and enable it as long as the distribution box has no sulfur buffered. As soon as there is one or more sulfur buffered in the distribution box, sulfur production is effectively shut off, and all petroleum used for plastic instead.

Because BS assemblers automatically stock 2 sulfur each, and because sulfur production and distribution is relatively quick, the distribution box will be re-stocked with sulfur before the BS assemblers run out.
petroleum switch pump.png
petroleum switch pump.png (1.03 MiB) Viewed 1766 times
petroleum switch pump setting.png
petroleum switch pump setting.png (55.83 KiB) Viewed 1730 times
The other pumps in the picture are for fine tuning the distribution near the end of the scenario. We'll come back to those.
Last edited by Kayser on Tue Dec 12, 2023 10:08 pm, edited 12 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Take Control of Red Circuit Distribution

Post by Kayser »

With the sulfur production suppressed, plastic and subsequent red circuits (RC) is ultimately limiting BS production. To ensure we use all available RC quickly and efficiently in the end, we must take control of how the RC is fed into the BS assemblers.

Each batch of BS requires 3 RC. Therefore, we want to insert 3 RC into each BS assembler, before moving on to the next, feed it 3, and so on. To accomplish this, we use some boxes, inserters, and two arbitrary tokens (wall and blueprint book) to build a small distribution controller.

The controller works like this: Whenever any BS inserter takes an RC from the distribution box in the core and inserts it into a BS assembler, some of the controller's inserters move the wall between 3 boxes, in a cycle (1). Whenever the wall completes a full revolution, some other inserters move the blueprint book between 3 other boxes in a second cycle (2). The blueprint book's position subsequently determines which BS assembler's inserter is active at any given time. This guarantees that we insert exactly 3 RC into a BS assembler at a time before moving on, thus using all available RC as quickly as possible.

Two inserters need to be fast to ensure the controller is fast enough toward the end of the scenario.

This takes us to 198 BS produced. Not bad, but we can do better.

The controller:
rc distribution controller.png
rc distribution controller.png (871.72 KiB) Viewed 1731 times
The loading of BS assemblers (video):
Tight Spot Ingredient Distribution.mp4
(42.77 MiB) Downloaded 31 times
Last edited by Kayser on Wed Dec 13, 2023 9:47 pm, edited 5 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Count Sulfur Batches, Shut Off Petroleum and Flush the Buffer

Post by Kayser »

Even with the sulfur suppressed and RC distribution controlled as per above, we’re still ending the scenario with the auto-stocked 2 sulfurs in each BS assembler. Unacceptable! We can do better.

We begin by cutting off petroleum at a point where we see that we have enough sulfur for what we have left to produce. Testing reveals that this happens at about 13m45s, after exactly 50 batches or 100 sulfur total have been produced.

To count batches, we use tokens (walls), two boxes, and an inserter. Whenever the long inserter picks a batch of sulfur from the sulfur chemical plant, the batch counter moves one piece of wall between the boxes. When 50 walls have been moved, 50 batches have been produced, we shut off petroleum to sulfur.

Now we come across another problem: Pumps have an internal storage. If we simply put the new “batch limit pump” in sequence with the old JIT switch pump, one of them will buffer petroleum that will eventually go to waste. Unacceptable!

To circumvent the petroleum buffer issue, we put third pump that flushes the buffered petroleum back to the main supply (to be used for plastic). This “buffer flush pump” is activated simultaneous with the batch limit pump. Voila! More plastic.

The total BS production is now 200 BS. Can we do better?
sulfur shut off system.png
sulfur shut off system.png (969.92 KiB) Viewed 1640 times
We’ll return to the fourth pump. It’s disabled for now.
Last edited by Kayser on Fri Dec 15, 2023 9:07 pm, edited 4 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Finale: Re-Start Sulfur, Shortcut Sulfur and Red Circuits

Post by Kayser »

After having limited sulfur to 50 batches, and re-directed petroleum to plastic, we suddenly have enough plastic and subsequent RC for 204 BS, but not enough sulfur. Because plastic + RC takes longer to produce than sulfur, we can re-enable sulfur as soon as we have the necessary plastic production initiated.

To re-enable sulfur production, we put a “bypass pump” beside the batch limit pump and a timer to enable it. The timer is implemented with two boxes, an inserter, and some tokens. We don’t have enough walls to measure time from the beginning of the scenario, but we can use our batch limit counter to start it. So, when 50 batches of sulfur have been counted, we start our “end-game timer”. Testing reveals that the bypass pump should be activated after 37 end-game timer "ticks". At this point, we have fed enough petroleum to plastic to make 204 BS. The scenario time is roughly 14m28s.

Now, it turns out that we can make all the necessary ingredients on time, but we need to shortcut two logistic pathways to make it.

First, we make the right BS assembler (the one closest to the RC) be the one to make the last BS batch (we can control this by choosing the blueprint book’s starting position carefully). Next, we put a “RC shortcut" inserter and use our end-game timer to open a shortcut for RC at the right point in time (about 14m37s). At the same time, we disable the normal RC pathway to ensure only the shortcut is active. The final RC is put in the assembler at about 14m40s (BS assembly takes 19.2s, and the 2 BS still need to be moved to the steel chest)

Second, we also need to shortcut sulfur to the left BS assembler, simply because by the time the final sulfur batch is ready, the RC distribution controller will have switched to loading the rightmost BS assembler. Hence, we put a “sulfur shortcut" normal inserter to snatch exactly one of the two sulfurs in the 51st sulfur batch and put it in the leftmost BS assembler, and let the second sulfur onto the rightmost BS assembler. This shortcut is also activated by the end-game timer.

With a few ticks to go, this is enough to deliver 204 BS, which is the basis of our final score.
Tight Spot finale.png
Tight Spot finale.png (1.9 MiB) Viewed 1575 times

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Remarks on Overall Layout and Power

Post by Kayser »

There are several options in the overall design. The major decisions revolve around what to use the various patches for, where to source the necessary iron, copper, coal, and where to produce intermediates like steel, gears, and pipes. We also need to think about where to put power and the refinery.

Some testing revealed that the overall design doesn’t have much impact on the number of BS that we can produce. Because we’re anyway limited by oil, engines will eventually catch up if we produce enough. So, it boils down to finding the lowest cost. Low cost means:
  • Use as few, cheap, and small components as possible:
    • No red belts, red underground belts, red splitters, filter inserters, electric furnaces, storage tanks, medium or large power poles, or substations (*)
    • Cheapest assemblers, furnaces, and mining drills that still do the job
    • Direct insertion, where possible
    • Underground belts and pipes are often cheaper than buying land
    • Long inserters are cheaper than belt in many configurations
  • Utilize the free space that the coal and ore patches provide
  • Place entities as close to the center as possible (where land is cheaper to buy)
  • Stock furnaces with bought coal if cheaper than mined coal
  • Use blueprint to place red/green wires for free
(*) Some of these entities could potentially have been used to save cost or enable certain designs otherwise not possible (e.g. traversing 5 underground tiles). I just didn't end up using any of them in my final design.

Power
When it comes to power, we must always maintain it full, or else we lose oil. Three boilers provide enough steam on average but cannot handle the peaks. This can be solved with just a seventh steam engine if we connect all boilers to all steam engines with enough pipe, which functions like an energy buffer/accumulator, storing excess steam that is consumed at peaks. Luckily for us, pipes in Factorio function like a perfectly insulated balloon, contracting smoothly to maintain the pressure of the steam, and not allowing it to lose any temperature ;)

Overall layout:
Tight Spot overall layout.png
Tight Spot overall layout.png (1.29 MiB) Viewed 1490 times
Last edited by Kayser on Wed Dec 27, 2023 8:53 am, edited 11 times in total.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Ending Thoughts on the Tight Spot Game Mode

Post by Kayser »

As mentioned in the Aaron's Reddit post, the difficulty is quite off in general. It’s too easy to clear the requirement, even on Hard difficulty. Like mentioned, the coins rewarded for each item is too high, so the cost of the land, the entities, etc. becomes near insignificant. All it takes is to enter the requirement in Factorio Calculator, put down and connect roughly the needed entities.

Aaron recommends reducing the reward for the items, and I back that recommendation. Other potential fixes would naturally be to increase the price of land/entities or increase the required points to clear. If we don’t want to mess with the scenarios that are already there, we could add even harder difficulty levels.

When it comes to red and green wire and vanishing items, it seems the bugs Aaron mentioned have mostly been fixed. There is still an issue that the red/green wire disappear when removed, but it will be resolved in 2.0 when the wires become free.

Aaron’s fourth point about determinism seems still to be an issue. Even with my ambition to control the petrol split in detail, the runs differ slightly when it comes to the petrol splits, which sometimes cause the final few BS to fail. It seems not entirely predictable how a fluid will behave when there are multiple consumers. What I found was that a run would behave the same after loading a save, so I took that as the benchmark. It means that to get an “official” score, I needed to save the game and then load it before running. It’s also somewhat annoying that if a scenario is let run to the very end, you can’t go back and must reload a save to continue editing.

In any case, I loved the game mode and would love to see additional official levels, difficulties, and variations in 2.0. Looking forward to it!

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: I spent an insane amount of time optimizing Tight Spot Lv 5. This is the result.

Post by DaveMcW »

Great job. 204 chemical science packs is clearly the maximum you can get from the available oil.

I think another way to make the scenario more interesting is to multiply oil richness by 4x, so it is no longer a bottleneck.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Re: I spent an insane amount of time optimizing Tight Spot Lv 5. This is the result.

Post by Kayser »

DaveMcW wrote:
Sat Jan 06, 2024 5:33 am
Great job. 204 chemical science packs is clearly the maximum you can get from the available oil.

I think another way to make the scenario more interesting is to multiply oil richness by 4x, so it is no longer a bottleneck.
Yes, or add modules.

Kayser
Long Handed Inserter
Long Handed Inserter
Posts: 95
Joined: Mon Aug 10, 2015 9:43 am
Contact:

Re: I spent an insane amount of time optimizing Tight Spot Lv 5. This is the result.

Post by Kayser »

Minor overhaul, new record:
TightSpot 279310.png
TightSpot 279310.png (15.12 KiB) Viewed 633 times

Post Reply

Return to “Show your Creations”