Controller Focus Navigation
Mouse interactions are staying; I’ve been focused on adding natural controller navigation. There’s a lot of controller interactions that we take for granted that when implemented cleanly just feels natural, but that hides a bit of a mountain of helpful logic. I’ve been thinking about it this way; the player wants to know what card they’re looking at, which card is selected, and what target that card is going to. Practically, hover the card they chose, highlight when selected, then choose a target. It’s also valid to want to choose actions elsewhere on the screen, like configuring a game mechanic or opening a menu. Godot has some built in helpers for knowing which button is closest… but not everything is a button.
My conceptualization was to consider focus navigation as a series of layers with a current index. Up and Down will change the layer, and there’s logic around what layer you can go to from where. Left and Right will cycle through what can be interacted with. Therefore, you start on cards (defaulting to first playable card) which hovers the card, then when you select that card, the card is highlighted and focus navigation switches to select the target. If you cancel, go back to the cards and deselect, but still hover.
Implementing this system required some refactoring and logical cleanups. Both the card manager and cards have states, but with different intents; the card manager needs to know what card it’s looking at and what the card manager is doing in a logical flow. Cards just do what they’re told to do; they don’t know when to hover or be disabled, but they can listen for it. I eliminated the concept of a player hand manager as it was so tightly coupled with the card manager that it defeated the purpose of its separation.
However, there were some areas that didn’t need refactoring; I did have a clean separation of concerns with the mouse interactions, so the methods that performed actions like playing a card didn’t change a bit; there’s just more than one entry point now.
I am going to have to make some UI changes; my original vision had some user interfaces to the left of the player, but with a layer-based navigation, that layout is confusing (if I go left when selecting a card, I expect to wrap around to the last card, not switch to a different layer). I haven’t gotten around to changing it yet because it works, but that definitely needs attention.
Controller navigation took most of the week, but I made some progress on multiple fronts.
- Added: Controller Navigation
- Added: Combatant animations (they slowly bob now)
- Added: Opponent intents (I made my own sprites, but I’m not an artist)
- Added: Persistent Player
- Extended: Card generation management
- Refactored: Card and Card Manager
- Abstracted: Configuration
I tried adding controller hints, but was encountering a blocking bug which I reported to the maintainer.
Goals for this coming week:
- Add a second opponent
- Fight two opponents at once
- Generate conflicts
- Add more cards
- Abstract buttons (they aren’t their own class/scene yet)
- Simple dialog system
- Don’t get too distracted by playing demos in Steam Next Fest