Disabled Groups taking CPU?

  • I have code that disables enemy groups that aren't being used (I'm checking if the SpawnEnemy.UID exists for each enemy, and then if it does NOT, it disables the group). However when I look at the debugger, it's still taking up ~0.2% cpu. I know that doesn't sound like a lot, but I have probably ~30 enemies and will likely have 30 more soon, so it's starting to add up. Is there a better way I should be doing this?

  • Don't you think it's the "enabled" enemies that are taking up more cpu than the dormant ones?

    Either case you might want to create a destroy and create system where you destroy objects outside the viewport and re-create instances at their respective spots.

    Are you using mutiple spawners in your layout? If so you can destroy enemy when exiting layout and save its respective properties (health, magic...) in its spawner and only destroy the spawner as well if the enemy reaches 0 HP. This way, you don't end up with some

  • MPPlantOfficial - no there are only ~3-4 active enemies per layout, and those are still only pulling 0.2-0.3% each. I'm beginning to think it's not actually disabling the group for some reason. It's calling the enable / disable group at the start of layout only, too.

    My hierarchy is "if enemyspawn.UID exists, For each enemyspawn, create enemy"

    Else

    Disable group

  • If uid exists doesn't sound right. As well as the for each.

  • newt - the for each is due to multiple instances of the same enemy type. The UID check is to find out if that enemy exists in the layout.

    What would you suggest?

  • enemyspawn.count

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • newt - yeah as usual that's a better idea . I'll give it a try. Thanks!

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