System Advanced Indexing & Data Storage

Romek

Super Moderator
Reaction score
964
> I tried to spawn 1000 footman and my pc laggy.
Well, if you instantly spawn 1k footmen right where the camera is... :rolleyes:
 

Jesus4Lyf

Good Idea™
Reaction score
397
I tried to spawn 1000 footman and my pc laggy.
Leads to conclusion...
A map with 1000 units is unplayable, actually.. You will suffer low fps in this status.
See, kingking... I suppose this is why I don't trust your testing. Spawning 1000 of an intense type of unit which you would never spawn 1000 of to test the effects of spawning 1000 units... I don't get it. =/
 

Steel

Software Engineer
Reaction score
109
I fail to see how you could hit op limit, considering none of my functions cycle through all the units. Each function call is O(1) complexity.

Please explain in better detail?

You have to find the unit first, doing that the complexity is massive in this type of indexation.

Lets say you add in 1000 units, they fill up an array from [0] to [999]. You want to find Footman_ABCD which lets say it was the 998th unit added. Your system has to go through and search and compare from [0] until it finds [998]. Thus the complexity is of O(n), your operation is simple and it cannot perform better unless you try analyzing another approach for storage.

However, spawning 1,000 units is not how you analyze a map's performance. Here is a realistic example: If you have somewhere in the range of 50 units with multiple operations tracking those units the system slows down. If you have a many units created and you are tracking each of them with numerous conditions with your system it will lag. I know a damage detection system can cause this rather easily because I've done it before.

Honestly I see plenty of these indexing systems on the forums here, almost a new one a week. I do admit some of them have great detail put into them, much like your own, but they serve as a tool for a very few individuals to use.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Each function call is O(1) complexity. :thup:
Your system has to go through and search and compare from [0] until it finds [998].
I'm not sure if you've read my code. This code contains no "loops" at all, except for the player 1-16 on initialisation. (And a fixed 16 loop is O(1) complexity.)

>If you have a many units created and you are tracking each of them with numerous conditions with your system it will lag.
No, it won't. This system doesn't track individual units like that. Either I can't understand what you're trying to tell me, or you haven't read and understood the code. Feel free to try again. :)

Oh... and I just wrote a damage detection system using this... So I'm not really sure what you're talking about.
 

Steel

Software Engineer
Reaction score
109
If you run several conditions in your OnDamage, such as modifying damage, nullifying damage, checking if there is a buff on the unit, checking who owns the units, etc... several checks of this matter at once, in a single action it will cause delay. Run your demo map and have several conditions setting data inside that function. Modify the incoming damage, check the armor of the units, run whatever you want, it has delay when handling several conditions. I just tried this and there is a slight delay on the incoming damage of the footmen. Storing multiple bits of data with a system is what this was created for, this is it's purpose: storing data to retrieve and use later.

I've had this in my own map and in something like this, especially when you showcase it doing damage manipulation you want it as seamless as possible to mask any hidden tricks you are doing.

What if the knights were hitting for 1,000 damage and the footmen only had 500 hp, but I wanted to give the footmen the ability to block 999 damage on incoming attacks? Something like this, a shielding ability, can cause some lag, especially when you have to recall any shield value, or check the unit's HP, see if theres any damage modification, etc... Yes your system can store all of that information but having to do it each time? I can make a full scale test if you really want, make around 50 footmen, with the given data above, have them take an AOE effect by Blizzard for example, doing damage to each unit, see how it works. Again it will be slight, but it is still there.

Edit: This finally make sense to you yet?
 

Jesus4Lyf

Good Idea™
Reaction score
397
That's a complaint against Damage, not AIDS. Damage is responsible for it's own triggers.

AIDS doesn't lag. It doesn't process anything in O(n). However, if you brought up this discussion in the Damage thread, maybe it would be more relevant (even though Damage is also O(1) function calls).

By the way, the scenario you described is already in the Damage demo map. I simply added 50 knights to it, all on full HP (so to block damage it needed to add the maxlife thing) and made them all attack eachother (with block all damage on). I also then flamestriked them with the bloodmade. There was no hesitation, no lag, no O(n) complexity and virtually no FPS drop (50 units in combat causes FPS drop in WC3 by itself, so this doesn't really count, and there was nothing beyond what you'd expect for that).

I don't think you're familiar with how efficient my code generally is. You should try it, even just for fun! :D

But thanks for your comment and concern.
 

Nexor

...
Reaction score
74
hmm when i try to save it, it says, expected type,struct,interface,keyword or scope for this line:

JASS:
private static thistype array data

it's line no.586 in AIDS.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
1.5c is indeed the most up-to-date JNGP, but jasshelper is used as a component of JNGP for handling vJass, and jasshelper has been updated. The jasshelper that comes with JNGP is version 0.9.G.1, the most recent jasshelper is 0.9.I.2.

