PDA

View Full Version : Adding a state machine...



ianmward
June 19th, 2014, 10:03
Hi all,

I see many places where it would be really beneficial to maintain state and run through a process when playing and am wondering if it makes sense/ is possible to implement an extension to provide a state machine/ mini workflow.

Examples are everywhere, especially in Shadowrun. E.g. Combat,
Attacker targets an adversary,
Calculates range and other modifiers.
Defender decides if they want to go full defense
Attacker rolls attack dice and calculates #hits
Defender rolls defense dice and calculates #hits
Determine if hit (attack hits-defense hits >0)
Defender rolls armour dice and calculates #hits
Defender applies damage if necessary...

It would be good to be able to have a window with the steps and a riunning total of the hits.

I think it may be possible (if not easy) to make a generic extension that can be instantiated with a list of states, action comments and actors (current actor or target, perhaps) then be able to update the state when things happen, e.g. Attacker rolls attack dice.

Obviously it's much more complicated than it seems, but could be really useful...

Comments please....

Ian

viresanimi
June 19th, 2014, 14:16
I find this an interesting idea. No clue how to make it though

Vires Animi

Trenloe
June 19th, 2014, 15:57
FG has a lot of events being triggered within the UI as a whole and it's possible to write event handlers for most (but not all) of these events so doing something like this might be possible. However, I would say that FG is designed to be very flexible and each ruleset can do things a little bit differently (although the rulesets layered on top of CoreRPG will do the base things the same, just not the game specific things). Also it's possible for different players (all at once) to target, remove targets, add multiple targets, change the targeting source, apply modifiers, remove modifiers, apply effects, etc. at will so keeping track of all of the events without a certain click breaking the state machine might be pretty complex.

You's also need to keep the state machine persistent (in the FG campaign database) so that it would come up in the same state from one session to the next).

Take a look at some of the event handlers within the FG reference doc (they usually are named on<Name of event>) and also the ruleset modification guide for some base info on how the code in the background hangs together:

https://www.fantasygrounds.com/refdoc/
https://www.fantasygrounds.com/wiki/index.php/User_Guides

Also this thread might help get you started: https://www.fantasygrounds.com/forums/showthread.php?20651-Modifying-the-CoreRPG-ruleset

lokiare
June 20th, 2014, 11:49
FG has a lot of events being triggered within the UI as a whole and it's possible to write event handlers for most (but not all) of these events so doing something like this might be possible. However, I would say that FG is designed to be very flexible and each ruleset can do things a little bit differently (although the rulesets layered on top of CoreRPG will do the base things the same, just not the game specific things). Also it's possible for different players (all at once) to target, remove targets, add multiple targets, change the targeting source, apply modifiers, remove modifiers, apply effects, etc. at will so keeping track of all of the events without a certain click breaking the state machine might be pretty complex.

You's also need to keep the state machine persistent (in the FG campaign database) so that it would come up in the same state from one session to the next).

Take a look at some of the event handlers within the FG reference doc (they usually are named on<Name of event>) and also the ruleset modification guide for some base info on how the code in the background hangs together:

https://www.fantasygrounds.com/refdoc/
https://www.fantasygrounds.com/wiki/index.php/User_Guides

Also this thread might help get you started: https://www.fantasygrounds.com/forums/showthread.php?20651-Modifying-the-CoreRPG-ruleset

What would be real useful would be a search box on the reference document pages. Since google and www.startpage.com can't parse that particular web page format.

Zeus
June 21st, 2014, 23:00
Hi all,

I see many places where it would be really beneficial to maintain state and run through a process when playing and am wondering if it makes sense/ is possible to implement an extension to provide a state machine/ mini workflow.

Examples are everywhere, especially in Shadowrun. E.g. Combat,
Attacker targets an adversary,
Calculates range and other modifiers.
Defender decides if they want to go full defense
Attacker rolls attack dice and calculates #hits
Defender rolls defense dice and calculates #hits
Determine if hit (attack hits-defense hits >0)
Defender rolls armour dice and calculates #hits
Defender applies damage if necessary...

It would be good to be able to have a window with the steps and a riunning total of the hits.

I think it may be possible (if not easy) to make a generic extension that can be instantiated with a list of states, action comments and actors (current actor or target, perhaps) then be able to update the state when things happen, e.g. Attacker rolls attack dice.

Obviously it's much more complicated than it seems, but could be really useful...

Comments please....

Ian

Not sure I'm following this request. I think what your describing already exists in the form of the Combat Tracker window in some of the more advanced rulesets (SavageWorlds, D&D 3.5E/PF/4E/5E etc etc.). The CT window does pretty much what your describing with the exception that all the reporting is made through the chat window. The state of each actor is persistently stored as part of the campaign database.

lokiare
June 23rd, 2014, 08:19
Not sure I'm following this request. I think what your describing already exists in the form of the Combat Tracker window in some of the more advanced rulesets (SavageWorlds, D&D 3.5E/PF/4E/5E etc etc.). The CT window does pretty much what your describing with the exception that all the reporting is made through the chat window. The state of each actor is persistently stored as part of the campaign database.

I think they are talking about a window that pops up on the appropriate players screen asking if they want to do something after an attack targets them.