Batteries Working

Hey Folks! Got the batteries working today. And also a slight change to the power transmission system.

Yesterday's post prompted some useful discussion of the power system, and Malocodor's suggestion turned out to be a better approach than mine. I originally had each of the powered items check surroundings and try to draw power from them, and each of those surroundings would chain-request power back towards the source. This worked, but required the system to re-check each request.

Malocodor's recommendation was to instead map out all the power connections once, and just update it whenever conduits are added or removed. This way, powered objects just checked their last known connections without all the back-tracing. And since I already had a lot of the grid-walking code to trace rooms, I could easily make a tweaked copy to trace conduits.

And once I had setup the air pump to use power, it (correctly) stopped operating since none of the connected conduits had power. Time to add some batteries!

Yesterday's post showed the battery art I added as a placeholder, so the bones of the item were already done. All that remained was to setup the various properties on the battery to make it store power. Namely, it has a stored power limit and some placement rules that prevent stacking, etc.

Then, it was just a matter of hooking up the air pump and battery with appropriate stats. Since I'm trying to be near-future, hard sci-fi, I want the numbers to make sense. So as a baseline, I'm going with some current-tech values for things that NASA and industry use. So the battery is assumed to be a big nickel-hydride bank, like NASA uses. And for the in-game size of about 0.25 m3, that means it stores about 41kWh.

Similarly, a typical, 2-stage vacuum pump used industrially consumes about 100W. So each time "use power" is triggered, I made it consume 0.1 kW. Hooked up to the above battery, it'll run continuously for about 410 hours, or 17 days. I have no idea if that's accurate, but it seems reasonable at first glance.

Then, it was time to try it out. And I'm happy to report that it seems to work! Cutting down the battery capacity for testing to last about 15 seconds, I saw the pump run for 15 seconds, then cut out. And when I added a second battery to the network of conduits, the running time capped at 30s.

Mission successful! Probably some bugs yet to find, but good enough. Jam on!

What's next? Currently, I'm leaning towards item UIs. Each item that the AI can interact with is probably going to have a UI the player can tinker with to make stuff happen on the ship. E.g. AI can sit down at a nav panel on the ship, and it opens a UI where the player can plot their route. Or an AI standing at the outer airlock control panel can control pressurization to exit/enter the ship.

The idea here is that pressing buttons, looking at meters and flashing lights, and throwing switches that actually do stuff can be fun. Won't know until we try it, though!


Malacodor's picture

You won't get far with too realistic values. You could use realistic values multiplied by a global constant. This way you could easily keep the relative performance characteristics realistic while tuning all systems up until they are good enough for the game's needs. That constant could also depend on the difficulty level. But maybe I'm overthinking the problem.

Ran around with a clown mask before it was cool

dcfedor's picture

I think realistic values worked pretty well in NEO Scavenger. There were some sci-fi fudges, of course, but for the most part, things in NEO Scavenger obeyed current engineering limits. So I'll probably be toeing a similar line in this space setting. Familiar tech with some near future advancements (e.g. efficient fusion).

One of the things I want to accomplish is the education and inspiration of players. I'm hoping players (myself included!) will learn a thing or two about the hurdles we face in space travel and colonization. And maybe even some of them will be inspired to pursue careers in engineering through what they learn. Exposure to realistic sci-fi certainly piqued my interest (thank you Traveller RPG), enough to push me through a physics degree :)

Dan Fedor - Founder, Blue Bottle Games