Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rbanninga on November 09, 2015, 09:00:10 AM

Title: Changed vs Update ever Frame Optimization discussion
Post by: Rbanninga on November 09, 2015, 09:00:10 AM
So I was wondering about the update every frame toggle on the various actions... And it made me think about ways to optimize needless calculations where ever possible.

Correct me if I am wrong but does it make sense to add a state in my FSM that would sit idle and only trigger to do math equations if the data has changed?

Currently I have things update every frame but there could be moments where those numbers just sit idle and don't need to be updated. So the Float_Changed, Int and other variations of the Change check could be used for exactly that type of optimization correct to reduce pointless calculations?

Thanks!
Title: Re: Changed vs Update ever Frame Optimization discussion
Post by: djaydino on November 09, 2015, 03:37:59 PM
Hi,
yes that makes sence, but do remember that Actions Like Float_Changed also checks every frame...

a better way (when possible) is to use "global Transitions" and "Send event"

This Tutorial is outdated but its a start, i will try to make a video tomorrow to explain how to use the events and Global Transitions.

Title: Re: Changed vs Update ever Frame Optimization discussion
Post by: Rbanninga on November 09, 2015, 10:27:56 PM
Using events would be the basis of the system yes. Its less intensive to check if a few numbers changed than to go through and do a large range of mathimatical calculations on them every frame when it is not required. So its just about reducing calculations where ever possible in the long run of a project to make it as lean as possible without resorting to directly making new unity scripts.

I'm doing this to see just how far visual programming can be taken. Its a relatively new field and full of bad and good practices.
Title: Re: Changed vs Update ever Frame Optimization discussion
Post by: djaydino on November 10, 2015, 03:40:46 AM
Hi,
Actually when coding in C# or Java you want to do the same, only to use a calculation when needed.

But i think you will have a better start than me. when i started i had very little knowledge about programming and made a lot of bad practices...
So it is very good that you think about those things :)

Now i even make my own custom actions what makes visual programming even more interesting :)

Be free to ask anything here, there are a lot of friendly people on the forum willing to help :D