How do I reduce the CPU load for this event group?

Just started using Construct 2? Post your questions here

Post » Wed Jun 15, 2016 3:12 am

So i'm trying to have exploration take place via probes that explore, and ive made it so whenever the amount of explored units to actually translate to a explored zone is reached, it makes a variable a RNG wherein the result decides what type of zone is granted to the player.

if im getting more than 5 zones/sec, the game falls behind and cant catch up with the exploration variables. is there a way to reduce CPU load here?

Image


also, the reason i have the original formula twice is so that i can keep a running total count while also sending off the amount to the random number generator section
B
3
Posts: 2
Reputation: 179

Post » Wed Jun 15, 2016 4:22 am

Don't calculate the same thing twice! Set ExploredUnits2=ExploredUnits. Use ELSE for your DiscoveryMod checks. It will reduce the number of tests, on average, and you'll only need the <= test for all but the first one. Do you really need to test those every tick? If not, use every 0.x seconds.
ImageImageImage
B
71
S
21
G
230
Posts: 3,687
Reputation: 128,845

Post » Wed Jun 15, 2016 6:41 am

awesome, thanks for the info. will utilize at least 3 suggestions
B
3
Posts: 2
Reputation: 179


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests