playMaker

Author Topic: Advanced versions of functions slower than normal versions?  (Read 1836 times)

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
I was messing around with Float Operator and Float Operator Advanced and noticed a case where Float Operator was late to do it's calculation when other actions in the state needed to use the resulting variable. Using the action sequence fixed this issue, but when I looked into the code for each, Float Operator Advanced doesn't even have an OnEnter function (meanwhile Float Operator does). Is this intended? Slowly learning coding so this may be a stupid question.

Plancksize

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 75
Re: Advanced versions of functions slower than normal versions?
« Reply #1 on: July 27, 2018, 09:13:12 AM »
Interesting.

I took a look into that action and got to say that more than the lack of an OnEnter, what confuses me there is the use of: "OnActionUpdate()"

I had no idea of that instead of just OnUpdate() and can't seem to find any clue about it on the wikis.

Is OnActionUpdate() the same as OnUpdate() or something more, thus the no need for OnEnter?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Advanced versions of functions slower than normal versions?
« Reply #2 on: July 27, 2018, 09:21:42 AM »
Hi,

 the reason is the following:

 the advanced version lets you choose between the types of Updates,

- Update
- Fixed Update ( for physics)
- LateUpdate ( ie for camera looking of following  physics)

OnEnter can not guarantee that the operation will processed exactly how the developer wanted it, so it will only be executed within the selected update context.

it should not affect logic, as each action calls Finish() in its code which is the way to tell the State that it's done with its task.

so it's not slower or faster, it's call at a different time in the update cycle.

Indeed, sequential state is a good way to solve this. but probably in your case you may not need to the use the advance action right?

 Bye,

 Jean

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Advanced versions of functions slower than normal versions?
« Reply #3 on: July 27, 2018, 12:09:58 PM »

Indeed, sequential state is a good way to solve this. but probably in your case you may not need to the use the advance action right?

 Bye,

 Jean

Ya regular Float Operator works fine without setting the state to Action Sequence. It's just I was expecting the Advanced version of the action to do what regular Float Operator does, but just with more options. It's a shame that isn't the case.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Advanced versions of functions slower than normal versions?
« Reply #4 on: July 28, 2018, 12:28:09 PM »
Hi,

 you could easily modify it so that it does, I could give you an quick example if you want.

maybe you could also send me a test case so that I witness the difference, that will help, maybe there is something I can fix.

 Bye,

 Jean

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
Re: Advanced versions of functions slower than normal versions?
« Reply #5 on: July 30, 2018, 09:20:01 PM »
Hi,

 you could easily modify it so that it does, I could give you an quick example if you want.

maybe you could also send me a test case so that I witness the difference, that will help, maybe there is something I can fix.

 Bye,

 Jean

Honestly I'd really like to know how to create a lot of Fixed Update versions of other actions. I just tried to create one for Set and Get Property, as well as Set FSM Float. They contain "public override void OnUpdate()". When I simply switched OnUpdate for FixedUpdate, I was given an error. Only when I deleted the overrride part did the error go away, but now the actions don't actually work.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Advanced versions of functions slower than normal versions?
« Reply #6 on: July 31, 2018, 03:44:05 AM »
Hi,

 yes, the action is an override, it's using another class that handles the logic of letting the user choose which type of update.

If you want to create an action that only need fixedUpdate, look at: AddForce

Make a copy and trim it down, I always do that when I create a new action, I never start from scratch, instead I take an existing one, modify it and copy paste from other actions all the bits I need ( I have a bad memory for all apis... so I just look on other actions everytime)

 Bye,

 Jean