Mass Units w/o Lag?

SnoopyLoL

New Member
Reaction score
6
Ok,
I'm trying to create a zombie siege map. There is a huge a mount of units (for the zombies). Whenever I spawn the zombies its fine but If I try to move them, it generates a huge amount of lag. Is there a way to fix this? Could somebody post a trigger that I could try. I wont bother to post my trigger because its worthless and I want to trash it :)
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Post your trigger... So we can see if that has something to do with...anything.

Probably, just too many units.

What you could try is to remove units that are dead, at once, in gameplay constants > decay bones - 5.
Also, how many units do you create? How often... so on.

>Is there a way to fix this?
Reduce number of zombies created/ordered to move.
 

SnoopyLoL

New Member
Reaction score
6
rawr T.T
i haven't mapped in a looong time. i've forgotten JASS, so its in the WE GUI triggering.
Code:
Moving
    Events
        Time - Every 40.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Entire map) matching (((Owner of (Matching unit)) Equal to Player 2 (Blue)) and ((((Matching unit) is in (Units of type Zombie)) Equal to True) or (((Matching unit) is in (Units of type Ranged Zombie)) Equal to True)))) and do (Actions)
            Loop - Actions
                Unit - Order (Picked unit) to Attack-Move To (Center of Survivor Base <gen>)

really simple. lawl. i would just like a replacement trigger.
the timing is every 40 seconds because the spawn is every 40 seconds.
AND any zombies on the map freeze whenever a new wave spawns :/
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Order them right after they have been created.
Show us the trigger where you create them
PS: ever heard about leaks? :)
 

SnoopyLoL

New Member
Reaction score
6
Yes I've heard of leaks but I forgot all about them, well not all about them but rather how to get rid of them and which ones are leaks ^_^
The code for clearin unit groups is something like... idr
JASS:
call DestroyGroup (udg_group_name)

??????


I changed them a little so I'll just post both.

Spawn
Code:
Spawning
    Events
        Time - Every 40.00 seconds of game time
    Conditions
    Actions
        Set zombie_spawn = (zombie_spawn + 2)
        Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Matching unit) is in (Units of type Zombie Spawner)) Equal to True)) and do (Actions)
            Loop - Actions
                Unit - Create zombie_spawn Zombie for Player 2 (Blue) at (Position of (Picked unit)) facing (Position of Survivor Center 0002 <gen>)
        Unit Group - Pick every unit in (Units owned by Player 2 (Blue) matching (((Matching unit) is in (Units of type Zombie Spawner Ranged)) Equal to True)) and do (Actions)
            Loop - Actions
                Unit - Create zombie_spawn Ranged Zombie for Player 2 (Blue) at (Position of (Picked unit)) facing (Position of Survivor Center 0002 <gen>)
        Trigger - Run Moving <gen> (checking conditions)

Move:
Code:
Moving
    Events
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Entire map) matching (((Owner of (Matching unit)) Equal to Player 2 (Blue)) and ((((Matching unit) is in (Units of type Zombie)) Equal to True) or (((Matching unit) is in (Units of type Ranged Zombie)) Equal to True)))) and do (Actions)
            Loop - Actions
                Unit - Order (Picked unit) to Attack-Move To (Center of Survivor Gate <gen>)
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Code:
Untitled Trigger 002
    Events
        Map initialization
    Conditions
    Actions
        Set zombieMelee = (Units owned by Player 2 (Blue) of type Altar of Kings)
        Set zombieRanged = (Units owned by Player 2 (Blue) of type Barracks)
        Set attackpoint = (Center of Region 014 <gen>)

Code:
Untitled Trigger 003
    Events
        Time - Every 40.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in zombieMelee and do (Actions)
            Loop - Actions
                Set p = (Position of (Picked unit))
                Unit - Create 1 Knight for Player 2 (Blue) at p facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_p)
                Unit - Order (Last created unit) to Attack-Move To attackpoint
        Unit Group - Pick every unit in zombieRanged and do (Actions)
            Loop - Actions
                Set p = (Position of (Picked unit))
                Unit - Create 1 Rifleman for Player 2 (Blue) at p facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_p)
                Unit - Order (Last created unit) to Attack-Move To attackpoint
I could have optimized it a bit more, but...

At least they are leakfree, working triggers.

Besides, your trigger, it does not say how many units you create...
Code:
  Unit - Crea[COLOR="Red"]te XX zo[/COLOR]mbie_spawn Zombie for Player 2 (Blue) at (Position of (Picked unit)) facing (Position of Survivor Center 0002 <gen>)
There is no number there? :)

