You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any action that is not instantaneous/uninterruptable* should be queued as an Activity that can be interrupted, paused, and resumed later.
Most activities will be 'active' and be at the front of the queue, so the creature will be processing that specific activity, however there should be support for 'passive' activities like eating while crafting, refuelling a fire, or being aware of other creatures in the vicinity.
All activities should process a single turns worth of actions, then yield back to the manager which will either invoke a passive handler and possibly consuming a turn, or call the activity again for another turns worth of actions.
Passive actions can possibly not require a full turn to process, an example would be passively checking for monsters, this would be treated as a 'free' action; Eating/drinking on the other hand would be considered a multiple-turn action of it's own and interrupt the current activity satisfy the players needs.
To allow for that, activities should support a Priority system, so that checking for monsters is highest priority, eating/drinking is below it, refuelling fire is next, then finally the current activity. This allows multi-turn passive activities to 'block' the current activity until they are finished.
Activities should be pushed into a queue that belongs to each creature with at least the following:
Add an ActivityInfo to the queue, yielding a unique key for that activity
Investigate the contents of the queue
Process a Current activity, calling the given activity for progress & time left info.
Remove an activity either by reference to the ActivityInfo or the unique key
The Activity queue for a creature should be serialised alongside it's other data to allow resuming tasks across sessions. With pre-checks this would allow storing work bench activities on the player with situation requirements for resuming later.
Activity handlers should:
Be able to give an estimate for the task be taken (where possible).
Register their requirements as they change.
Process the activity on a per-turn basis.
That is, the activity should yield back to the calling function per turns worth of activity.
Be interruptable.
Be resumable/restartable.
Basic implementation should be a simple subclass and method overriding.
Probably very few actions take <1 turn?
The text was updated successfully, but these errors were encountered:
Any action that is not instantaneous/uninterruptable* should be queued as an Activity that can be interrupted, paused, and resumed later.
Most activities will be 'active' and be at the front of the queue, so the creature will be processing that specific activity, however there should be support for 'passive' activities like eating while crafting, refuelling a fire, or being aware of other creatures in the vicinity.
All activities should process a single turns worth of actions, then yield back to the manager which will either invoke a passive handler and possibly consuming a turn, or call the activity again for another turns worth of actions.
Passive actions can possibly not require a full turn to process, an example would be passively checking for monsters, this would be treated as a 'free' action; Eating/drinking on the other hand would be considered a multiple-turn action of it's own and interrupt the current activity satisfy the players needs.
To allow for that, activities should support a Priority system, so that checking for monsters is highest priority, eating/drinking is below it, refuelling fire is next, then finally the current activity. This allows multi-turn passive activities to 'block' the current activity until they are finished.
Activities should be pushed into a queue that belongs to each creature with at least the following:
The Activity queue for a creature should be serialised alongside it's other data to allow resuming tasks across sessions. With pre-checks this would allow storing work bench activities on the player with situation requirements for resuming later.
Activity handlers should:
That is, the activity should yield back to the calling function per turns worth of activity.
The text was updated successfully, but these errors were encountered: