Larkinabout / fvtt-token-action-hud-core

Token Action HUD is a repositionable HUD of actions for a selected token.
14 stars 17 forks source link

Best Practice Question: Dynamic Layouts #242

Closed draconas1 closed 2 months ago

draconas1 commented 2 months ago

Heya, it said to raise an issue for questions

What would be the best practice for handling the group and layout configuration for a set of actions whose groups can change between actors, and change on the fly based on player selection?

4E characters have powers, and on the main character sheet there are multiple ways to group those powers for display. E.g. by what type of action they cost, by where they come from, by their usage limit etc... This is changeable on the fly by changing a dropdown on the sheet.

When I did the classic integration I build the groups and subgroups in TAH by querying what the user had selected and then generating the groups based on that, so TAH always mirrored the sheet selection.

The example Core modules (and 5e and pf2) wants to know the groups and layout of those groups up front with the default layout. At the moment I am getting around this by having groups and layouts for all possible groupings of powers, and trusting TAH to hide the empty ones, but that's quite clunky. Is there a better way you can recommend that will be happy with groups that may change every time a token is selected? I'm guessing so given "default layout".

Included some images from a character with their powers flipped from use to action groupings, and the underlying group config I have generated to support that.

powers-grouped-by-use powers-grouped-by-action underlying-groups-and-layout

Larkinabout commented 2 months ago

The way you've done it looks fine. It looks a bit ugly when the HUD is unlocked, but you don't/shouldn't be playing with it unlocked anyway.

The general principle of TAH Core is that every user can pick and choose the layout of their HUD, hence why 5e and PF2 builds them all up front. The 'default layout' is just the out-of-the-box layout. Based on your method, you'll remove that functionality, for example, what if a player wants to see powers grouped both ways on their HUD or a bit of both? Probably unlikely, but it's up to the user.

It might be worthwhile looking into derived groups. Those are groups which have dynamic subgroups, but which the user still chooses. The 'Actions' group for dnd5e is a good example. Using derived groups, you could have a 'Powers by Sheet' group (or a better name), which dynamically adds either 'by use' subgroups or 'by action' subgroups depending on what option is selected on the sheet.

Alternatively, and this feels like the better/easier option to me, you could just divorce the HUD layout from the sheet option, provide a system default layout of either 'by use' or 'by action', then let the users/GM define their own layouts by preference. You could even package layout files for either preference with the module to save them some effort.

Custom layouts are set in the TAH Core module settings: image The GM can set a global one to override what the system provides by default, then each user can set their own using a layout file. These are only default layouts for if the user resets the layout. Every user can completely change up their own HUD using the UI when the HUD is unlocked.

draconas1 commented 2 months ago

Fantastic, thanks, I'll go away, have a think and talk to my users :)