• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

A question about leaking

Status
Not open for further replies.
Level 9
Joined
Sep 15, 2012
Messages
311
I created 4 triggers that every 15mins roll a random percentage and each summons a monster if it's (for exanple) over 97.

I noticed my map is lagging around that time. Is it possible for these triggers to 'cause major leaks?

The triggers look like this

  • RareTroll
    • Events
      • Time - Every 900.00 seconds of game time
    • Conditions
    • Actions
      • Set ChanceRareTroll = (Random percentage)
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ChanceRareTroll Greater than or equal to 97.00
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Unit - Create 1 |cffc0c0c0Tazdingo|r (Rare) for Neutral Hostile at (Center of RareTroll <gen>) facing 300.00 degrees
        • Else - Actions
 
Nope this wouldn't be the cause of your lag however your still leaking.

Create a point variable in the variable manager/editor.
Set it to center of raretroll.
Then in custom script type "call RemoveLocation(udg_yourvariablename)" of course without the quotations.

Why do you need a wait there as well? That wait can be anywhere from 0.20 to 0.80 depending on the player. Oh and the range I gave you isn't pinpoint accurate.
 
Level 4
Joined
Feb 28, 2014
Messages
70
Why do you want to know if this leaks or not? It will leak just some kbs every 15 minutes... and you don't need that 0.01 wait

This would be ok for you:

  • RareTroll
    • Events
      • Time - Every 900.00 seconds of game time
    • Conditions
      • (Random integer number between 1 and 100) Greater than or equal to 97
    • Actions
      • Custom script: local location p
      • Custom script: set p = GetRectCenter(gg_rct_RareTroll)
      • Custom script: call CreateNUnitsAtLoc( 1, 'put here the unit id of that unit', Player(PLAYER_NEUTRAL_AGGRESSIVE), p, 300.00 )
      • Custom script: call RemoveLocation(p)
      • Custom script: call DisableTrigger( GetTriggeringTrigger() )
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Ok firstly the game will probably hang for a few frames while the unit assets and data are loaded the first time. If all 4 such units were created at once and each has many abilities with many levels this might last 5-10 seconds of the game being unresponsive, however usually for standard units it is only a couple of frames (1 second for all 4). Avoid this by placing the units on the map somewhere so they are loaded during map initialization (note it will make load times longer).

Secondly the trigger only fires once every 15 minutes and can leak at most 1 location each. This gives you a possible leak amount of 4 locations from all those triggers! This should make practically no difference to game performance at all since you need a large number of leaks (like 4,000 or 40,000) for there to be performance problems. As such I say your bad performance is coming from somewhere else and not from these triggers. That is if your bad performance is persistent and not once off as mentioned above.

Thirdly, you do mean "bad performance" or "low frame rate" right? And not lag? Since lag mostly is the result of excessive network traffic resulting in very large TCP window size. Where as bad performance is caused by your system running out of free resources to meet the game's real time requirements, lag is caused by filling up network buffers. An example of bad performance would be creating 1,000 air units at the same point and letting them displace each other. An example of lag would be playing a multiplayer session involving the internet on a standard ADSL connection while running Peer 2 Peer software with no bandwidth limit in place.

As for your trigger it self... You are aware that to have a 50% chance (yes only a 50% chance) to see these rare units you need to play for 5.7 hours? That is by no means a reasonable expectation for someone playing a WC3 map. You have a higher chance of finding a Furnace or Witching Hour playing Diablo III for the same amount of time I recon, and both those items are notorious for being virtually impossible to find.

A session length of 1 hour is reasonable for a WC3 map, anything longer and it is hard for most people to have such length of continuous free time. As such you are looking at 4 rolls per session. A good rate might be 50% chance per session (I personally would go higher but you want it to be rare). So I would say the probability should be around 0.84 of it not spawning or a 16% chance to spawn every 15 minutes.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
Or make a dynamic chance - For example a 20% chance to spawn, followed by additional 10% chance boost each time the trigger runs and the unit is not spawned. This way you ensure that the spawn will be rare, as the initial chance is low enough, but you also ensure that players should encounter the rare as they continue playing the map.


  • Custom script: call CreateNUnitsAtLoc( 1, 'put here the unit id of that unit', Player(PLAYER_NEUTRAL_AGGRESSIVE), GetRectCenter(r), 300.00 )
Afaik this leaks. You create rect, but for spawning you use "center of rect", which creates a point there, thus causing a leak, since you didn't clear it.
Also, why create rect, when all you really need is a variable of type point.
 
Level 9
Joined
Sep 15, 2012
Messages
311
Thnx a lot for the help everyone.

As for your question Dr Super Good, I meant low frame rate. Memory usage in Task Manager keeps going up.

Also you are correct about the appearance chance of the rare monsters being low. If someone wants to fully explore the map that would take around 3 hours, I reckon. I understand the chance is still low.
 
Status
Not open for further replies.
Top