Home Sweet Home

Hey Folks! Back to work on the space prototype today, as I continued laying the groundwork for ship docking.

The first task was to finish fixing the issue I ran into the other day with rooms vs. void detection. Some ship rooms were being classified as void, and vice versa. It turns out this was a two-pronged bug.

The first part involves the way the code walks from tile-to-tile, checking to see if it was a contiguous part of the current room. It was ignoring the diagonals when checking surrounding tiles, but my void/room check didn't know that. So every tile was coming up void.

Fixing that made the room-detection work, but it was still not venting atmo into space if the outer airlock opened. (Or more accurately, only did so for certain airlocks.) It turns out this is a limitation in my gas exchange code which only works if room A is not a void. And depending on which way the outer airlock faced, this could sometimes be true. I ended up changing the gas exchange code to swap room A and B if this happened, resulting in a more robust simulation.

With that out of the way, the next step was to start preparing for more than one ship. So I added some new buttons to load, save, and save-as on the ship editor. This involved creating a modal dialogue box with a way to both choose from a list of names (e.g. loading), and/or specify a new name (e.g. save/save as). I had to learn a bit about Unity UI and events, but it eventually wasn't hard to build once I did.

And with that done, I created a sample "space station" (above screenshot) that I could use to dock to a ship. As you can see, it's pretty spartan. More like a space prison :)

Tomorrow, I'll start changing the way the game looks for info on ships so that it works on multiple ships instead of assuming only one. This means things like "get all items of type X" checks not only the current ship, but also each docked ship, so an AI, for example, can find a bed even if it's one a docked ship instead of "this" one.

Similarly, a function like "get tile index at world coordinates" needs to check each ship, since any given coordinates will only exist on one ship, and it may not be the current one. This is a bit trickier, since a lot of code uses this to get nearby tile stuff, like power supplies and signal inputs. But I think I can cheat a bit here since those will only ever need to check the current ship. (E.g. the air pump isn't going to need to check a different ship for the power input)

It's going to mean quite a bit of refactoring, so the game won't run while I switch over to this new stuff. But hopefully, I can get it up and running again soon!


Marc13Bautista's picture


Free Elusive Skill = Athletic x4 in ATN Enclave encounter