Gamejam Mode Activated

Okay, I've pulled the trigger on "Gamejam Mode." I wrote a script to yank out all my lights from the big ship layout, cranked the ambient lighting back up, and I'll just ignore that for now. And in it's place, I'll start banging out as many new features as I can. No polish. Just quick and dirty.

First up: ship atmosphere.

I want the ship's HVAC system to be something the player has to carefully design (and maintain) to keep occupants alive. And this means keeping track of O2 pressure on the ship. The simplest solution I can think of is to just have a per-tile pressure that gets smeared to neighboring tiles each update cycle (or some other time period).

To help visualize what's going on, and debug it more easily, I've hooked up the tile grid overlay to the pressure stats of each tile, and they tint green when the pressure is high, and red when it is low. And for testing purposes, tile underneath the cursor is set to 100% pressure as long as the right mouse button is down.

Here's a snapshot of it in action:


Gas propagating from a room's edge.

The white dot in the image above is the source of the gas input, and you can see it expanding outward from there. Walls stop propagation, and the gas slowly expands around corners.

One thing I'm immediately noticing is that this method takes a long time to fill a ship. (Remember 2x2 grid squares is one person in size.) I've been holding the mouse down for close to a minute in that shot, and the small room under the cursor is barely breathable. And this is with each tile updating once per frame.

Per-frame updates on almost 5000 tiles is pretty crazy expensive, so I may have to ramp that frequency down a bit. And that means even slower propagation.

Of course, maybe this is fine. It'd take a while to pressurize a whole ship. Heck, even pressurizing an airlock takes a while with modern tech. And doing so too fast is dangerous for the occupants. So maybe this will work?

In the spirit of gamejamming, I'll probably move on from this to the next thing, since it's "good enough" for now. Maybe the next thing is an air processor, or airlocks, or even AI reacting to lack of pressure. Whatever it is, though, it should be the shortest path from here to some playable system.

More on that tomorrow!


ra1's picture

Kind of reminds me of how water propagates and gets deeper/denser in the game Creeper World.

Perhaps an easier method would be to create an undirected graph connecting each room (node) to all other rooms. Each node would have a volume and density (that's it). Pressurization would happen via a simple nearest neighbor pathfinding algorithm. The path node tree would only need to be updated if a door opens/closes/explodes/etc. Given that most ships would have a few dozen rooms at most, this could easily run with minimal overhead.

dcfedor's picture

There's that room system again :)

It's quite possible I'll need to break down and make said room system eventually, as many game bits could use it. I've just been putting it off because room detection is sometimes tricky.

But then again, so is optimizing cellular automata :)

Dan Fedor - Founder, Blue Bottle Games