As you may have noticed there was no log last week. This was because it was international talk like a pirate day and I was off being minorly injured on a sailboat (these two events are entirely unrelated). So this week I have a Megalog for you all about one of my favorite areas, fluids.
When I first started planning out what I wanted the features for version 0.4 to be fluids didn’t even make it onto the list. There were many other things I wanted instead, but as I started making those features, I realized that I needed to sure up fluids before I could go any further on all the other things. Using the lessons (and code) from the rotation system, I set out to make a fluid system.
When I first started making Engineer Alpha a couple years ago, I conceptualized and started implementing a system for fluids. This original system was complicated, unintuitive and very messy. It was a system that I could not make sense of how it worked as the programmer so there was no way the average player could. I decided to throw that system out and start, essentially, from scratch.
If have been following these logs you may have guessed that I did not study Computer Science or Software Engineering in college or even Game Design. I studied Mechanical Engineering, with an emphasis on Fluids and Thermals. So fluids is an area of the game that is very important to me and I would not be happy if it didn’t work the way I wanted. There was a fair bit of fighting my own nature to make it something the average player would understand and I may have pulled out the old textbooks at one point, but in the virtual world I make all the rules.
When making any complicated game system it is a good idea to set some design goals to help guide you, here are some of the things I wanted for the fluid system.
- Pressure gradients not "blocks"
- No sloshing
- Easy to understand when/how much fluid will flow and when it won’t
- Fluid higher up/closer is more valuable
- All fluids are incompressible
- Pre-compute as much as possible to ease CPU load
- Work with the other systems already in the game (e.g. rotation)
In my original design for fluids a pipe would simulate pressure by assuming that all fluid within it was at the same pressure. Creating what I would call a "block". If two pipes were connected that had different pressures fluid would flow from high pressure to low pressure. This is a seemingly intuitive model but not how things work in the real world when it comes to pipe flow. I am not particularly strict about making sure things match up exactly with the real world as that might make them unfun, but I do like them to be grounded in reality. In the real world pressure is lost over a distance as a gradient and where two pipes meet their pressures will be equal. This is how I made it in game. If you connect pipe B to pipe A the pressure at the beginning of B will be set to the pressure at the end of A. The pressure at the end of B will then be calculated based on a number of factors: length of the pipe, change in vertical height of the pipe, the material the pipe is made of, the fluid in the pipe, etc. Every pipe or building that has a fluid input and output will have these properties and calculate its own output pressure based on all of these factors.
Pressure is displayed to the player as a single numerical value and if a tank has multiple outputs all of them will have the same pressure. If there are multiple inputs it will use the smallest non-zero value for the input pressure when it calculates the output pressure. To keep fluids from sloshing back and forth all flow is monodirectional meaning it must always go from output to input. I have tried to simplify fluid flowing as much as possible so any pressure above 0 will cause fluid to try and flow at the maximum possible rate.

Pipes and other fluid transfer related buildings come in many different materials. Every material has its own properties for max pressure, distance pressure loss, and flow rate. Pressure is simply clamped to the maximum value and if you build a system that exceeds the max there is no penalty. There was going the be a leaking system or pipe breakage but much like the rotation system before it these penalties were found to be unnecessary and just hindered the gameplay experience while not adding anything while increasing CPU load.
Here are some early screenshots and info for the buildings related to fluids. Please know that all of these buildings are not using their final assets and their size and appearance will likely change before they are released.
Pipes are built exactly the same as shafts. All of the functionality in building a shaft is also part of building a pipe. I have updated the building hologram for shafts so it now has the proper corner gears and pipes use their own model for straight and corner sections.

For now the only fluid you can gather is water. Unfortunately, with this update there will not be any fluids spawning in the world as that is not a simple thing. Don’t worry there are big plans for a world update happening in the future but more on that on another day.

Water can be collected via the Well which requires a rotation input and produces a small amount of pressure.
When most people think of a pump, is in fact an electric motor and a pump combined together. And the engineer who designed that product matched the motor with the pump based on the specs of each and the desired pressure and flow rate. One of my goals when I was creating Engineer Alpha was to recreate that process of connecting parts together that would work well together. The pump in Engineer Alpha does not just get connected to the electrical grid, it has a rotation input that can be connected to any source of rotational power and the pressure rise scales with the input torque.

The pipe merger can be used to combine up to 3 pipes together into 1. Also the splitter can be used to make a single pipe go into up to 3. Both look like this as of now, marked inputs/outputs coming soon.

Tanks will come in 2 varieties small and large and will be a place to store your excess fluid.


As you may have noticed the Stirling engine from tier 1 could use a replacement when you start getting into iron buildings and parts. The second engine in the game is actually 2 parts the boiler and the steam engine. They are not quite ready to show off yet but I would assume you can guess how they will work for the most part. I will be talking more about these soon, hopefully next week.
This concludes the look at the second type of connector in Engineer Alpha, there is planned to be a third type and you can see a sneak preview of it here.

