Resupply Is Go

Hey Folks! I think I've got the station resupply UI just about working. There seems to be a weird calculation error in O2 levels, but apart from that, I successfully resupplied today!

After a few early tests, one of the first things I did was to fix the docking system sprites. They had a long-standing bug that caused crew to disappear under them when passing through, and that made testing this harder than necessary. (Trying to click crew when in an airlock caused the airlock to intercept the click, since it was "on top," and that toggled the door, and...well, it was really annoying :) So I removed built-in floors from the docking system, and made it require floors from the ship be there instead.

Then, I created a kiosk item that I could place on the station to access the new resupply UI. Like batteries, nav stations, and other UIs before it, this uses the interaction system to raise a UI when the appropriate interaction is activated by a crew. This involved several pieces of data to complete the interactive object. An item/layout definition, condition owner definition, triggers, interactions, new conditions/flags, and the sprite itself. You can see it in the station in today's screenshot. It's the 4 orange terminals in the tiny docked station. They look kinda like ATMs or arcade cabinets.

Once the kiosks were created and added to my tiny test station, it was time to fire them up! And, as expected, watch them crash almost immediately.

I had a few more issues in the code to fix before they came online. Mostly null pointers due to either bad data I wrote, or accessing things the wrong way. It also led to me discovering a fairly major bug in the ship/item data load/save code. It was storing the wrong name for each item installed on the ship. (Basically, the name of the tile data for the item, instead of the item itself.)

Once that was fixed, and the UI finally loaded, it was off to fixing the errors in the UI itself. Most of the rows involving actual, live ship stats had a bug or two. Bad unit conversions, missed data, NaN (divide-by-zero) errors...it was clear how out of it I must've been by the time I reached some of these yesterday. I was dividing where I should've multiplied, etc.

But then, after most of a day of debugging and fixing, the UI loaded with live values! (Also seen in today's pic.) All the on-board/max values lined-up, sliders set to current amounts, total dollars tallying. It was cool to see it actually working! And just a tiny bit more work added the code to resupply the ship with purchased amounts when hitting the "Submit" button (not seen here).

Of course, no money changes hands right now. And one can buy negative supplies to get money back. And those prices might be out of whack. (Seriously, look up there at the max amounts of He3 and heavy water, then do a rough pricing-out for a full tank of either...yeah. Anyone got a cool 2 mil in their pocket for gas money?)

Still, we can now theoretically dock with any station, and as long as one of these orange kiosks is there, we can replenish fuel, air, and power, and take-off again!

Next week, I'll maybe fix a thing or two (like the wacky O2 amounts and He3 price) before doing a "wet" run from Mars to Ceres, to verify everything is working as it should. And if so, I think that's enough basic stuff to start looking at the next thing: money and encounters/missions.

If you recall, this refueling UI was one of the two things I figured would get me to a good place for starting to define gameplay loops. If traveling (or even sitting) uses supplies, and we have places to resupply but they cost money, then we have the beginnings of a game. The player needs to do something to avoid getting stuck/freezing/starving due to lack of supplies, and that something will probably be flying around finding employers for work, and opportunities to exploit.

The trick will be figuring out what those jobs and opportunities are, and how they'll work. I think at a really basic level, they can just be NEO Scavenger-like encounters until I find something better. Talk to a lady at station A, she wants you to check out something at B and report back, and doing so earns you money. Which means I'll also need a way of tracking money, but I can hack a quick and dirty parameter in for that.

And if that simple (and admittedly boring) loop is working, I can start to embellish it a bit as I see fit. What if there's a complication in the task? A counter offer? Reputations? Travel permits? What if I have the player's captain assigned some rival during chargen, and they throw a wrench in the works from time-to-time? What if random catastrophe happens en route?

Definitely a lot more fun to be had once this basic loop is running!

Tags: Ostranauts