Posted September 26, 2024 by jmarsh411
I was so ready to put the remaining polish on Boogie Bashers' gameplay. Only there was one big issue: Players sometimes couldn't actually start a game because there were so many ways to get deadlocked in the menu. Of all components in the game, the menu especially was full of spaghetti code and references.
We'd like to start getting feedback from complete strangers instead of just people who know or meet me in person. And for that, it's pretty important that people can play the game without assistance. So I decided it was time to give the menu a good scrub at the structural level.
Menus are frequently implemented using state machines in games. I remember a colleague saying something along the lines of "I can't believe Unity doesn't provide a state machine implementation. It's such a common need in most games." It seemed pretty sillly that they didn't do this, but then I came across this brilliant comment on Reddit about how you can use GameObjects as states.
Thinking about state design this way opens up so many new possibilities, and so began the task of making our menu state machine with GameObjects. This was also a great time to make this a system that could toggle menu screens with animations and in a more performance friendly way than disabling the Canvas's GameObject.
This video shows a fairly minimal workflow of setting up a new sub-menu
Menus can now be created and rearranged around much more quickly without breaking other things. And this is just in time for the menu overhaul, where we'll tackle the beast of the online Matchmaking workflow shown below.
Without a system that simplifies menus and submenu, this deep hierarchy would be very tedious and error-prone to implement.
We're planning to do a visual overhaul of the menu and the in-game UI very soon. Until next time!!