Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio on February 18, 2018, 04:54:25 PM

Title: FSM goes through states it isn't intended to [KINDA SOLVED]
Post by: Fat Pug Studio on February 18, 2018, 04:54:25 PM
How is this even possible?

(https://s26.postimg.org/uhm9m6lzd/screenshot_143.png)

I've got a problem and started debugging, and it seems that FSM went to BOTH states from the switch.
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 18, 2018, 05:07:53 PM
As you can see, it's causing a lot of problems

(https://s26.postimg.org/3xtojtvnt/screenshot_144.png)

The ones that are ok don't have that kind of problem

(https://s26.postimg.org/8wh6ydubt/screenshot_145.png)

There's absolutely no difference between the variables and states between the good and bad object

(https://s26.postimg.org/eknhpboeh/screenshot_146.png)
(https://s26.postimg.org/sebuefeft/screenshot_147.png)

The worst thing is that it's basically impossible to reproduce because it doesn't happen on all objects, and starts happening after few minutes in-game.

Please advise, i don't know what to do.
Title: Re: FSM goes through states it isn't intended to
Post by: jeanfabre on February 19, 2018, 01:53:12 AM
Hi,

 Can you check the fsm log and the timing, Are you sure the first state was not entered twice? I know it mention 1, but I would double check.

 Is it 100% reproduceable? if so, let me know, I'am willing to try to repro locally.

 Bye,

 Jean
Title: Re: FSM goes through states it isn't intended to
Post by: jeanfabre on February 19, 2018, 01:54:20 AM
Hi

 one more thing. Are you sure one of this transition is not called from another state or as a global event? if that's the case, then it's to be expected.

 a transition can be called out of the blue by another state or fsm using send Event or similar.

 Bye,

 Jean
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 19, 2018, 03:09:40 AM
Graph show the state has been initiated (and it is, since the problem exists visibly), but debug says the state has never been entered

(https://s10.postimg.org/u4qhrse4p/image.png)

Edit 1: It still makes problems with action sequence enabled, i'll try splitting states.

Edit 2: Still no good, i'll try string compare instead of string switch.

Edit 3: Still no good.

(https://s10.postimg.org/wm6uci5bt/image.png)

The thing that puzzles me the most is why this happens only after some time from the start, not from the beginning?

I also checked the events, no callbacks.
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 19, 2018, 07:54:23 AM
This is fucking unbelievable, it must be a bug

(https://s10.postimg.org/la3fm7beh/image.png)
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 19, 2018, 08:02:34 AM
I have an idea, i am using pooling so the objects get disabled, but not the fsm's on them. When they get recycled, the FSM is not getting through states all over again. I'll try fiddling with that.
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 19, 2018, 08:54:42 AM
Ok, here's what i've done since i am using pooling. When the enemy dies, it disables all attached components, then sends an event to the special FSM (i called it "behaviour enabler") on itself which is used only to deactivate all the rest remaining enabled FSM's before despawning. All of them are set to "reset on disable". When the object appears again, only active FSM is behaviour enabler which restarts the rest of the FSM's.

But, same thing happens again, FSM's show that they have already been through some states.

For example this one. It's on an enemy that is alive, but it says it had already been through despawn state. Shouldn't it all be 0 if the FSM is disabled then enabled with reset on disable?

(https://s10.postimg.org/q4x4kdeu1/image.png)

It must be something wrong with that, otherwise all of these would be wrong or good.

(https://s10.postimg.org/l1ag9uny1/image.png)

Obviously, only the reactivated clones are making a problem. I even tried this from this topic (https://hutonggames.com/playmakerforum/index.php?topic=16358.0), copy everything to new FSM, but nothing.
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 19, 2018, 12:59:55 PM
Can this be done via actions?

http://hutonggames.com/playmakerforum/index.php?topic=3646.0

Or at least by calling the stop method from another rsm?
Title: Re: FSM goes through states it isn't intended to
Post by: jeanfabre on February 20, 2018, 02:01:26 AM
Hi,

 this is very odd. I never encountered your issue. So before we make an action for this, I'd like to be able to repro this. Fsm should never behave this way, or at least, I am still blurry on what exactly happens.

Could you wrap up a repro package or the steps to repro this. I have used pooling system before and it worked.

 Bye,

 Jean
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 20, 2018, 02:15:55 AM
Sure, i'll isolate it and strip everything else.
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 20, 2018, 05:12:57 AM
Hi Jean,

i've sent you PM with the stripped project and instruction. Thanks for looking into it.
Title: Re: FSM goes through states it isn't intended to
Post by: jeanfabre on February 21, 2018, 01:01:43 AM
Hi,

 odd, I did not get any pm :)

 Bye,

 Jean
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 22, 2018, 01:24:42 AM
Hm, can you send me your e-mail?
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 22, 2018, 02:59:32 AM
Here's the perpetrator, the FSM doesn't get reset on disable despite being marked for reset, and the rotation is being applied again on reused pool items.

(https://s26.postimg.org/gnqkas7p5/Untitled-1.jpg)

I can't imagine this being anything else but a bug.

Title: Re: FSM goes through states it isn't intended to
Post by: jeanfabre on February 22, 2018, 05:51:28 AM
Hi,

I am suspecting that the issue could be that you manually enable and disable component, and I don't think you should do that, the pooling system already deactivate the GameObject for you. I think these extra steps could be the reson of this issue ( which should not happen, but while this is studied and reproed on a simpler system, you need to progress in your game).

 so I suggest you don't manually disable enable component. Have you tried that already? When I deal with Prefabs with PlayMaker in a Pool, I always take this into account and manually reset all variables on tghe Start State, or do nothing until I get a event "INIT" that I fire from a manager that knows this instances ( the fsm that spawned it for example). Since I always do that, I never encountered this issue you are having, so maybe you could try on that prefab, starting with doing a proper reset of variables on start ( Reset on Disable, doesn't reset variables from my experience, try on a simple Fsm with an int counter, the int variable will not be set back to the default value on disable/enable).

I'll raise the case to Alex and see what he has to say about this, maybe there is something to do or to adress indeed.

Bye,

 Jean
Title: Re: FSM goes through states it isn't intended to
Post by: Fat Pug Studio on February 22, 2018, 06:02:00 AM
Hi Jean, actually i didn't manualy enable/disable components until the problem arose, that is the thing i tried in the efforts to try to reset the variables. That is the root of the problem, i see this guy also had troubles with this:

http://hutonggames.com/playmakerforum/index.php?topic=8080.0

I though reset on disable resets variable values too, and it's only logical it should, manually reverting all the local variables to blank state is nonsense, it would be good if there was an option per fsm to reset all variables upon disabling it.

But, the question still remains why the FSM shows the state has already been through if it has been reset on disabled? Is it wanted behaviour or the thing wasn't designed with pooling in mind, only classic instancing?
Title: Re: FSM goes through states it isn't intended to [KINDA SOLVED]
Post by: jeanfabre on February 26, 2018, 01:53:48 AM
Hi,

 First thing is that you have two conflicting features, the pooling system deactivate the gameobject, thus also disabling the component, and on top of that you also manually disable/enable components. I would let go on this and rely on the pooling system to activate deactivate things. This could be where PlayMaker gets confused.

I'll raise the case to Alex as to why variables are not resetted, I would also expected variables to be resetted. but I never use this feature actually. I always resort to a manual init call when I have a pool or similar feature, It alwasy gives me a lot more contorl in the end.

You are right the question remains as to why the fsm gets confused.

 Before I can submit this as a ticket, it would be good that we could extract this issue with a minimal repro case.

Bye,

 Jean