GameManager, Persistent Data & Optimization


Let me start out by saying I have NO formal training with C#, OOP (or whatever they call it nowadays) or Unity.  Everything I know I learned and taught myself. So, here’s my #1 rule here and now: If you know how to do it better, please help me out.  Just don’t be rude about it.

Okay cool, now that that’s out of the way, let's talk code.

My code base for this game, currently, is somewhat disorganized, but organized chaos is my life.  Today I've managed to work out a solution for having my game menu be efficient and clean while also being optimized enough not to take up too much overhead for the mobile port (which has to have a lot of graphical effects and polish removed just to run well on Android (sorry iOS, it's not coming to you guys for a LONG, LONG time)).  My solution was a sort-of state machine to handle all the different states that the persistent menu could be.  So, I got to work planning out the different states making sure each one was unique.  Then I created all the little pieces of each state and referenced them.  Long story short, I can switch between different states to change the appearance of the menu (certain buttons and configurations will only appear during certain states).  The next big hurdle was assigning behaviors to each button/window/whatever and having those change depending on the state you are in.  For example, I have a continue button that has two distinct functions running of the same button.  If you're in the pause menu, it un-pauses.  If you've just completed a level, it continues to the next.  Not particularly tough, but it created some serious issues.

You: Did you say serious issues?

Me: Yes, yes, I did.

I soon found out that the system I had managing the levels was absolute trash and just had to go, but so many other scripts depend on it. So, I deprecated it but kept it in for now and began consolidating my HUDManager into a GameManager to handle all persistent information about the game. So my next step is to work on the GameManager, tweak the binary levelData, work on keeping the levelData isolated from others, and figure out a way to have it all come together with as little scripting and script-to-script interaction as possible.

All in all, its going very well and we (Devon and I) are working hard  pushing this new update to all of you.

Speaking of Devon, Devon is an indie developer over at SplitBox Studios.  He's working really hard getting Penrose pushed to mobile and making sure is has better accessibility options for the wider range of players we may encounter. He's also hard at work developing his won projects too! Give him some love and go follow him over at https://splitboxstudios.itch.io/ and don't forget to get pumped for St. Paddy's Day (St. Patty's Day...I dunno how its supposed to be spelled and I'm honestly too lazy to google it.)

Have an amazing Monday, and I'll check in with you soon!  

Get Penrose

Leave a comment

Log in with itch.io to leave a comment.