playMaker

Author Topic: Debugging by-frame  (Read 4124 times)

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Debugging by-frame
« on: June 27, 2013, 07:24:43 AM »
Example:
(you are only to understand the complexity, the example is not important or real)

**** EXAMPLE START ****

Game Object A
is to be placed according to the result of
Raytrace X mixed with Raytrace Y and added the computation of Game Object B

Raytrace X: Fired every frame
Raytrace Y: Fired when Game Object C, a child of Game Object A is colliding
Game Object B is averaged from the path of Game Object A

... Or something..

**** EXAMPLE END ****

Now, we have a lot of different inputs and calculations, and each need to happen in the right order, spread over actions and Game Objects.

One can place "Next frame event" several places, and some actions might start over.. You can toggle Debug/Breakpoints, but this does not provide a clue to what is happening in the other actions, how many times a routine was run elsewhere.

RESULT: It's impossible to see what happens in what frame, and in what exact order. So really making a smooth "you touched here, so in the next frame we move that one there, and move you to.." kind of optimizing is not doable.

Sometimes a smooth camera is flickering, sometimes a raytrace from previous frame is used as "the latest" etc.

SOLUTION:

A Debug Mode where a simple list of "What happened in the previous frame" is shown.

Alone what actions are fired in what frame would be awesome, but of course more details like variables value would be welcome.

Imagine just 10 lines like this:

FRAME 0084:
Game Object A: State: "Calculate" Event " No" State: "Move"
Raytrace X: Fired
Game Object C: State: "Idle"

FRAME 0085:
Game Object A: State: "Move" Event: "Finish" State: "Move"
Raytrace X: Fired
Raytrace Y: Fired
Game Object C: State: "Collided"

and so on.

Of course this would slow down actual runtime, but as an optional debug mode to switch on and analyze, it'd create a REALLY valuable insight and a tool to see what is actually going on, and maybe move some calculation from one Game Object to another, so things happens in the right order.

Cheers :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Debugging by-frame
« Reply #1 on: June 27, 2013, 03:06:20 PM »
Hi,

 yep, I totally see what you mean, and I do many times whish for that kind of overview. The Fsm Logs as powerfull and incredibly useful as they are, lcak of this shift of perspective.

For this, the BEST way so far is to output logs... ouch...if you have no problem with scripting, then that's ok. I usually actually edit playmaker action themselves, to put debug logs right there at the core of the various actions I want to debug ( not the action, but the flow, because actions are fine most of the time, it's the process that fails to be designed properly).

Also, I do tend to take the time to properly work with Playmaker logs. despite what I said above, you can get an overview of what happened last frame, only you have to imagine the boundaries and know when it started using time stamps, and when you navigate between fsm logs, always check the time to make sure you are still within the time of your frame.

Also, in many cases, the solutions was to refactor. If your flow is bad, takes different approaches. I often starts from scratch several times on even simple things like dragging, delta processing and other similar brain dead situations... By refactoring, it sometimes means doing less per states, which always makes it a lot clearer visually and when debugging. most of my states never reach more than 3 4 actions. after that, It usually becomes impossible to debug if it doesn't perform properly straight away...

And also, try to isolate each of your core features, and double check they all performs correctly on their own, and rebuild/renabled each core one at a time to not get overwhelmed.
bye,

 Jean

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: Debugging by-frame
« Reply #2 on: July 07, 2013, 07:55:26 AM »
Thanks for the tips - great, agree, have done, am doing :)

So.. erh.. no history of actions in previous frames then?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Debugging by-frame
« Reply #3 on: July 09, 2013, 03:17:41 AM »
Hi,

 I don't think so, never come across such view of history flow.

bye,

 Jean