• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[General] Needs help checking code for lag. (Custom Race/Altered Melee)

Status
Not open for further replies.
Level 27
Joined
Nov 25, 2021
Messages
481
I've been trying to make a custom race in a 4-player melee map. I'm almost finished but a few issue occured during my test runs (with three Insane Computers).
  • Lags seemed to occur randomly and I don't know what units caused it.
  • Occasionally, the game notified me of an ally under attack in the top-right corner of the map, but no one was there.
  • Lags intensified during 2v2, and barely noticable on 1v3 or FFA.

I'm going to attach the map file, so if any of you can help me check out the code, I'll be appreciated.

Meanwhile, you can check out the features that actually work for the time being, because I need some feedbacks before posting this mess in the Map section. To play as the custom race, just pick Human with 90% Handicap.
 

Attachments

  • Twisted Meadows.w3x
    5 MB · Views: 10

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
I found some Point leaks in triggers where you were creating Unit Groups at a Position instead of a Point:
  • Set Variable TempGroup = Units within 500.00 range of (Position of (Triggering unit))

I cleaned up a few Player Group leaks where you were displaying messages to specific players.

All of your Dummy units are setup incorrectly. Their Movement Type should be Set to None, Speed Base: 0, Death Type: Can't Raise, Does not decay, and Art Animation Cast Point / Backswing set to 0.00. At least this is the case for Dummy units that are intended to cast a spell(s) and then die. If you want your Dummy unit to be able to move around then that changes things. I base my Dummy units off of the Locust and proceed from there as it has most of the correct settings already.

I noticed you used the Finishes Casting Event in a couple of triggers which is usually not a good choice. This Event can be bypassed / ignored under the right circumstances.

But aside from some leaks, potential minor bugs, and faulty dummy units, everything seemed to be in working order. I didn't notice any triggers that would cause glaring issues or something that would cause that issue you had with the ally under attack notification.


I have to assume that the performance issues come from the Damage Engine, as this system can be taxing to begin with, especially when you have 10+ triggers that all use it with varying Conditions.

When any unit takes damage, all 10+ of these triggers fire, and a lot of Conditions are checked:
Does the DamageEventSource have 1 of 10 upgrades researched?
Is the DamageEventSource 1 of these 10 unit-types?
Is the DamageType one of these 5 different types?
etc...

Throw 100 units into a battle that are all taking and dealing damage constantly and you can imagine how taxing this could be.

That being said, I have a map I made that uses Bribe's Damage Engine (latest version) that has 100's of units fighting and it performs great. But I also designed it so I'd have a single DamageEvent/DamageModifierEvent trigger that handles everything and I'm using Lua which is more performant.

I guess what I'm saying is, try disabling some of these Systems and see if the map still performs poorly. The main culprit would be the Damage Engine, followed by the Unit Event system, and maybe the Buff linking or Lightning systems (I don't think they're even being used?). The Unit Indexer is extremely lightweight so that shouldn't be an issue. Edit: Forgot to mention the Custom Race system, but glad you checked this yourself!
 

Attachments

  • Twisted Meadows U1.w3x
    5 MB · Views: 18
Last edited:
Level 27
Joined
Nov 25, 2021
Messages
481
You came to the rescue, again.
I noticed you used the Finishes Casting Event in a couple of triggers which is usually not a good choice. This Event can be bypassed / ignored under the right circumstances.
An instance of me being lazy, since whenever I made an ability with cast time >0 seconds, I always default to using this because it's convenient. Didn't think it would come back to haunt me.

All of your Dummy units are setup incorrectly. Their Movement Type should be Set to None, Speed Base: 0, Death Type: Can't Raise, Does not decay, and Art Animation Cast Point / Backswing set to 0.00. At least this is the case for Dummy units that are intended to cast a spell(s) and then die. If you want your Dummy unit to be able to move around then that changes things. I base my Dummy units off of the Locust and proceed from there as it has most of the correct settings already.
Another lazy one, since I thought that all units can work as Dummy as long as they're flying and hidden, I just copied one from another map.
The main culprit would be the Damage Engine, followed by the Unit Event system, and maybe the Buff linking or Lightning systems (I don't they're even being used?). The Unit Indexer is extremely lightweight so that shouldn't be an issue.
Used the Lightning system for exactly one ability, (A waste, I know) but I think that visual clarity is important, to show to the other players that "Hey, my units are being hit by that guy!" so 'maybe' it's worth it.

That, and if I go too wild with the ability design, then it'll fall into the MOBA zone. I want it to be different from vanilla abilities just enough to be original, but also when veteran Warcraft players look at it, they'll go like: "So it's based on vanilla ability name! That means I can use it like this...". They don't have to spend time on learning the Heroes, but on macroing instead.

With that being said,

Throw 100 units into a battle that are all taking and dealing damage constantly and you can imagine how taxing this could be.

I need to be more careful from now on. Most of the time, it's just me throwing random shits into the Editor and hoping that Warcraft can run flawlessly.

Thanks for your help!
 
Level 27
Joined
Nov 25, 2021
Messages
481
A little update here. I've disabled lots of stuffs and successfully pinpointed a few culprits:
  • Damage Engine, as expected, but not by much after I finished tweaking.
  • When multiple Dummies expired at once.
  • Archmage Owenalacaster's Custom Race System. I've tried to played other maps with this system implemented with more than 1 Computer, and it's also laggy as hell. Don't know why, but I'm glad that it's not my fault for once.

Forgot to mention, but the version of Warcraft that I'm using is 1.31.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
A little update here. I've disabled lots of stuffs and successfully pinpointed a few culprits:
  • Damage Engine, as expected, but not by much after I finished tweaking.
  • When multiple Dummies expired at once.
  • Archmage Owenalacaster's Custom Race System. I've tried to played other maps with this system implemented with more than 1 Computer, and it's also laggy as hell. Don't know why, but I'm glad that it's not my fault for once.

Forgot to mention, but the version of Warcraft that I'm using is 1.31.
Yeah, that Custom Race system seems a bit old. Maybe you can find a newer one that would play nicely with the latest patches?
 
Level 27
Joined
Nov 25, 2021
Messages
481
Holy. The moment that I switched to MyPad's UI-Custom Race System, everything that even resembled lagging just vanished into thin air, even when in the middle of combat, where tons of Dummies entered the map/expired + probably a hundred of DamageModifier events being fired every second.

That, and it's also super easy to customize being the cherry on top. Totally using this one from now on.
 
Status
Not open for further replies.
Top