Forensic Friday 24: Pipes are dead, long live the pipes!
Welcome to forensic….Sunday??? Well I have awoken from my desk to bring you the case file as quickly as possible! And this one is an interesting one! Pipes have been conquered completely! And now we bring… PIPES 2: ELECTRIC BOOGALOO (Terrible joke and reference I know); but yes, good tidings for a good week! I’ll pass it onto Dillan…
Better Pipes #
Building on last weeks post, we’ve tinkered with how pipes work, keeping the same idea of cells, but changing the way the pipes decide how much fluid they are giving to neighbours, and how much they receive from neighbours. A TL;DR is that we set a certain number of cells as “transfer fluid out cells”, and another number of cells as “transfer fluid in cells”. If a fluid holder has a lot of transfer in cells and no transfer out cells, then it will keep taking in liquids, but not pass it on to its neighbours etc. This allows liquid to have a much more “liquidy” feel, where it looks like the liquid is creating waves through the pipes, which was a really cool by-product!
Pipes 2: Electric Boogaloo #
Another one of the issues highlighted in last weeks blog was making powered fluid entities in game. Giving a little summary of behind the scenes work, we have a system where all placeable tiles in the game extend from a base class called
TileEntity. Building on top of this, we then have a base class for all powered items (called
PowerEntity) and all fluid holders (called
FluidHolderEntity), with each of these extending from
TileEntity. Still with me?
This is where a slight problem comes. What if we want an entity that is both powered and holds fluid? C# (and most other languages) don’t allow multiple inheritance since it causes a lot more problems that it would solve. Therefore, what I’ve been working on is an interface for fluid, that will allow powered entities (and any entity) to interact with fluid within the game. This will allow the addition of pumps etc. that require power, but that we also want to transport fluids. Expect to see more next week! Passing it onto TD350…
News from the UI World #
A very rudimentary test of the new UI system (It’ll look a lot better in the future of course!)
We bring good tidings from the world of user interfaces! We recently discovered a better way to create UI in a more programmatic way. There will be some development overhead from having to recreate our with the new system, but the long term speed up in development time would be more than worth it.
Sparing y’all from the details, our old UI relies on Unity’s more than lacklustre UI system which is fine for all games other than simulation heavy ones. When we need to display a lot of information from various sources, it can become a brain melt to create UI.
With the new system, we can create UI using frameworks borrowed from the web development world, which are great for fast iterative design, display data easily, and styling things on the fly. With our currently system styling has to be done in a more manual way. We can’t just type
height = 70 pixels we have to literally drag an element to where we want it to be, resize it, write a script to make sure it creates elements inside it etc. Just a lot of pain!
We will be testing out the new UI system very soon. Over December we plan to overhaul the UI amongst other things. We also plan to make the game testable which will likely be our final major overhaul of the actual codebase.
A Quick Aside #
In other news, I just wanted to take this quick aside to point out *Drumroll.. .. . .. * The game has 27 thousand lines of code :partying_face: . That’s A LOT, and that’s only counting the code we have written
ᕦ(ò_óˇ)ᕤ. In some ways, it is a measure for how close we are to finishing. a rather crude measure, but still one that can be used sparingly. Let’s crunch the numbers:
Most games of this genre look a bit like this:
Rimworld: 100,000 circa 2016
Prison Architect: 112,341 circa 2013
Factorio: ~100,000 circa 2014 | ~700,000 circa 2021
All in all, 100,000 lines of code seems to be the golden number. When we reach 100,000 lines of code, there is little doubt that the game would still be unplayable let alone finished completely (outside of expansions). The first alpha version of factorio had around
~50,000 lines of code! So I can roughly say that we are perhaps…
54% away from a playable alpha (feels like an accurate figure)
27% away from a full release (Not sure about this one, we like to be optimistic!)
Anyways, this exercise will prove to be completely useless, I am sure of it, but it is fun to speculate about this stuff. Anyways I should head back to writing some more lines!
Case Closed #
That’s all we have to offer in this case file, so I’m marking it as closed. A lot of interesting stuff will be happening in December so keep your eyes peeled wide open! Case closed.
P.S. Bug of the week will officially start next week, but see attached our personal favourite bug this week!
Pipes can get dragged through fluid storage blocks, causing game breaking issues! (Fluid storage is still using a place holder. It’s all white for noW!)
Much love. Thanks for reading,