System Advanced Indexing & Data Storage

Romek

Super Moderator
Staff member
Reaction score
960
> 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
396
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
396
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
396
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
176
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
396
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
396
>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.
  • The Helper The Helper:
    Happy Sunday!
    +1
  • The Helper The Helper:
    I will be out of town until Sunday evening
    +1
  • The Helper The Helper:
    I am back! Did you miss me LOL
    +1
  • jonas jonas:
    where did you go?
  • The Helper The Helper:
    Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
    +1
  • The Helper The Helper:
    It was a lot of fun. The RV was bad ass
  • jonas jonas:
    That sounds like fun!
    +1
  • The Helper The Helper:
    it was a blast!
  • The Helper The Helper:
    I am going to post the Youtube of the investigation in the forums when it is ready
    +1
  • jonas jonas:
    cool!
  • vypur85 vypur85:
    Sounds cool TH.
  • tom_mai78101 tom_mai78101:
    I was on a Legend of Zelda marathon...
  • tom_mai78101 tom_mai78101:
    Am still doing it now
    +1
  • jonas jonas:
    which one(s) are you playing?
  • jonas jonas:
    I played a little bit of the switch title two weeks ago and found it quite boring
  • The Helper The Helper:
    just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • The Helper The Helper:
    We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
  • The Helper The Helper:
    Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
    +1
  • Ghan Ghan:
    Beep boop
    +1
  • The Helper The Helper:
    hears robot sounds while 250 bots are on the forum lol
  • The Helper The Helper:
    Happy Saturday!
    +1

    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