Prototyping Ship Class

I decided to switch back to prototyping for a bit today.

When I last left off on Friday, I had decided to start working on the Item class, to represent onboard tools and other objects crew could interact with. I had finished up making a new class that exposed most of the same tools as a crew. Basically, the item had a list of conditions, a sprite, a name, an ID, and a list of available interactions.

However, before I could use it, I needed some way to tell the game that the item was on the ship, where it was, and what orientation it had. And it would make sense if this was setup during the ship editing process.

Unfortunately, my prototype had a very rudimentary definition of "ship" which had no way of specifying onboard items. Basically, it was just a list of tile types and overall dimensions. What I needed was a beefier ship definition that included that tile info, as well as things like items and crew on board, and where each is.

So I started working on a new Ship class to contain all this layout info.

Refactoring the prototype to work with a ship, instead of just a tilemap, turned out to be a bit of work. There were a lot of assumptions made to get the prototype working as quickly as possible, and they had to be adjusted for this new ship class. And as of now, the code compiles, but it's not quite working yet.

The good news is that this should be a big leap forward for the prototype once working. It'll allow me to specify a ship's structural layout, the items and their positions/orientations, and the list of crew on board. I can then pass that whole dataset around from game state to game state (e.g. ship editing mode, solar system flight mode, planetary lift-off mode, crew monitoring mode).

It's also a bit easier to work with, from a data point of view. The ship class can take care of a lot of "under the hood" stuff that the rest of the game shouldn't need to care about. E.g. initializing the tilemap, changing tile data, etc. Plus, I can finally start throwing items into the ship to see what the crew does with them!

First, however, I have to get it working. And that's what I'll be up to tomorrow!