Case Study : Mobile device Pipe Game with fluid dynamics - a proof of concept

29 September 2020  
 4 min read

I’ve been experimenting on a very small proof-of-concept project that trials out some ideas that I’ve recently had to combine a tile-based “pipe game” with as actual fluid-simulation.

Unlike the blow-by-blow instructions that you’ll find in my other articles, this “Projects” section is intended to be a tour of some of the projects that I’ve been working on. If you want to replicate these projects, you’ll need to figure out the implementation details yourself, but hopefully, they can be a source of useful hints and inspiration for folks.

Pipes - Swept Away (2012)

Several years ago, I released a mobile phone game called “Pipes - Swept Away”.

It was a simple tile-based puzzle game, created for the as-then new Windows-Phone-7 (WP7) platform.

The game revolved around the straightforward premise of a player tapping pipe-segments in order to rotate them, thereby redirecting a flow of water around a maze of pipes.

The puzzle element came in the form of a requirement to maintain a connection to “houses” at the top of the screen, whilst freeing up a path for a small cartoon character. The solution to each level allowed the character to escape the maze. There were almost 100 levels, of increasing complexity.

swept aay photos

Over the following year, the game went on to become unexpectedly popular. It eventually came on the radar of Microsoft, who included it as a “featured” app on the WP7 AppStore. For me, having my app featured alongside heavyweights such as Angry Birds and Fruit Ninja was super-satisfying.

I just did a little googling - I’m a little sad to discover that I now can’t find any trace of my old game left on the web - it seems that over the years, the collapse of the Windows Phone ecosystem has swallowed everything along with it. Fortunately, I made a screenshot at the time!

pipes swept away featured on app store

A pipe game with more realistic water?

Fast forward to 2020 and I keep finding myself, as I have for the past year or so, circling around the notion of resurrecting my old game in some form or another, for modern IOS/Android platforms.

Last month, I was working on a project that used Obi Fluid for Unity.

Off the back of that work, I then started toying with the idea of producing a “pipe puzzle” game that used an “actual fluid simulation”.

Before I got stuck in, I specifically wanted to explore these ideas first:

  • How does a compute-heavy simulation perform on a mobile device?
  • Could there be any interesting game mechanics to be leveraged from a 3D physics-based simulation - rather than just the 2D artwork and simple A++ pathfinding, that my original game used.

If you would like to learn more about Obi Fluid along with comments about my own experiences with using it, check out my previous blog Case Study : Prizedraw Tombola for Twitch LiveStream

Solution ingredients

The project is tiny and brings together:

  • Unity 2019.2.x project
  • Obi Fluid 4
  • Super-basic half-pipe models

I already covered this topic in my previous article, but to reiterate again: a vitality important factor to retain good performance is to use as simple a collider-mesh as possible:

half-pipe model with basic mesh collider

How did the experiment work out?

Not bad really - the liquid flows around the pipe-maze mostly as you might expect - and it looks quite attractive.

However, there are several points worth calling out:

  • Unexpectedly, the simulation performed fairly well, even on a mobile device (at least on my 2018 era Samsung Exynos 9810 based device).
    • Albeit this was when using a particle simulation with a conservative number of particles and well-optimized collider meshes.
  • The app absolutely wallops the processor of a mobile device.
    • This caused it to warm up significantly
    • Battery life would inevitably be heavily impacted.
  • I couldn’t determine how Obi Fluid manages the concept of “fluid pressure”.
    • There are settings for “density” etc
    • I could not seem to model a way that gave the illusion of water forcing along the length of a pipe - this manifested in the effect of water starting to slow right down as it progressed along the length of a pipe.
  • Water frequently “leaked” from pipe-segment joints.
    • I suspect this is related to physics “tunnelling” because fluid particles are rotating (again, refer to my previous article where I talk about this effect).

I could have progressed the proof-of-concept further, but I called an early end to the experiment because I could not see a way for the heavy processor load to ever be acceptable on a mobile device.

At the end of the day, a simple puzzle game doesn’t really justify this use, when there are far simpler ways to produce a performant game.

Below is a video - click the play button to check it out:


2020 (26)
2019 (27)