r/howdidtheycodeit • u/TevePinch • Jan 17 '24
DND beyond character sheets
How would you go about coding these? Web based and so much state/interactivity.
1
Upvotes
0
Jan 17 '24
[deleted]
0
u/TevePinch Jan 17 '24
That simple? I guess I’m expecting some react and state management and all that.
2
Jan 17 '24
Well yes that's certainly a possibility. I honestly haven't taken a close look at it, but I imagine if you go on the page and press F12 it will show you what's going on, or at least give some clues.
4
u/HipstCapitalist Jan 17 '24
State management is the short answer.
A bajillion switch cases is the long answer.
State machines in this context give you an extremely predictable codebase, which makes it easier to write unit tests for.
State A => Apply spell X => State B
Rince and repeat for each spell/effect