Playmaker Forum
Bug Reporting => PlayMaker Bug Reporting => Topic started by: LordHorusNL on December 13, 2017, 11:26:26 AM
-
I'm having some performance problems when using the Run FSM action as part of my VR system to interact with objects.
After using Run FSM/Finish FSM about a 100 times my game starts to stutter and becomes unplayable.
This does not happen when i remove the Run FSM actions and replace the templates with normal Fsm's.
This feels like a garbage collection problem of some sorts, are the template Fsm's actually being unloaded from memory when running Finish Fsm?
-
Hi.
Can you give some more information what is in the fsm
and maybe a video showing the issue?
-
Okey found the culprate! i was using one "Run Template FSM" from the ecosystem.
For some reason it does not seem to finish the templates but keeps them active, so not a playmaker bug afterall.
I'll see if this actions can be updated by the author.
-
Hi,
I am here :) run Fsm Template is tricky action ( and I don't recommend it, it's advanced, I am thinking about remove it as well...), can you tell me what you think is the problem, maybe I can do something?
Bye,
Jean
-
Hi jean
Run Template FSM is very handy because it allows me to choose the template to run as a variable (so i can change it on the fly)
What i think is happening is that the action somehow does not finish the template properly when running the "Finish FSM" action inside itself.
I think this is happening because the stutter i get from using this action seems to be cumulative, in that it gets progressively worse the more you use it.
However this is just from observation!
So if the action can be fixed, or replaced with a "Run FSM" variant that lets the user define the template as a variable. That would be great.
I was going to look into that myself today.
-
Hi,
yeah, you have a good point here, I am not cleaning up the objects:
try this ( update the method, that method already exists)
public override void OnExit()
{
if (runFsm != null)
{
runFsm.Stop();
}
fsmTemplateControl = new FsmTemplateControl();
runFsm = null;
}
let me know how it goes.
also, you can profile this and maybe you'll see the increase in memory consuption in your case that youc an then compare with this modification.
Bye,
Jean
-
Thanks for looking into this jean.
Unfortunately the fix did not solve the problem, i did find that there is a memory spike when using RundTemplateFSM that is not present when using RunFSM.
However i only see the spike when i run the action, and i have no idea if this could explain the stutter buildup i am experiencing.
(https://i.imgur.com/a6eRrMA.png)
Still new to the profiler, so not to sure what i could be looking for.
-
Hi,
ok, simply click on the spike to bring the head to that spot and check what is taking the most time in the detailed.
The problem with running fsm is that it is about instantiating something at runtime and this alwasy is a costly operation, if the timing is wrong ( likely when in your gameloop) then it becomes noticeable.
I'll run the debugger on some project that use this action too and see if I can spot this on my end.
please bump me early next week if I haven't replied... I need the bumps :)
Bye,
Jean
-
Ok, so i ran a comparison on the two actions and there seems to be a huge difference in resources used in the update call. (whatever it's called)
Note PlayMakerFSM.Update()
Run FSM
https://i.imgur.com/NQZW1BZ.png
Run Template FSM
https://i.imgur.com/UDDinwH.png
Should assigning a template at runtime be this costly? compared to in the editor.
-
*Bump*
Jean, I was wondering if you've had any time to look into this.
-
Hi,
Not yet, thanks for the bump :) Let me move that up in my long to do list :)
Bye,
Jean
-
Hi,
ok, I have found some obvious bad memory management, can you update the action from the Ecosystem, this will definitely improve the situation. I did not found anything when profiling, so let me know if that doesn't improve the situation on your end, maybe I'll need to check with your project.
Bye,
Jean
-
Thanks for the update jean, unfortunately the problem still persists.
The system is setup for VR right now, so i'll have to see if i can rework it for Non-VR and see if the problem is really with the action.
-
Hi,
Ok, keep me up to date.
Bye,
Jean
-
Hi,
I am here :) run Fsm Template is tricky action
Run FSM is a different action? And Run FSM is fine?
-
Run FSM works just fine.
Runs FSM Template seems to have some problems in certain situations.