Reimplementation of client has (already) started


Going through the slog that was getting targeting working (which I... kind of... did), and constantly finding more and more TODO items in the code, it became clear that I'd buried myself in cruft.

So I scrapped the client and started over. 

Well, not completely. Most of the animation and rendering code is fine, it's just that a lot of the control flow needed serious refactoring that would've taken more time to try and do in-place. Which is already going a whole lot better, thanks to actually taking the time to plan the client out in terms of code this time.

Among a lot of other improvements, I'm also putting some effort into getting the UI pixel sizes to match each other. It'll take a little more time to see if that pans out.

For now, though, one of the initial bonuses is handling the active party as part of the User data structure, which -- among other way more important but less UI-visible things -- allows easy party leader switching in the map view.



The biggest reason for this overhaul was the clusterlove that menu handling was turning into. I'd painted myself into a corner by assuming anything that could have focus (i.e. handle input) would, could, and should be modeled as a menu panel. That turned out to be totally wrong when I got to the unit selection UI, which still had to fit into the input management hierarchy, and that required enough ugly hackery that it was no longer worth even attempting.

The concept is still similar, but rather than panel-centric, it's treating UI components as a stack of 'layers,' with a layer either being focusable (handling input) or not, and the top layer on the stack being delegated input, provided it's focusable. The map grid, which contains the tilemap, is currently the only focusable layer, and it's being delegated input as intended, so that's a start.

Not quite sure yet how I plan to handle rendering order of focusable and non-focusable UI layers, and it may end up making sense to just have focusable layers manage their own non-focusable layers and just have the focus manager ignore them, so that's going to be something to figure out soon.

And now, on to reimplementing menus. :)

Leave a comment

Log in with itch.io to leave a comment.