Atmo Regulator and Complexity

Hey Folks! Spent a lot of time in the gas/atmo systems today, gearing-up for some sort of regulated air pump to keep life support atmo at reasonable levels.

The first block of work was cleaning-up a lot of the old code to handle gas exchange, gas pumping, gas respiration/conversion, and gas containment. This was all hard-coded in such a way that every object in the game had functions for it, but only some used them. Since Unity is an entity-component model, it made sense to break those bits off into their own components and only assign them to objects that need them.

Once that was done, I started working on a new air pump/regulator. Basically I want it to pump gas when the air in a room is low, and stop when it's full. Also, I want it to pump O2 and N2 at Earth-like proportions.

This means the item needs to know which gas is needed in which proportions, and to pump those when the room needs them. It also needs the various bits of data to control whether it has sufficient power or not, and switch states accordingly.

At first, I thought this would just be a matter of mashing my old gas pressure sensor and air pump into a single item. However, the more I go down that road, the more apparent one problem becomes:

This is way too hard.

I currently have 6 json files open right now. I'm adding multiple entries to each. I'll probably also need to open 1-2 other files before I'm done. And that doesn't count the images that go into making an object game-ready, or hooking them up in-game. And there's a decent chance I'll need to write a new UI for this since it has a lot of in-game settings users will want to access.

Put another way, this is a very complicated process to add a single item to the game. Complicated mostly because I'm trying to expose a lot of this via data files for modders. But I get the feeling that if I'm struggling with this, modders will too. And worse, they won't have the debugger open to sort out issues, nor will they have as much insight into how the code works.

I'm starting to wonder if I'm hampered by overengineering here. Especially at this stage, I think I need to be able to pump out content and rules faster than this is going. I've run into this at least a couple times before with Fusion, fancy UIs for docking and character generation, etc. Leaving it in code (or mostly in code) sped me up quite a bit, and I think the results were better. And I'm not sure they would be too hard to make moddable again later, just with more limits. (Like, you'd only be able to change rates and values, but not the logic that runs the beast.)

And now that I say that, I wonder if that might be the best approach: just go in there and start hard-coding these things, and make smaller pieces of it moddable later. I think if I were an army of 6 developers, it'd be different. But since I'm just one, I need to be more nimble.

Anyway, warrants some thought. On the plus side, I kinda like how the sprite came out!

Tags: Ostranauts

Comments

Soupy Delicious's picture
Soupy Delicious

"Do what you gotta do." Rule of the universe.