0.9.G.1 is from april, and I believe it can't process AIDS. Try going to the jasshelper link I provided and downloading the up-to-date version. Then copy the 'jasshelper' exe from the 'executable' folder in the jasshelper folder, and replace the 'jasshelper' exe in your JNGP folder with it.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Didnt know it was possible to download a Aids virus of the internet :D. Thx man i really like this system and using it +rep
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Hmm I wanted to use this for simply attaching a struct to a unit.
But is it even possible to attach a struct that has variable arrays at any time to a unit and not just on creation with AIDS?
With HSAS I just did s.th. like AttachStructBlablabla(unit,struct)

If it is possible may you give an easy example?^^
 

Embrace_It

New Member
Reaction score
9
Hi Jesus4Lyf,

Sorry for the delay, but I've been busy for a while.

I'll start off by saying that I've never used any Indexing Systems before.

I'm creating an aggro system and I was wondering if the following snippet correctly assigns an index and setup up aggro-related stuff for a unit:

JASS:

struct Aggro extends array
    //! runtextmacro AIDS()
    unit source // registered unit
    unit currenttarget // source's current target
    real threat // or a hastable etc.
    
    private static method AIDS_filter takes unit u returns boolean
        // Filter the units
    endmethod
    
    // can this method take arguments? For defining source for example? Or is it the filters that define source?
    private method AIDS_onCreate takes nothing returns nothing
        set .source = ?
        set .currenttarget = null
        call SetupAggro(.source)
    endmethod
    
    private method AIDS_onDestroy takes nothing returns nothing
        call RemoveAggro(.source)
        set .source = null
        set .currenttarget = null
    endmethod
endstruct


Also, I have a spell that bestows a debuff on an enemy unit. Everytime the enemy unit casts a spell it takes damage. However, I have to know the source of the spell (the caster) to properly deal damage so that the source gets the bounty for the kill, if the target dies.

Would you then use the index of the unit as an index for a specific array of structs that the spell uses?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
If you move an unit outside the playable map area, and then move it again inside it, the unit get a new index, which is lame.
So instead of "bj_mapInitialPlayableArea", GetWorldBounds() is better (this native function always create a new rect btw), since an unit can't leave the entire map (or warcraft3 crash).

EDIT :

grim001 said:
if you want to stop this bug, you have to prevent it from assigning an index to any unit that already has an index. Even if you use GetWorldBounds, units that exit the entire map and re-enter will wind up with a new index.
Ok tested, and we can put an unit outside the entire map without a crash, strange ...

EDIT2 :
After a short more complete test, it doesn't crash with SetUnitX, but with SetUnitY it does, at least for an human worker 'hpea'.
But if the unit doesn't stay more than an instant it doesn't crash, or in other words, when the event "an unit leave the entire map", you can move the unit inside the entire map and then it doesn't crash (tested inside a trigger action).

But then, you don't need to use GetWorldBounds, since an unit can't be created outside the playable map area anyway, you just have to check if the unit has already an index or not.
But if you use GetWorldBounds instead of bj_mapInitialPlayableArea, it will have less checks.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Just a note that tending to this thread is on my to-do list. I'll get around to it when I have some reasonable time.
Hmm I wanted to use this for simply attaching a struct to a unit.
But is it even possible to attach a struct that has variable arrays at any time to a unit and not just on creation with AIDS?
With HSAS I just did s.th. like AttachStructBlablabla(unit,struct)

If it is possible may you give an easy example?^^
In your struct, put [LJASS]//! runtextmacro PUI()[/LJASS]
Read the PUI documentation for more help with this. PUI is a different system written by Cohadar, but AIDS supports all of its features (because you cannot run both).

Alternatively, just use [LJASS]set SomeStructArray[GetUnitId(myUnit)]=myStruct[/LJASS] etc. This is not a bad idea either. GetUnitId returns a value for that unit between 1 and 8191. :thup:
 

Jesus4Lyf

Good Idea™
Reaction score
397
>Does it support lot of variable with big arrays?
I assume you mean "struct instances with big arrays".
If you use either of these:
In your struct, put [LJASS]//! runtextmacro PUI()[/LJASS]
Read the PUI documentation for more help with this. PUI is a different system written by Cohadar, but AIDS supports all of its features (because you cannot run both).

Alternatively, just use [LJASS]set SomeStructArray[GetUnitId(myUnit)]=myStruct[/LJASS] etc. This is not a bad idea either. GetUnitId returns a value for that unit between 1 and 8191. :thup:
then your regular struct instance limits apply. If you use "AIDS structs", then you may not use array members at all.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • 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