Map Spawn System Unreliable

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Hi all,

I'm hoping someone can take a look at my map and identify what is wrong with my spawn system.

I'm making a hero defence map with a unique spawn system. Enemies sort of come in waves. Each time a unit dies, more spawn to takes it place. Enemies build up until a cap is reached then their numbers are allowed to dwindle.

Edit: The number of units in the enemy unit group variable reaches 0 and new enemies stop registering into the group. This breaks the spawn system.

The mostly relevant triggers are shown below, but it could be anything breaking the spawn system. This map has million of triggers in it. The bug appears to occur at random waves, only some games, and even when nobody choose a mind controlling hero. I seem to have trouble reproducing this bug in single player, but it happens in approx 30-40% of multiplayer games. Often at wave 2 (when the archer start coming) but also happened recently at the first human boss.

I thought I fixed the bug after a redesign of the spawn system, but last game I played, it occured again at the human boss.


troubleshoot.png



  • All enemies are stored in a unit group. They are added when they "Enter playable map area" and removed when they die.
  • The theory here is it is faster to issue orders, count and do checks against all enemies if they are already registered into a unit group.
  • Wave spawns are separated by the "Spawn" and the "Next". Spawn creates units and cumulatively grows their numbers. "Next" allows enemies to dwindle and won't begin the next "Spawn" trigger until the enemy counts are near 0.
  • During a cinematic, the registered "Spawn" trigger is nulled so nothing will spawn during certain cinematics. I don't think this is the problem because sometimes the spawn problem occurs on the second wave.
  • Whats bizzare is that the "Enemy Unit State Check" will activate when this problem happens (when no enemies are left) and spawn a unit. For some reason, this unit isn't being registered by the "Enemy Register and Attack" trigger and the game forever loops this trigger spawning units which never register and the game gets stuck.
  • I deleted the "Enemy Register and Attack" trigger to see if anything is turning it off. There is only a reference to the "diag" trigger I created for diagnostics purposes. In other words, nothing is turning it off.


  • I remember reading that too many triggers with the "A unit enters playable map area" can cause issues in a map. I have a lot of triggers (mostly hero triggers) with this event type. Could this create issues? I was playing as the Necromancer and I noticed my Skeletons movement triggers seemed to glitch around the same time as the spawn bug. I'm confident the Skeletons wern't registering into their associated Unit Group but can't see why unless the "unit enters playable map area" was bugging out. The trigger is called "Skeletons" something under "Spell Effect" folder. This could all be coincidence..
  • I am aware any hero abilities with mind control or player conversion spells might break the spawn system due to not properly de-registering enemy units from the unit group. I however doubt this is the problem because nobody is picking mind control heroes when these bugs occur.



Please note I am not the original creator. I have permission to continue working on this map. I have redesigned many systems to improve performance and fix bugs but there is still a shit tonne of code not written by me.

I'd appreciate any help you can give. I've been stuck at this problem for too long, and would be grateful if someone can help go over the code.

Please see the attached map.
 

Attachments

  • TEoA_II.w3x
    2.7 MB · Views: 70
Last edited:

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,166
So is this the bug?
  • Whats bizzare is that the "Enemy Unit State Check" will activate when this problem happens (when no enemies are left) and spawn a unit. For some reason, this unit isn't being registered by the "Enemy Register and Attack" trigger and the game forever loops this trigger spawning units which never register and the game gets stuck.
I'm a little confused as to what the problem is.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
The number of units in the enemy unit group variable reaches 0 and new enemies stop registering into the group. This breaks the spawn system.

So yes, a symptom of such is the backup trigger "Enemy Unit State Check" trigger notices there are no units and spawns a backup unit. Strangely this backup unit does not get registered into the unit group when it spawns. As a result, we're stuck in this loop where backup units are forever spawning and the map can't progress.

It seems the problem is that enemies, at some unknown point (often wave 2, and recently at the boss) stop registering and the whole system breaks.
 
Last edited:

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,166
It sounds like a condition isn't being met or something of that nature. Try using Text messages which display these different values (like the # of units in the unit group) or any integer variables you may use. This could help you decipher the issue. Remember that dead units aren't removed from unit groups and you often have to "deregister" units manually for systems like these.
 
Last edited:
Status
Not open for further replies.
Top