System [ZTS] - Zwiebelchens Threat System

Zwiebelchen

You can change this now in User CP.
Reaction score
60

attachment.php

What is a threat system?
Basicly, it's a system that takes over Mob AI. The unit that dealt the most damage to the creep will be the one that gets attacked.
Although that is only half the truth, it should be enough to get the idea.


ZTS is the easiest to use and most stable threat system currently available on the web.

Requirements:
- vJass preprocessor

What is different from this to other systems:
- First of all, this system is almost (if not completely) 100% fail-safe. It does checks on killed AND removed units and clears them automaticly.

- Second, it features a unique camp squad functionality, which ensures that units that are preplaced in camps will always attack and return together. If units return, they will be rendered invulnerable until they reach their original camp position again. If they can not reach their camping position within a certain duration, they will get instantly teleported back.
Like this, there is almost no more kiting or bug-abusing possible, as it was with other systems.

- Third: It does not block other Spellcasting systems. The system will only give orders to units, if the unit either has no order (i.e. auto-engage) or an "attack" order. If you want the unit to use a spell instead of attacking, you can do so whenever you want without having to fear interference of the system.
In fact, there is a special function provided so that people can create their own Spell-AI directly in a custom trigger

- Fourth: It provides a lot of useful functions and Getters (Like ApplyHealThreat or GetCombatState), to make triggering spells even more easy.

- Fifth: It is, by far, the fastest and most flexible threat system out there. I completely remastered the system from the last version and the entire script (except for certain enumerations that can not be avoided) is now O(1) complexity.


Version history:

2.5
- Added a new boolean to the ZTS_AddThreatUnit command that determines wether the added unit shall be added to already fighting Creep Camps or only to non-fighting Creep Camps - this is interesting when you create encounters that summon units as you usually don't want those summoned units to create their own Creep Camp but want them to be added to the Boss' Creep Camp
- Fixed a small bug that sometimes caused linked Creep Camps

2.4
- Fixed a small bug sometimes rendering units invulnerable permanently, when registering a threat unit to the system close to retreating units
2.3
- Fixed a triggeraction leak for dynamic triggers
- Fixed GetThreatUnitAmount

2.2b
- fixed a small logic bug with GetThreatUnitAmount and GetThreatUnitPosition

2.2
- Now uses "smart" order instead of "attack" to issue attack orders ... it turned out that the "smart" order returns false if the unit can not reach the target (for example when rooted) - weird, as it doesn't work for "attack" for some reason
- because of that, the AddRootAbility function and the Range Setter and Getters were removed, as they have become obsolete

2.1b
- fixed a small logical bug with GetCombatState sometimes returning a false positive

2.1
- rebuilt Update function to avoid some useless enumerations - depending on the number of PlayerUnits registered, the system should now be MULTIPLE TIMES faster - As a side effect, I could also remove some useless variables

2.0
- Initial release

Comments & Discussion:

Why hashtables instead of global arrays and structs?
- hashtables are not limited in terms of max size, unlike and array of structs with a unit array, which reaches the 8000 limit very fast ... this was basicly the most important point on that decision
- hashtables are more flexible and easier to use (Flush functions, etc.)
- hashtables were benchmarked to be only 60-80% slower than getting UnitUserData alone

Where is the sort function?
- version 2.0 and higher does not use sorting anymore; instead, when threat is applied to a unit, it uses an insertion method to keep the order of the list

What is new compared to pre 2.0 versions?
- Aside from the fact that the system now is a dozen times faster than before, I also improved the AI by using the "smart" instead of "attack" order. It turned out that - in a weird way - "smart" is indeed smarter than other orders, as it returns false if the unit can't reach the target (i.e. because of root)
- There is now a way to directly get an Order event by the threat system, to make creating spell-AI easier.

Does it matter how many units are registered to the system at the same time?
- In terms of speed, no; it only affects memory usage, but that should not have an impact on game performance at all, even with tousands of units registered - only the number of currently fighting units affects runtime

I still do not really understand how to use the system...
- just check the demo map and you'll get the idea
 

Attachments

  • ZTSThreatv2_5.w3x
    62.5 KB · Views: 580

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Mmm... Off the top of my head, is it like Aggro?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
A threat system is basicly some sort of advanced Mob AI (mostly used for RPGs).
It determines which unit did the most damage to the creep and sends an attack order targetting that unit. This is not all, of course, but you get the idea, I think.

And yes, you can call it aggro-system too, but I prefer the more political correct term :>
 

Sevion

The DIY Ninja
Reaction score
413
You know, dealing the most damage isn't always the highest threat. It could be the medic standing in the back keeping the DPS man alive. ;) Though, it'd be complicated to add in that support :p
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
You know, dealing the most damage isn't always the highest threat. It could be the medic standing in the back keeping the DPS man alive. ;) Though, it'd be complicated to add in that support :p
Dude, this all depends on how you set up the system. The functionality is there. Check up the demo map for examples.

This was one of the main reasons I wrote this system after all.
 

Sevion

The DIY Ninja
Reaction score
413
Well, I didn't check the demo map :p And I didn't read the system ^_^ I only read that you set the unit with the most damage per second as the main threat.

Anyways, why is the init function not private?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
So what now? Can someone comment on the actual system? Tell me what to improve or what you dislike ... or at least give a rating and stuff. It sucks putting so much work into something like this and getting no feedback at all.
 

D.V.D

Make a wish
Reaction score
73
Tested your system. Really cool. This would make battling bosses or even in melee style maps, this system would make it much harder for the opponent with the large threat to win. Nice idea too. +rep.
 

Dirac

22710180
Reaction score
147
Tested your system. Really cool. This would make battling bosses or even in melee style maps, this system would make it much harder for the opponent with the large threat to win. Nice idea too. +rep.

Would be nice if Roshan (dota) had this system
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Would be nice if Roshan (dota) had this system
Though I doubt the system can handle so many units at once ... however, he could always add standard units to the exceptions and allow only bosses to the system.
 

Steel

Software Engineer
Reaction score
109
If the unit is rooted or immobile, shouldn't the unit then attack the closest unit? Able to do? Possible to do without knowing the buffID's?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
If the unit is rooted or immobile, shouldn't the unit then attack the closest unit? Able to do? Possible to do without knowing the buffID's?
Didn't thought of that possibility. However, I can not do that without knowing the ability ID, so you have to do it yourself in case you want to use such a spell.

However, it's not that hard: just create a trigger that checks for the root buff and if you find that buff, add 100.000 threat or something to all units withhin melee range of the rooted unit. Of course you have to check periodicly and remove that aggro again after they leave that range. It's not that hard to make, though.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
There is a AutoIndex version also available on WC3C.net ... AutoIndex comes with a custom value-free implementation too.
 

Nerzhul

New Member
Reaction score
7
But if I remove
JASS:
...Uses AIDS

It would work?
Sorry but I have no time to test for now :/
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top