-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Events are driven by scheduling based around an AV value, which is 10000 / current_spd. Events can be advanced or delayed.
One approach for turn-based scheduling is just to use a generic discrete event scheduler. Could either throw together a simple one or borrow one from a repo like this one. Most discrete event schedulers are more complex than needed for a turn-based game, as they also take into account duration of an event as well as scheduling priorities. If we wanted to throw one together, would just need FIFO instantaneous events where we can action advance / delay a given event (like "TurnStart" for a certain entity).
The main awkwardness about this approach comes to the de-synchronization of an entity from its turn start event. Would either need a helper function to make it easier for a specific entity (like a character) to apply action advance / delay to targets, or would need to apply a buff that sets up the delay.
Resolve AV w/ buff
The buff approach goes along with the rest of the design, but needs immediate resolution and not really a normal "buff" in that it is not a persistent effect on the character's speed / av. Perhaps there needs to be a type of "buff" that has an effect that is immediately activated before disappearing from the list of applied buffs. That feels pretty odd though, as not the common terminology of a buff.
It feels more natural to directly interact with the stats in that case, but a little weird as not really ideal for anyone to have access to stat modifications when writing entity classes as it becomes easy to make a mistake that cannot be undone.
In reality, action advances do not need to be resolved until the end of the "TurnStart" event, so perhaps being a buff and then dispelling itself is fine.
Resolve AV w/ scheduler interaction
Could instead interact with the scheduler w/ helper function to AV advance an entity. If doing this approach, entities will need to potentially have access to a scheduler which holds them. I am not really a fan of that design and not familiar w/ any type of design patterns where that is super common (maybe client / server designs where server keeps track of client, but these are usually outside of a program). This means AV will be outside of an entities stats and cannot be modified directly. Guess that is fine, as action advance / delay is currently the only AV interaction.
Compared to the buff approach, never have to worry about self-dispelling buffs other than ones that expire at the end of an entities' turn. That might make this a little more ideal. In addition, if trying to de-couple HSR from the generic sim framework (which I might start doing), that allows entities to all tie into the scheduling side of things without it being game-specific.