Friday Facts #430 - Drowning in Fluids

Posted by raiguard on 2024-09-27

Hello,
Today we once again dive head-first into the world of fluids.


Since last time

Back in June, the very same week that we revealed Fluids 2.0 (FFF-416), we were undergoing an in-office LAN party to test the game. As we played, it became apparent that the new system was a little bit too easy. Our Nauvis base had ridiculously huge pipelines that snaked all over the place with little to no thought or structure behind them. We did use some fluid trains to connect particularly distant outposts, but even this was mostly out of habit; a pipeline would have been superior.

Pipe visualization Our infinite throughput continent spanning pipelines.

These "omni-pipes" created a situation where pumps never increased throughput, they only ever restricted it. This was counter-intuitive, but also meant that you just never used pumps in the network unless it was to disable a specific section with a circuit connection. Additionally, steering people towards using long pipes everywhere turned out to be a huge trap for fluid mixing, as the chances of accidentally connecting two different pipelines increased significantly. If this happened from bots constructing something while you were on a different planet, then good luck finding the single incorrectly placed pipe in such a huge search area.

It was time to search for solutions.


The importance of visual feedback

Transport belts are fun to play with because they are extremely visual and interactive. You can see exactly where items are coming in, where they are going, and where the bottlenecks are, all at a glance. By contrast, pipes are almost entirely opaque, and the tiny windows are not enough to give you sufficient visual feedback. This is part of the reason why we went for a "no-thought-required" solution to fluid flow.

If we are to add a limitation to the fluid system, then that limitation needs to be extremely easy, obvious, and interactive. After butting heads for a while, this is what we came up with.


Pipeline extents

Pipelines are constrained to a 250x250 tile area, and exceeding this limit will cause all flow through the pipeline to cease. You can split a pipeline using a pump. The game displays a visualization to show that the pipe is broken and will generate an alert at the location(s) where you need to place pumps. This makes the problem easy to diagnose and easy to fix.

When holding a fluid-related entity, the game displays connection visualizations on visible pipelines that are tinted to match the fluid inside. You can also visualize an individual pipeline by hovering over it with your mouse, in which case you will also see arrows telling you how large the pipeline is.

Pipe visualization This might look familiar to users of my Pipe Visualizer mod.

As the final cherry on top, you can also enable a toggle to see pipelines on the map!

Pipeline map visualization

When you are building an individual setup, you still don't have to worry that much about pipe throughput - you connect the pipes and it "just works". However, connecting your setups together requires slightly more thought, as now you actually have to worry about directionality and the throughput of your pumping stations. The pump-isolated sections also make it much less of a disaster if you accidentally mix fluids.


Balance tweaks

In addition to the extents, we have made a few tweaks to the balance of the fluid components:

  • Pumps have been nerfed to 1200/s (10x decrease), but this can be increased with quality.
  • Fluid wagons have been buffed to 50,000 (2x increase).
  • 1 Water expands to 10 Steam in boilers and heat exchangers.

With three pumps per wagon that is 3600/s per fluid wagon, or about 14 seconds to fully pump out a wagon's contents. This is much more reasonable than the previous 0.7 seconds you could get in 1.1. This is still plenty fast for vanilla megabases, and in Space Age you can increase pump quality if you need even more throughput to feed your legendary foundries.

The Water to Steam ratio change makes it more possible to supply power or nuclear setups using fluid wagons or even water barrels. The change doesn't affect the power consumption/output of any machines, they just consume 10x less water to make the same amount of Steam.

The extents, combined with these changes, have made the choice between fluid trains and large pipelines much more varied. Omni-pipes are no longer the one true solution to everything - you can still build them, but they require circuits and are far less magical. Will you choose the near-instant transportation of a pipeline, or the enhanced flexibility of a fluid train?


Algorithm tweaks

There have been a few changes to the algorithm since it was first introduced:

  • Output rate used to be unlimited, but it is now inversely proportional to the fullness ratio of the sink.
  • The special exception for storage tank flow has been removed.
  • The input rate limit used to only apply when pulling from a pipeline, but now, it and the new output rate limit are applied to every fluid flow operation, with the exception of fluid wagons.

Something that I failed to adequately explain before is that while there is no limitation on the total flow through a pipeline in a given tick, there is a hardcoded limit of 100 fluid per flow operation (6000/s). This limit is multiplied with the fullness ratios of the source and sink to produce the actual flow value, and this proportionality is what allows machines to share fluid more evenly. Machines that update first will still get the greatest share of fluid, but the difference is much more subtle than it was in 1.1, where the order that you build each pipe entity would greatly affect the flow.

The output rate limit is particularly interesting because it makes the fluids feel much more like fluids again. Before, a pump could just push fluid in at the max 6000/s rate until the pipeline was 100% full, but now it slows down as the pipeline fills. For each pipeline, there is a certain fullness ratio where the output and input rates equalize, and the level of fluid in the pipe oscillates around this point as the machines do their work.

Pipe fullness shown using the debug view.


Never quite done

The pipeline extents system and balance tweaks were in place for the LAN party, and the reception to them was pretty positive! It has been a long, long journey to get here, and there is still so much to do and so much to tell you about. What you see is the system as it will be when 2.0 launches, but I will continue tweaking and iterating on it in the future.

I would also like to take a moment to thank everybody for their exhaustive feedback on the previous post. Rest assured, I read every single comment, even if I don't respond to most of them. Your passion is a huge part of what makes Factorio such a great game.


As always, pressurize your thoughts and pump them into the usual places.