Performance Question

0 favourites
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • try to optimize your events. there's a lot of stuff that can be done easier and it just needs proper thinking.

    i've found one optimization in my code when i was doing pathfinding - instead of pathfinding for every object i've added it to family of those objects (one object can be in more families) and set stuff through pathfinding, but since my obstacles move so does map need to be regenerated, if you do that on each tick it's very very costly in performance, so in my example i put every 0.2 sec - which works good and sprites don't get stuck.

    also you can include calculating collisions for your visible window. if your layer is 10k x10k and your window is 1000x1000, you don't need collisions on other then 1000x1000. (use Is on-screen condition) . also through instance variables i control where each instance moves, (foreach enemy on screen i take his x var and find path to it and move along ) - there's really a lot of lot of optimizations to do to improve your speed.

    also try disabling collisions on all objects that don't need collision (like background sprites, static sprites that are never touched and are just aestethicly there, and others)

    also use overlapping instead on collision. (i herd it helps)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Luna - I came across something interesting you might like to know today. I implemented some new enemies to my game, and quickly found that my collisions per tick sky rocketed to ~400 on idle. This was a stage with just as many enemies and platforms as other stages (in fact, this was the only stage to have all enemies with the platform behavior OFF due to their in-game behaviors). I scoured through event sheet after event sheet disabling events, deleting objects, trying to find what I did to cause this, but EVERY other stage idled at ~20 collisions per tick except this one (and used all the same event sheets).

    So I did the only thing I could think of - created a new layout and copied every object and repasted them in the new layout, and to my very big surprise....my idle is now ~40 collisions per tick. I'm not saying this might be what's happening to you, but I find it incredibly strange. Between the two comparisons, not ONE line of code or sprite was moved or changed. I'm wondering if somehow my layout was just "corrupt" and needed a fresh coat of paint? I still have no idea, but hopefully you'll find the information somewhat helpful?

  • Thanks, yes, after some optimization i manage to get the collision down to about half

    got the CPU from 70% to 60% average

    but im still worried about NW.js 12. since for me its really bad, NW.js gets my CPU to 95% for not apparent reason.

    stuck with 10.5

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)