playMaker

Author Topic: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups  (Read 4212 times)

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Hi all :)

I've been prototyping a hot-air balloon sim over the past few weeks, built entirely with Playmaker. It all works really nicely, except I've had this issue I mostly ignored as I thought it was probably just a simple fix and would work itself out in time. But as I decided to look deeper into it the past few days, I seem to have found the culprit.

I posted a very indepth explanation of what is occurring on the TIGSource Forums (https://forums.tigsource.com/index.php?topic=57603.0) yesterday, but at that point hadn't made the key discovery, so I won't replicate it all here.

My balloon is constructed from rigidbodies and joints, with AddForce used to apply vertical and horizontal movement. The player can move around inside the cabin during flight. The problem is that occasionally, but consistently, the balloon seems to glitch or jump, the physics go wonky for a brief moment, and the player is suddenly outside of the balloon, falling.

Looking at the profiler, I've identified that this glitch always occurs during a huge spike associated with FsmLog.LogEvent()/GC.Collect, ranging from 40ms to as high as 250ms. This occurs roughly every 20 seconds, though sometimes more frequently. In the frame immediately after the spike, the Physics section of the profiler notes that about half of the active rigidbodies become inactive, and go to sleep, and then recover in the frame after. I believe that this GC.Collect spike causes the glitch in the physics system, in turn causing the physics hiccups in game.



I read in a thread on this forum (http://hutonggames.com/playmakerforum/index.php?topic=5180.msg24731#msg24731) that UGUI was causing similarly large spikes for another user, and I do use it quite extensively, but I've completely disabled all UGUI elements in the scene, and all the associated Playmaker FSMs, and it makes no difference. All the screenshots and videos I've posted are with it all completely disabled.

If anyone could provide any guidance as to how to fix/get around this issue, I'd appreciate it!

I've attached the key image to the post, but there's also a load more here:
http://imgur.com/a/IrBvG


Here's a video showing the player ejecting at the exact moment of the spikes:
https://youtu.be/-lnT2sLq3DY
Watch for: 0:10, 0:30, 0:50.



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #1 on: August 29, 2016, 07:04:39 AM »
Hi,

Thanks for your post :)

 Do you experience these also in builds?

In editor, can you turn off Debugging preferences ( Enable Logging and Enable DebugFlow), and see if that makes a difference. If it does, I would consider, until this spike is addressed, to leave it off during normal work, and when you need to debug using Playmaker, enable them back for the debug session only.

Bye,

 Jean


NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #2 on: August 29, 2016, 10:20:25 AM »
Hey Jean!

Thanks for the quick reply!

I tested some builds and no, it doesn't occur in builds. Disabling Enable Logging seemed to stop the spikes, and as a result, the physics glitches are gone! Good to know it wasn't something silly I was doing :)

This is a fine workaround for now! It's certainly still an issue though right? Shall I log a bug or something, or will you guys look into it?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #3 on: August 29, 2016, 02:18:46 PM »
Please submit a bug report to help us track the issue. We should be able to optimize logging in the editor some...

Thanks!
Alex

NateGallardo

  • Playmaker Newbie
  • *
  • Posts: 31
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #4 on: August 29, 2016, 03:29:59 PM »
Brilliant, will do. Thanks both :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #5 on: August 30, 2016, 05:02:08 AM »
Hi,

 yes yes, this is still an issue :) I just wanted to find a work around for now so that you can still enjoy dev and avoid this issue until the glitch is addressed.

 Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #6 on: September 29, 2017, 11:24:10 PM »
Hi,
I know a new Playmaker update reduced the Logging's Performance Consumption, and I'm using the latest updated Playmaker. I noticed that the SubFSMs which created by RunFSM Action still got the Annoying Logging Performance Problem. I'm sure I turn off the debug log in Playmaker's Setting, and I got a clean unity window layout with only Profiler and Game open. So this Issue is not completely solved.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FsmLog.LogEvent() / GC.Collect causing game-breaking physics hiccups
« Reply #7 on: October 12, 2017, 04:00:13 AM »
Hi,

 Could you fill a bug report on this so we can keep track of it? thanks :)

 bye,

 Jean