HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Massive amounts of units and lag...

05-01-2004, 11:39 PM#1
qwertyui
I have a problem :(

Our AoS map is a map with AoS Epic terrain and spawning system. Meaning it has four relatively narrow lanes on which massive amounts of units duke it out between each other.

At times, the amount of units active on the map at the same time went over 1K :\ . All of them fighting, moving, trying to find their ways around obstacle, spawning and dying.

Naturally, it created a lot of lag problems.

At the moment, we hard-capped the amount of units that any side can have at 400, meaning that no additional units will spawn after that limit is reached and until the side sustained enough casualties to bring this number below 400.

However, we feel that the problems with lag have not been dealth with completely yet.

Is there any way to make such a massive amount of units work with less lag? Maybe some smart memory-management techniques, or some more effective pathing triggers?
05-02-2004, 03:14 AM#2
Shimrra
You're real problem is the number of units. I've played games with a thousand units and it will lag unless your computer has a couple of gigs of RAM. If you use less units, the lag will reduce. Also try recycling the units that die and do everything possile to stop memory leak.
05-02-2004, 03:47 AM#3
35263526
800 hundred units on a map shouldn't cause any lag or speed problems unless they're all on screen at once; I'm gussing the main cause of lag in your map is the spawning triggers.

1. Recycle dead units. You can do this by moving dead units to an off-limits location and reviving them with a spell like Ressurection.

2. Don't use the nasty GUI unit creations triggers, they create points which aren't removed, which can cause major memory leaks when use often.
Use createunit(x,y) to stop such leaks.
05-02-2004, 04:32 AM#4
ThyFlame
GUI creations are fine, provided you create the point [or whatever] directly into the variable and then in the creation trigger use those variables.


Alternatively, I think you can use a custom script to destroy the GUI-created point/group/whatever
05-02-2004, 04:35 AM#5
35263526
Quote:
Originally Posted by ThyFlame
GUI creations are fine, provided you create the point [or whatever] directly into the variable and then in the creation trigger use those variables.

Afraid not, the triggers make a point whether you directly specify one or call it from a variable.

And yes, you can remove them, but it's still easier (in my opinion) to use createunit().
05-02-2004, 01:06 PM#6
qwertyui
Thanks for the input. 2 questions in this regard.

First - which function should i use to get the coordinate of a unit which is already on the map? Or a center of some region?

Second - in our map corpses of dead units are actively used. Will i still be saving memory if i just remove them from the game after their corpses disappear?
05-02-2004, 03:53 PM#7
35263526
1. Part of the status bar in WE shows the current X,Y position of the mouse on the map. Use that to get the values for createunit().

2. Definitely not; removing units causes more memory usage than ever. I recommend exploding them if they're not gonna be reused.
05-02-2004, 04:26 PM#8
ThyFlame
I'd advise moving them off the screen and then exploding, so you don't have people wondering why things keep exploding everywhere.
05-03-2004, 04:31 PM#9
qwertyui
Errrr. Can i explode dead units that have already decayed so much their corpses can't be raised?
05-04-2004, 11:24 AM#10
Quetz
WEU has auto-memory cleanup...
05-04-2004, 02:37 PM#11
qwertyui
Are you sure?

Is there a manual on this somewhere?
05-04-2004, 04:30 PM#12
35263526
Only if you use the advanced triggers, and WEU increases map size considerably. In my opinion it's best to use slightly more difficult custom script to keep it clean; that way you get into the habit of doing it right.
05-05-2004, 01:23 AM#13
Cubasis
Erhm, and to note:

Using effective point variable usage and destroying it will not leak at all, and can in many cases be easier than using X/Y.

Remove Unit does not create massive ammounts of leak...I mean, where do you even get the idea that this happens, as it's completely illogical. Remove Unit clears all traces of memory used by the unit. There are only a couple of instances where this can mess up, and in those instances the fix is to "first" kill the unit, then remove it (can be instant, (without any waits between)).

EDIT: and maps that spawn ALOT of units leak not becouse of the units, but becouse of the points/unit-groups associated with creating/using these units.

Cubasis
05-05-2004, 01:39 AM#14
qwertyui
So basically, i can forget about unit recycling and concentrate on making sure i don't create unit groups and new points unless its absolutely necessary?
05-05-2004, 10:34 AM#15
Cubasis
That should be fine. The creators of that hive-spawn spawn-system also later told that there was no difference memory-wise between using that spawn-system and creating unit...with point/group cleaning.

Cubasis