playMaker

Author Topic: How to best send many Events sequentially?  (Read 915 times)

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
How to best send many Events sequentially?
« on: June 02, 2018, 11:46:55 PM »
So currently I'm trying to make a card game mostly for the fun of it. I need to devise a system that allows cards to resolve their effects in the order in which they're played. Currently what I have planned is some FSM that uses Get Array List Next (using ArrayMaker to store all the cards in Array Lists) to send an event to each one in sequence whenever anything (card is drawn, creature is summoned etc.) occurs.

The issue with this is that...
1) It's a lot of looping. It would need to loop through every relevant card in the scene many times throughout a turn. Whenever I would introduce a new mechanic for example (a search), this system would now also have to send a "search" event to every card in the scene if I ever wanted to make a card that responded to searches.
2) If two+ cards respond to an event, then they would go off doing their own thing without waiting for anything else to finish. To avoid this I need each card to respond BACK to the looping FSM so that it continues going through the cards only when the receiving FSM finishes it's job.

So basically, is this strategy a good way to go about this? Is there an easier, more efficient way? To put it simply, I need a way for cards to respond to whats happening in a sequential manner.
« Last Edit: June 03, 2018, 12:31:43 AM by MikeTelly »