Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Almost Didn't Make It

I was seriously considering doing nothing on the game today. I have another technical topic I'm cogitating on. I'm trying to mod Oxygen Not Included, and I don't think there's a mod out there that does what I want. So, I was considering creating my own mod. But, I loaded up the game, and I have some BIG work to do!

I'm adding state machines everywhere!

Well, not everywhere, yet. For now I'm starting with the ship's equipment. I'm going to start with three states, for now. But really I only need two at the moment. First is "Start". Pretty simple and straightforward. Every state machine has a Start state. Then, there's the ItemPickup state. That's what'll be floating around in space or whatever. Not sure exactly what will or won't use that state. Who knows. For now I'm creating the state but not actually going to use it.

I've decided I want another state. I know at some point I will be adding a "garage" or something. You know, a hangar, a place where the player can change equipment. So, I need to handle the equipment there. It can't be in the start state, can't be an item pickup. Needs it's own state. What do we call it?

Oh wait, inventory! That's perfect, we have an inventory state! That should be useful in the world and the garage, right? Perfect! Let's call it InventoryItem. That is kinda weird that we have ItemPickup and InventoryItem. What do you think? Should I adjust one of those? Let's ask the AI! Wow, that was useless. 

Finally, I need a state that describes what the items currently are. They have their scripts that they run, when attached to the ship. So maybe ActiveEquipped. That way the name is descriptive, and it leaves room for other possible states surrounding it if needed. Like, I could have InactiveEquipped. Not going to, but I could! Although, I can see a use case for it already in something I'm doing.

Man, I wish I could have two different graphs open at the same time. Well, other than the fact that I had to flip back and forth between two graphs multiple times, that was easy. That was only one piece of equipment though. I just deleted the original graph, kinda made me hold my breath a little. 

Time for the next item! Well, I actually did them all. It actually turned out to be a lot easier than my first try. I just took everything I had in the existing graph and pasted it into the state for space (which I copied the state machine layout from the original). Tested it all out and it worked well with the state machine handling everything (and the script machine disabled). Then I tested without the script machine at all. All works the same way it did.

Sometimes you just gotta step back and make adjustments to prepare for the future. I actually made a few other changes while I was at it. I moved the sprite for the ship, from the ship object itself to the hull object. That way I have the hitbox and the sprite on the same object. Just makes it easier when I want to offer a new design. 

Alright, so far so good! Still so much to do, but for now it's great progress. 

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.