Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Red on December 17, 2013, 05:51:27 PM

Title: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 05:51:27 PM
I've had some issues occur with the systems I'm working on... And I'm at a total loss as to why this is even happening.

What I have is as follows (and I'll post screenshots below)

I have the setup system for my game reaching into the mesh object to fetch the effects objects and the mesh objects of the various weapons that each character class and mesh object have... So, a machine gun or grenade... an RPG or a handful of shuriken... that kinda thing.

But there seems to be some issues here. The system is using the Get fsm actions and the set fsm actions to connect the mesh/fx objects with the mechanisms that use them... BUT... it is only working when I put a breakpoint in there.

I've tried with a wait, no dice... With a next-frame-event, still nada... But when I put a breakpoint in the state after that (so as to break it when that state is finished functioning) and resume the game in Unity, only then does it seem to work.

I'm running up against a brick wall here trying to figure out what's going on but the debug systems aren't really reporting when they fail to trigger the action

Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 06:51:29 PM
I tried adding in a more dynamic system to address this issue... more screenshots below.

The issue is still happening... It's as if the Set FSM actions aren't completing in time before the state goes to the next one.

So, I guess this then begs the question... is the finished action firing off prematurely? So far it's either that or the action itself isn't working as expected every time.

If you have any suggestions on how to troubleshoot this, I'm all ears.
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 17, 2013, 06:55:48 PM
Have you tried firing a special event rather than the system FINISHED?
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 07:21:56 PM
Yeah...  :-\  Both with a next frame event and a wait to trigger the transition to the next state.

So, I guess if this behaviour is occuring regardless of it being a finished or custom transition, that leaves the issue seeming to be from the Set fsm action itself.
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 17, 2013, 07:51:11 PM
Have you tried making those states Action Sequences with a Next Frame Event on the end? (gear icon uppermost right)
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 08:37:47 PM
Yes... Though what does that mean? (couldn't find anything in the help files that even explains what's inside that little menu.)
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 17, 2013, 08:54:56 PM
Action Sequence forces the sequence of actions to complete each one before moving to the next action or finishing.

Hmm, sequencing is definitely my first guess but the whole working when using breakpoints is really weird. If it's absolutely always when using Set FSM Game Object then that would be my next guess but I've yet to have any trouble with it.

Should the FSM target name be "Handgun/Mechanism" ? It looks like you may be stacking FSM names but I don't see the / character. I can't quite see how the logic completely ties together but it looks like with all of that hierarchy and interchanging data you could be failing the Set FSM Game Object with a bad name and having some other logic somewhere else that recovers or creates something from other shared data? I had some pretty weird results when doing the shop with a similar setup, accounting for all events filling the variable, then backchecking names, variables and events at runtime helped find any mistakes I had.
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 09:04:58 PM
well, the naming of the FSMs themselves was changed from "(weapon name) Mechanism" to simply "Mechanism" so that I could clear up any issues with it mistaking the name or missing something.

Backchecking... I know that I'm really showing my noob-ness with that, but is that meaning a way, once the data is supposed to have been passed, of going back and doing the system over again if it messes up?
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 17, 2013, 09:15:31 PM
well, the naming of the FSMs themselves was changed from "(weapon name) Mechanism" to simply "Mechanism" so that I could clear up any issues with it mistaking the name or missing something.

Backchecking... I know that I'm really showing my noob-ness with that, but is that meaning a way, once the data is supposed to have been passed, of going back and doing the system over again if it messes up?

I just meant that checking back across your FSM's that are related to see if there were any possible naming errors or odd-ball object assignments. If you're certain it's all good man I don't know whats going on there. I still feel skeptical that its related to the action since I've used it thoroughly for the same thing without any trouble.

Maybe Jean will have some ideas.
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 17, 2013, 10:05:05 PM
Yeah, I'm about as mystified as you are.

It's the whole breakpoint thing that's really making my head go wonky trying to figure it out.
Title: Re: Get/Set FSM actions... issues abound.
Post by: jeanfabre on December 18, 2013, 05:31:47 AM
sigh :)

I like the "Maybe jean will have some ideas"   :P  pressure is on now!

Ok. yes, your issue is odd. when I have this problem, I put debug logs right inside the actual actions themselves... not good for all of you that don't know how to script... sorry.

@Red: can you do that? when I am think I am sure an action should be called but is no, I put a breaking next to the line that should be performed, and then I see if this action is called indeed, and if it is, what values it holds truly. You may have conflicting fsms, I see a lot of disabled actions, I never leave any disabled actions in my fsm, never, so that could be a potential issue here.

