playMaker

Author Topic: Some good FSM practices for optimal results [Discussion]  (Read 55 times)

mrminico

  • Junior Playmaker
  • **
  • Posts: 58
    • View Profile
Some good FSM practices for optimal results [Discussion]
« on: August 12, 2018, 04:38:36 PM »
Hi Everyone,

Today I was making a sprinting system that has a lot to do with input axes and I ran into a bunch of FPS issues out of a newbie mistake I would make in my earlier days of using playmaker. I found a clever way to fix my issue and thought I'd make a discussion on some of the methods I used that helped me get the most optimal results. I hope this thread will help others searching for ways to make optimal FSM's and I'd like for the playmaker veterans to also give us their wisdom on anything I may not know ;D

Now I'm no programmer but I am aware that as much as there is good code there is also bad code and the same rules apply to FSMs.

I've been using playmaker for almost 2 years+ and here's a really short list of things I try to be consistent with:
  • Avoid calling actions on every frame in starting states unless neccessary
  • Avoid getting variables on every frame unless necessary
  • Split FSM's into smaller components it can help with referencing variables
  • Replace FINISHED event with custom event "Done" FINISHED is used systematically. I've experienced Issue with certain MATHS operations while using FINISHED.

    Example of FINISHED systematic use: (Try using wait and dont assign a finish event in the action inspector only assign FINISHED to the state transition event. It'll automatically transition over to the next state)
  • When using rigidbodies always check FixedUpdate if given the option (unity updates physics in FixedUpdate)
  • Use Add force or Set Velocity actions when moving rigid bodies

    *If you end up using translate check the fixed update option. It'll make things much smoother although it's not the most optimal option by unity standards. I hope we get better rigidbody translate action*

I'm still learning and anything I find based off my readings/trail and error I'll update this list. Now there are TONS of ways to go about making optimal FSM's. If anyone has something else that works well in practice please feel free to share I'd like to hear everyone else's opinion on the topic and what they think works best based off their experiences. :)

To conclude I have a question for the Playmaker Vets Is it more optimal to use get axis once and have "get fsm float" everyframe for other FSM states / actions to use the input value or is it the same just using a new Get Axis action?

Thanks for reading hope you all have a wonderful day or night! :D
« Last Edit: August 12, 2018, 04:40:51 PM by mrminico »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3241
    • View Profile
    • jinxtergames
Re: Some good FSM practices for optimal results [Discussion]
« Reply #1 on: August 12, 2018, 10:47:07 PM »
Hi.
It is also good to check this page :

Best Practices

mrminico

  • Junior Playmaker
  • **
  • Posts: 58
    • View Profile
Re: Some good FSM practices for optimal results [Discussion]
« Reply #2 on: August 13, 2018, 04:41:47 PM »
Thanks for the page links! :)