Devlog 006 - Fluids
Author: tobspr Games,
published 1 year ago,
Hey everyone!
Today I wanted to give you some insights about the fluids in Shapez 2!
As always, be sure to wishlist & follow Shapez 2 to get a notification on important updates:
https://store.steampowered.com/app/2162800/shapez_2/
Alright, so let's dive into the devlog!
[h2]Devlog 006 - Fluids & Painting[/h2]
[h3]Recap - Shapez 1[/h3]
Shapez 1 didn't have fluids, and colors were simply items that you could mine, just like shapes. The painter would then take those items as an input and modify the shape color:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/36c5a79c026c706f910a9f6b0126496bad96b70a.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/36c5a79c026c706f910a9f6b0126496bad96b70a.png[/img][/url]
This worked, but for Shapez 2 we wanted something more interesting and also more "visual" and easy to understand. This is why we are introducing fluids:
[h3]Fluid Extraction[/h3]
The first step to acquire fluids is to find a fluid resource on the infinite map. In the area close to the HUB you will be able to find the 3 primary colors: red, green and blue. Farther apart, we can imagine that there will also be secondary colors, but that's not settled on yet.
[url=https://clan.cloudflare.steamstatic.com/images//43169810/1c39e7b806fbd2d374cb172f55bb5318b0c57797.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/1c39e7b806fbd2d374cb172f55bb5318b0c57797.png[/img][/url]
We still haven't figured how those fluid resources should look, so they are still placeholders in the game.
Daniel already made some concepts for them, but all of these are super early!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/a04e3f0361a6f4ed8fa1de37d926cdaade1ee55f.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/a04e3f0361a6f4ed8fa1de37d926cdaade1ee55f.png[/img][/url]
Once you found a resource to mine, you can place a fluid extractor island on it. Again, this is only a placeholder:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/7c2bd68739c3819c8c79718a6910317ffdd6777c.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/7c2bd68739c3819c8c79718a6910317ffdd6777c.png[/img][/url]
There is already a concept for it as well, but again, very early!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/9fbcda0ce5c25c98449429aa1d18f3b337b4dd8d.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/9fbcda0ce5c25c98449429aa1d18f3b337b4dd8d.png[/img][/url]
On the miner itself, there will be a fluid patch, similar to the shape miner, where you can place pumps to extract fluids. Pumps currently extract 1200 Liters per minute, but this is not final. Currently the unit used to measure fluid volume is liters, although we could imagine introducing additional units in case we ever want to add steam for example.
[url=https://clan.cloudflare.steamstatic.com/images//43169810/b55cafbabcbbcf7d2a07395c531c7eeae7293180.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/b55cafbabcbbcf7d2a07395c531c7eeae7293180.png[/img][/url]
[h3]Fluid Transport & Simulation[/h3]
To transport fluids on the island, you can then place different types of pipes. There are straight, corner, junction and cross pipes. As everything in the game is open, we wanted the pipes to also be open so you can see the fluids actually flow through your factory!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/cd8cba0ecb4308585287e2679da778cc1620d991.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/cd8cba0ecb4308585287e2679da778cc1620d991.gif[/img][/url]
Fluids are simulated at a fixed tickrate right now. Basically every pipe has a "storage" called "FluidContainer" internally. The size of that storage is 50 L for pipes currently.
Every container then stores the current flow to the adjacent containers.
When updating the simulation, it basically goes like this:
[b]1. Iterate over all containers and "spread" fluids.[/b]
Every container can only store one fluid at a time, so once it is "tagged" with that fluid, it can only store that fluid until it is entirely empty again. More about that in the "Mixed Pipes" section.
[b]2. Compute & propagate pressure differences[/b]
Pressure in a container is simply computed as value / maxValue. The simulation then tries to achieve a state of "balance" where all containers the system have the same pressure.
However, just trying to average the container levels won't work great, because then the throughput will be extremely low at some point.
Thus, instead of storing only the pressure, we also store a flow rate, which is determining how much fluid from one container flows to another container in one tick. The flow rate only changes very slowly, and increases / decreases based on the pressure difference.
There are still some issues that a lot of fluids simulations typically have, for example dealing with waves. But we already have a few ideas how to tackle them!
[b]3. Clamping & clearing[/b]
In the last step, all containers that are empty are now un-tagged, so they can receive a different type of fluid again. Also in case any container did over- or underflow, it will be clamped.
While the fluid simulation can be a little technical, our goals is and was that if you just want to use fluids, it should be intuitive and "just work". With the current system in place and the visual indicators, we feel that already is the case, but we are very interested in your feedback!
[h3]Mixed Pipes[/h3]
Since mixed fluids in the same pipe wouldn't really make sense, we don't allow them. Instead, every fluid container can only store one fluid and is tagged with that. Transfer between containers then only works if they have the same fluid:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/7d40aa20270c6b76e6a364fb3ccfa177765d2e41.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/7d40aa20270c6b76e6a364fb3ccfa177765d2e41.gif[/img][/url]
There are also buttons to flush pipes or the entire network, in case you mess up.
[h3]Secondary & Tertiary colors[/h3]
In order to produce secondary and/or tertiary colors, you can mix colors with the color mixer:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/3e661e77cbe6846fd325a5ed15aa47ed56ec644f.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/3e661e77cbe6846fd325a5ed15aa47ed56ec644f.gif[/img][/url]
[h3]Cross-Layer Transport[/h3]
Fluids can be transported up and down, however, in order to transport them up you will have to place a pump:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/bf95d5dee878ef5b9815392a09c7c6b815fa2eb2.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/bf95d5dee878ef5b9815392a09c7c6b815fa2eb2.png[/img][/url]
The pump will limit the flow to one direction, so you can also use it as a gate to prevent backflow:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/03e94c3ce546cd7b1324b30e5551b19dcfadf2ee.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/03e94c3ce546cd7b1324b30e5551b19dcfadf2ee.png[/img][/url]
We are also considering to add a building just for that, in case it becomes a commonly used pattern.
Instead of going for an overly complex system, the rules for cross-layer transport are very simple: Fluids only go up in a pump, and they go down in regular pipes. This should be very intuitive and still allow for some interesting designs. However since it's not final - let us know what you think!
[h3]Buffering[/h3]
In case you want to store some fluids, there is also a fluid tank, and because of the cross-layer pipes, you can also stack them on top of each other:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/3baf153ed54ecc455d8b1c39c82af1296992dd7f.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/3baf153ed54ecc455d8b1c39c82af1296992dd7f.png[/img][/url]
Keep in mind that, because the simulation effectively averages the pressure, the tanks will only fill once you have a surplus of fluid in the system.
[h3]Painting[/h3]
There will be different types of painters in the game, for now we have planned a topmost painter and a full painter. The topmost painter only paints the highest layer of a shape where as the full painter paints the whole shape (and needs more paint in exchange).
Here's an early concept of the topmost painter in action (the animation is currently broken):
[url=https://clan.cloudflare.steamstatic.com/images//43169810/dc8b0aa7ee702837c5d9dbb68dc91241c5b36505.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/dc8b0aa7ee702837c5d9dbb68dc91241c5b36505.gif[/img][/url]
As you might have seen, there are multiple inputs - and again, due to the multi-dimensionality of the game, you can build some pretty cool & compact setups!
[url=https://clan.cloudflare.steamstatic.com/images//43169810/3926261e9a1dc8149d2a17870772fd5f45ea242d.png][img]https://clan.cloudflare.steamstatic.com/images//43169810/3926261e9a1dc8149d2a17870772fd5f45ea242d.png[/img][/url]
[h3]Fluid Packing & Cross-island transport[/h3]
If you read the past devlogs, you might wonder how you actually transport fluids between islands, since there is no building space for pipes in between.
[b]Disclaimer[/b]: The following mechanics are work in progress and we don't know whether they will end up exactly like this in the game. However, let me explain what we have right now!
To transport fluids, first you have to produce barrels. Barrels are produced from shapes, and the size & color of the barrel depends on the used shape:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/1a5a522e8fdda51750b54562f20fd9c7ca41d516.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/1a5a522e8fdda51750b54562f20fd9c7ca41d516.gif[/img][/url]
Once you produced the barrels, you can now fill them using the fluid packer:
[url=https://clan.cloudflare.steamstatic.com/images//43169810/3cfe2728bfbb84257aaa7dc50583fe61782acb7d.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/3cfe2728bfbb84257aaa7dc50583fe61782acb7d.gif[/img][/url]
Then transport them between islands and unpack them again.
[url=https://clan.cloudflare.steamstatic.com/images//43169810/5818031ad8896fc8a1b53fdabeaa52b15b8cd269.gif][img]https://clan.cloudflare.steamstatic.com/images//43169810/5818031ad8896fc8a1b53fdabeaa52b15b8cd269.gif[/img][/url]
Since barrel production is pretty slow, you can also recycle the production by returning the empty barrels again (as seen in the above gif)
We are not 100% certain this feature will be a great fit, so be sure to leave your feedback on it, so we know whether you like it or not!
[h3]Color Blind Support[/h3]
As soon as colors are a crucial part of the gameplay, we have to think about color-blind support as well.
We are still looking for good ways to make it easier in case you are affected, such as patterns, or different symbols for fluids. If you have any ideas please let us know!
[h3]Wishlist Shapez 2[/h3]
I hope you enjoyed the devlog, and I wish you a nice remaining weekend!
And as always, be sure to wishlist & follow Shapez 2 to get a notification on important updates:
https://store.steampowered.com/app/2162800/shapez_2/
~Tobias