Also, to prevent "lag" a bit more... add something like this:
Code:
Untitled Trigger 004
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        ((Triggering unit) is A Hero) Not equal to True
    Actions
        Wait 7.00 seconds
        Unit - Remove (Triggering unit) from the game
Or as I already said, change gameplany constants... Creeps - Decay Bones.

And of course, if those "zombieSpawningALtar/Barracks" are killable... Do this to prevent further spwaning:
Code:
Untitled Trigger 005
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Triggering unit)) Equal to Altar of Kings
    Actions
        Unit Group - Remove (Triggering unit) from zombieMelee

Edit:
Forgot to say: yes, call DestroyGroup(udg_UnitGroupVariable)
But you have to create the "UnitGroupVariable" first, then set it to some kind of group of units, then use those units to attack/die/move/jump/whatever, then call Destroy...

Edit: Oh, yes, integer variable...I read "zombie_spawn_Zombie" :)
 

SnoopyLoL

New Member
Reaction score
6
ok I'll try that.
and it does say the amount spawned. zombie_spawn is an interger. the
Code:
Set zombie_spawn = zombie_spawn+2

Adds more units for every wave.


Update: thanks! that creates much less lag. +rep
but it would be wonderful if somebody could help me make it have less lag

Update 2: wait there's a problem, not all the zombies move! halp!

Update 3: o wait, there's an error in your triggers. it doesn't support making more than one zombie at a time... at least it wont move them.
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
There is no "bug" in my trigger. I create 1 knight at a time, I order then 1 knight at a time, if you create up to twelve, 12, units at a time, you can use:
Code:
Unit Group - Order (Last created unit group) to Attack-Move To (Center of Region 014 <gen>)

If the amount of spawned units (at one swapning place, at one "Zombie Spwaner") becomes greater than 12, which I assume it will, create a region around every ZombieSpawner, if a unit enters and the owner of entering unit is player 2 blue, order entering unit to attack-move to...

Hence:
Code:
Untitled Trigger 002
    Events
        Map initialization
    Conditions
    Actions
        Set zombieMelee = (Units owned by Player 2 (Blue) of type Altar of Kings)
        Set zombieRanged = (Units owned by Player 2 (Blue) of type Barracks)
        Set attackpoint = (Center of Region 014 <gen>)
        Unit Group - Pick every unit in zombieMelee and do (Actions)
            Loop - Actions
                Set ii = (ii + 1)
                Set p = (Position of (Picked unit))
                Set region[ii] = (Region centered at p with size (300.00, 300.00)) [COLOR="Red"]//A region, with the size of .. A bit bigger than an Altar, maybe you want it bigger, 500, 600, 700...[/COLOR]
                Trigger - Add to Untitled Trigger 007 <gen> the event (Unit - A unit enters region[ii])
                Custom script:   call RemoveLocation(udg_p)
        Unit Group - Pick every unit in zombieRanged and do (Actions)
            Loop - Actions
                Set ii = (ii + 1)
                Set p = (Position of (Picked unit))
                Set region[ii] = (Region centered at p with size (300.00, 300.00))
                Trigger - Add to Untitled Trigger 007 <gen> the event (Unit - A unit enters region[ii])
                Custom script:   call RemoveLocation(udg_p)

Code:
Untitled Trigger 007
    Events
    Conditions
        (Owner of (Triggering unit)) Equal to Player 2 (Blue)
    Actions
        Unit - Order (Triggering unit) to Attack-Move To attackpoint

And the spawn trigger, remove the order to move... it should look like this:
Code:
Untitled Trigger 003
    Events
        Time - Every 40.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in zombieMelee and do (Actions)
            Loop - Actions
                Set p = (Position of (Picked unit))
                Unit - Create 1 Knight for Player 2 (Blue) at p facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_p)
        Unit Group - Pick every unit in zombieRanged and do (Actions)
            Loop - Actions
                Set p = (Position of (Picked unit))
                Unit - Create 1 Rifleman for Player 2 (Blue) at p facing Default building facing degrees
                Custom script:   call RemoveLocation(udg_p)

Of course, instead of adding regions like that, regions around each spawn, now I do not know how your map works, but if player 2 units only are going to attack towards the Center of some region, you could just have a little trigger like this:
Event - A unit enters playable map area
Condition - Triggering unit == Player2
Actions - Order to attack-move to attackpoint
 

Drakethos

Preordered Sc2 ftw!
Reaction score
56
Only 12 units can be fit into a group. Two options: loop from 1 to unit amount/12 or make the group variable an array setting each set of 12 units to a group using a loop to retrieve the array of the groups.
 

SnoopyLoL

