Memory Leaks: Removing Locations, suggestion?

Dangime

New Member
Reaction score
1
Hello, I've been working on my map Civilization Wars and people have started asking that I address memory leaks. I really had no clue on what they were so I read up on them here first, and I believe I have removed my unit groups movement memory leaks. What is more complicated is my point leaks from creating units.

My unit spawn triggers are based off the "unit finishes construction" or "completes an upgrade" event. I have a feeling the coding is really bad for memory here, but it all works for now.

It checks conditions to see who made it, then starts a loop.

It waits until the unit is alive, checking every 30 seconds (don't want dead spawns making units).

It waits until the spawner type matches the desired spawner type (don't want upgraded spawners making old units still)

It waits until "spawn gate" a bool, is true, so it spawns at roughly the same time as the other spawners.

It waits 30 seconds, the desired time between spawn intervals.

Finally it makes the desired unit at the position of the triggering unit (the spawner)

Then it all loops around again.


So from that background, two questions:

1) Is having a loop end with a "wait" command that's never going to be satisifed (say, a spawner is killed and will never be 'alive' again.), detrimental to game play?

2) What is the best way of getting rid of the point leeks in this event? Hopefully without having to redo all 50 some odd events for the spawners? I'm afraid that if I use a temporary variable it will lose its meaning through the various loops when other new spawners are built, then units would start appearing in all sort of places they shouldn't.

Would making an array of location variables (say maybe up to 600 as a absolute max that might be possible) is itterates and assigns the location to the array, then assigns an interager to the spawner in a paraell array be better that whats happening now?

I mean, then at least I would only have as many locations as I do spawners, and not a new set of locations that can't be destroyed every 30 seconds right? Any advice is appreciated.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top