Also, I would already completly stop everything if using a manual send event or next frame event would not work. Create your own event like "DONE", and don't rely on the built in "FINISH", and don't call "FINISH" manually, refrain from doing so, it's confusing.

also, can you isolate the offensive state? and see how it performs on its own? create a new scene, and have this state only as the start state and form around it the same data setup you have and see how it performs.

the key here is cut down on the potential issues surrounding this state and actions. so the worse scenario is to work on a copy, and take down features one by one, I mean lietterly delete them until the problem disappear and then you know the problem was in your last deletion ( or at least related).

bye,

 Jean
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 18, 2013, 07:49:20 AM
sigh :)

I like the "Maybe jean will have some ideas"   :P  pressure is on now!

haha, sorry man ;)
Title: Re: Get/Set FSM actions... issues abound.
Post by: jeanfabre on December 18, 2013, 08:28:46 AM
  :-[

No worries, I was joking.

Bye,

Jean
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 18, 2013, 11:54:04 AM
well, fresh scene with only the player object (and a cube for it to walk on and a plain camera) and the behaviour still persists. (including the breakpoint thing)

As for reaching into the code, I'm not totally sure I'm doing it right but I copied the line LogWarning("Could not find variable: " + variableName.Value); and removed the variable at the end and changed the "Could not find variable" into "success" and "null."

(Though, when I did that, monodevelop asked me if I wanted to convert some line endings. I clicked the convert one time, didn't seem to cause issues... reloaded playmaker from the asset store and tried it with the "keep" option, didn't seem to cause issues... I'm going to try and re-install playmaker to test if simply adding a space (So as to trigger Monodevelop's "save" button) will do the same thing.

But when I made those changes, it reported that it went through successfully (and the behaviour is still persisting.)
Title: Re: Get/Set FSM actions... issues abound.
Post by: jeanfabre on December 19, 2013, 02:25:14 AM
Hi,

 Can you send that test scene over? and I'll try to replicate and pin point the problem.

bye,

 Jean
Title: Re: Get/Set FSM actions... issues abound.[SOLVED]
Post by: Red on December 19, 2013, 11:11:26 AM
Thank you. I'm exporting it as I am typing this.

I'll be sending you a dropbox invite for where you can find the package... you're going to have to create a global int and feed that to the "Character Switch" in the Setup system but other than that that's all you will need to do (since I haven't yet gotten the knack for exporting global variables quite yet... though, to be honest that's more for lack of trying since I've been up to my neck in the later stages of development for this game.)

I'll be sending it to the address that we used to communicate for the Arraymaker tutorial plans.

p.s. the breakpoint should be there in the package but if it's not, the breakpoint goes on "FX (3)" in the "Setup" fsm. It's also reproducing this issue in a fresh project...
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 19, 2013, 06:54:12 PM
Out of curiosity, would Unity's profiler help in tracking down what's causing this issue to crop up or is that something it'd not be able to do? Asking since I'm using the indie version (and as such have no experience with the profiler.)
Title: Re: Get/Set FSM actions... issues abound.
Post by: jeanfabre on December 20, 2013, 03:16:56 AM
HI,

 no it woul dnot help, profiler is to watch for performances, not for bugs really.

bye,

 Jean
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 20, 2013, 03:53:15 PM
Aaaah, okay. Thank you!

I've been mulling it over and I'm wondering if the reason it's showing up with the breakpoint could be because when the breakpoint is called, it's giving the actions some more breathing room before the next one fires off? I mean, since this system I have set up relies on successfully fetching an object from a game object variable I have to clear it at the start of the next step... So, when the action isn't hosting a breakpoint the "set FSM" is able to complete it's task before continuing to the next state?

I'm going to keep working on this one though just in case but if you see anything in the file I've sent you the link for be sure to let me know!

Thanks!
Title: Re: Get/Set FSM actions... issues abound.
Post by: Red on December 20, 2013, 04:44:31 PM
*facepalm*

Found the bug... totally a user error here (though it doesn't answer why it would be intermittent based on whether the breakpoint was in there or not)

edit: It's terribly embarrassing on my part too because the data was being transferred over but on the "activate" phase, the FSMs that handled the mechanism were reaching into the state I should have been sending the data to (instead of the mechanism itself) and since the state that should have been holding it but wasn't was empty, it was over-writing the object data with nothing.
Title: Re: Get/Set FSM actions... issues abound.
Post by: Lane on December 20, 2013, 08:46:09 PM
Ha! Oh man, if I had a cookie for every time I did something like that I'd be John Candy by now.

Anyway, glad you got it sorted. Everybody makes those errors :P