Devlog Week 4: Menus - They're Terrible
The past three weeks were initially focused on visual improvements and removing a lot of placeholder stuff.
There were also a few issues with menus & pausing, which sent me down a rabbit hole resulting in a significant rewrite of the menu UI system. Before, 'menu pages' were just numbers which referenced different grids of menu items (e.g. Menu 1 was the settings page, which held the buttons for save, load, quit, etc.) and changing a menu page was just a matter of changing which number page you were on. Turns out that decent menu systems are A LOT MORE COMPLEX if you want to keep things clean.
Under the old system, 'sub-menus' would have been a nightmare to manage. For example, the end goal with saving is to have a list of existing savegames to overwrite, or an option to create a new save that will take you to a page like this, for choosing the save's name:
So, this poses a few problems. When 'OK' is selected, the list of savegames should come back up (with the save file you just created added to the list). But who manages the notion of what 'back' means? Before the rewrite, there were three obvious solutions:
1. The 'OK' button should have a hardcoded value for which page to go to when pressed. Problem: All submenus then need to know who their parents are; means they can't be fully modular, and involves a lot more work to add a submenu.
2. Have the menu managing system keep a 'history' buffer that keeps track of all the pages we've visited, and just re-open the last page in the buffer. Problem: If a submenu has multiple pages, you're screwed.
3. Rewrite the whole damn thing. Problem: The developer is lazy.
Unfortunately for me, I chose option 3. Now, pages are far more robust. They can do things like keep track of their 'parent' page if they're a submenu, and pass messages between them. That's super useful for things like the text entry submenu. That page doesn't need to care about what the text is being entered for; save names, in-game passwords, whatever. They just tell their parent the string they ended up with, and leave it for the parent page to decide what should be done with it.
It was a huge pain to do all this, but it means that I'll be far less hesitant to do menu stuff in the future, now that it's less of a nightmare to deal with.
Thanks for reading! The prototype is freely available to download, and feedback is much appreciated. Be sure to follow me on Twitter if you want more sporadic, and less eloquent updates on the game's progress!
Get Lepidoptera
Lepidoptera
An adventure about exploring an anomalous island
More posts
- Temporal Objects and Temporal Object AccessoriesMar 31, 2019
- The Post About the Dialog SystemMar 28, 2019
- Devlog Week 5: Menus - They're DoneOct 12, 2018
- Devlog Week 3: Sanding Down EdgesSep 01, 2018
- Devlog Week 2: Fixing Camera JitterAug 24, 2018
- Goin' PublicAug 17, 2018
Leave a comment
Log in with itch.io to leave a comment.