playMaker

Author Topic: Problem with sequencing actions [SOLVED]  (Read 3222 times)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Problem with sequencing actions [SOLVED]
« on: August 01, 2018, 06:54:19 PM »
Do PlayMaker use some kind of  co-routines or something?
I'm facing the situation when I should use a pause for couple of seconds between two actions to execute them right.

Let me explain. I'm using MegaFiers for driving the BlendShapes. So I use two actions:
1. Set Morph (custom action by Jean, may he live long and prosper);
2. Simple Set Property on megafires script to disable further calculation;

It only works when I set a 1-2 second pause between this actions. Chris (the author of MegaFiers) assure me, that if he run this two commands from script - they works without any pause, one after another. Maybe there is something happen on the PlayMaker side?

I know that Call Methods and Set Property is not the best approach and it's better to use custom actions, so maybe something goes wrong here?
« Last Edit: August 08, 2018, 09:38:35 AM by nFighter »
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Problem with sequencing actions
« Reply #1 on: August 02, 2018, 03:16:57 AM »
Hi,

 in the very same state one after this other? and is your state set to sequencial or not?

have you tried with a next frame event and have two states?

 Bye,

 Jean

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #2 on: August 02, 2018, 10:15:13 AM »
I checked both ways: sequential in one state and two states.
The only way it works - having a Pause between the actions.

PS. Usually i'm happy if somethings works and don't dig a lot to find a better solution, but I'm afraid this approach could fail on a slow machines (how much time it really need, is 1 sec enough for everyone?) and there is no way to prevent it.


« Last Edit: August 06, 2018, 09:07:18 AM by nFighter »
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #3 on: August 06, 2018, 06:47:31 PM »
OK, guys. Something definitely happen with the actions execution timing. I have a moderately complicated graph with floats math, read/write from the Array Lists and so on... But the results is a 6 floats. It works only if I turning on toggle breakpoint (and manually press unpause then) OR add this weird Wait (on the picture). Without this tricks the results is not relevant.


PS. For now it's a part of a complex FSM system and I can't reproduce the bug in the separate file, but I'm working on it. Will keep you informing with my progress.

PPS. Please, pay attention to the first bug I mention in this topic. As I understand, that's definitely not how the things should work and I'm afraid it could lead us to the errors in other cases.
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Problem with sequencing actions
« Reply #4 on: August 07, 2018, 08:01:13 AM »
Hi.
Have you tried in a build?

How are you setting the weight values?

Have you also tried a next frame event?

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #5 on: August 07, 2018, 10:40:01 AM »
Got the same broken results in a build either.

It's a sequence of array list get/put and some simple math with adding and multiplying. Got the broken and unpredictable results all the time, unless I put wait 0.01 to every state with array list action.

I suspect that Finished event fired somewhere in the middle of Array List action executing. And it looks like actually the same problem as the MegaFiers graph from my first post.

What's next frame event?
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Problem with sequencing actions
« Reply #6 on: August 07, 2018, 01:15:05 PM »
Hi.
Next Frame Event will wait for the next frame to continue.

Try making a state before set power and place the next frame event there.

Can you show more from the fsm?

Are the variables global?

I remember i had an issue like that with my Tetris sample,
The reason was that i was moving 2 directions (move left, check if something is in the way, if so move back) in the same frame.

This is not a PlayMaker bug tho, it has to do with unity.

miguelfanclub

  • Full Member
  • ***
  • Posts: 165
Re: Problem with sequencing actions
« Reply #7 on: August 07, 2018, 01:20:01 PM »
I also have this. A lot.

In  order to know one action  happens after the other i just have to deal with a "busy" global boolean that i have to check every frame on  every fsm that is waiting to another to finish.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Problem with sequencing actions
« Reply #8 on: August 07, 2018, 02:29:14 PM »
Hi.

If you set sequence 'on', each action in a state will finish before the next one will start.

can you show your setup or can you repo this in a new project, so i can have a look.
(or you can pm me a link to your project)

miguelfanclub

  • Full Member
  • ***
  • Posts: 165
Re: Problem with sequencing actions
« Reply #9 on: August 07, 2018, 03:06:21 PM »
@djaydino

Yes, but what about if one of those actions is firing a "send FSM event". What will happen after the event has been fired and a second FSM is doing stuff. Will the first FSM that is "sequenced" wait until second FSM has done everything?
Answer is no and there is no way to control what happens after that.


nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #10 on: August 07, 2018, 03:40:17 PM »
I don't want to over-complicating this thread with details, but maybe you could see something wrong with a fresh eye. In fact my FSM is a sequence of almost the same actions. That's how it works:
1. run template FSM with adding points
2. this template apply some math and record the results in a HashTable.
3. read this HashTable.
4. run template once again and so on...



indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #11 on: August 07, 2018, 03:43:27 PM »
I'm going to check if the next frame will help.
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Problem with sequencing actions
« Reply #12 on: August 07, 2018, 04:17:14 PM »
Gotcha! Next Frame fixing the situation exactly as a Wait trick. You were right, that was the reason! Thanks a lot  ;D ;D ;D
indie developer of multiplayer adult fighting
http://nakedfighter3d.com