New Member
Reaction score
6
ok thanks that works. BUT i have another problem.
as the units are moving toward the survivor's base they often stop, freeze or pause. any ideas?
it seems as thought they are holding position. and they tend to group up 0_o

this also only happens when there is a large amounts of units on the map. perhaps it is caused by unit lag or something?
 

ManyTimes

I'm so lonesome I could cry...
Reaction score
293
Too many units.
Reduce amount of creeps, add more hitpoints/damage on the creeps so it remains at the same "level". Also: creating 50 and 50 units at each spawn, not a good idea. They should rather come in 1/2/3/4/5 by 1/2/3/4/5 and rather decrease the time between each spawn, my opinion! :)

This is also the main reason why splash towers are so incredibly imbalanced in many TD's. The creeps just won't...:)

>>stop, freeze or pause. any ideas?
Basically what you had earlier on, just removing the leaks... With the event... every... 10-20-30 seconds? 5?
Set UnitGroupVariable = Unit owned by Player 2 blue
Pick every unit in UnitGroupVariable
- Order picked unit to attack-move to attackpoint
call DestroyGroup(udg_UnitGroupVariable)

Or stop increasing the amount of units being spawned. Or give defeat if there are over 300 units? Or even better, if there are... 300 units, make them all die, but create one hell of a big Frost Wyrm...No? :)

Another idea then: add expiration timer on the creeps, so none will lasts for longer than a minute?
 

SnoopyLoL

New Member
Reaction score
6
The idea is supposed to be that there is a huge amount of zombies and they die very very fast. But the problem is that they don't get to the play so they don't die and so they accumulate. -_-
w/e
Im going to make a new map with the things that you said. thnx
 

SnoopyLoL

New Member
Reaction score
6
@manytimes:
how would I be able to change a periodic event in the way you said?
like, quicken the spawn speed.

EDIT:
k here is the remade map. had some help on chat so now its lagless. :)
BUT unfortunately the zombies stack :/
idk if its done tho.
http://www.mediafire.com/?ymn2yzfiomm
 

gameman

It's been a long, long time.
Reaction score
95
Also, to prevent "lag" a bit more... add something like this:
Code:
Untitled Trigger 004
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        ((Triggering unit) is A Hero) Not equal to True
    Actions
        Wait 7.00 seconds
        Unit - Remove (Triggering unit) from the game

This is not mui and will cause bugs!

add this
Code:
Untitled Trigger 004
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Triggering unit)) Equal to Player 2 (Blue)
        ((Triggering unit) is A Hero) Not equal to True
    Actions
        Custom script:   local unit [B]udg[/B]_tempunit = GetTriggerUnit()
        Wait 7.00 seconds
        Unit - Remove tempunit from the game
udg is a variable prefix to a variable you set up in the variable box! (its for jass)
 

WindexIsBack

New Member
Reaction score
100
There are not many ways - A unit is a unit.

Increasing the units speed to maxium decreases the time hte unit is alive (gets to target faster) and decreasing total distance can help a lot.
Splitting the zombies into 2 players or more migrates movement lag.
Try and avoid visible auras or extra parts on zombies.
Make the corpse/bones of the zombie dissapear very quickly - these can add up pretty quickly.
Do a fixed-seed sound test of zombies - the first test will use default sounds, look at framerate during large amount of zombie kills. Second test replaces the zombie sounds with empty ones - compare frame rate again (if there's a big difference, than reduce quality of zombie sound)

Remove any extra particles and lights from zombies
Reduce collision of zombie


But increasing the life/re spawn rate of zombies can ease up lag greatly. But that is just a personnel preference.
 

OrcBambino

New Member
Reaction score
0
I'm not sure if this post is still being viewed but I had run into the same problem.

The issue is that the waypoints of the zombies lead their movement path on a collision course with each other. The zombies keep pausing because they are letting another zombie go by first in the pathing map, so with 50 zombies doing that at once, there are expontentially more collisions and the zombies hardly move.

If you reduce the Collision size of the zombies to zero, they will move without lag but they will also stack (i.e. their attacks would like one attack but actually be 50 attacks), not fun. This is how the tower maps are made.

Another solution is to make/download a movement script for the zombies so that they move orderly instead of all rushing to the same zone at once.

The other ideas here will not help with the pausing, except for reducing the distance, because there will be less collisions of movement paths.

Kind Regards,
Googs
 

Maelbog

Member
Reaction score
3
When moving, you could turn off the collision of picked units.
Then add another trigger:
A unit is attacked
Attacking Unit is a zombie
turn on collision for attacking unit.

You can also make use of non-moving units such as wards and structures.
Or make use of 0 collision flying units.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top