System Advanced Indexing & Data Storage

Discussion in 'Systems and Snippets' started by Jesus4Lyf, Jun 29, 2009.

  1. Darthfett

    Darthfett Super Mod

    Ratings:
    +614 / 0 / -0
    Are you kidding? I think this, aside from a timer system is the system I use most in my maps.
     
  2. Romek

    Romek Super Moderator Staff Member

    Ratings:
    +961 / 0 / -0
    If you're not capable of seeing why indexing systems are good, then you're clearly not skilled enough to be using one anyway. In any case, it's not a problem with the system, but a problem with you. I'm confident that eventually you'l realise just how useful unit indexing systems are.

    > u never dream of doing this crap on trees so why the special treatment for units?
    How often do you store or do actions with trees?

    > best reason to use it would be it lets you use the damage system...can't you make a version that focuses solely on that?
    The purpose of this is to index units. It has a few little extras (which the Damage system uses anyway), but it all comes down to giving each unit a unique integer. You can't get any simpler than that.

    > we have multuple flavors of timerutils why not for aids like an aids
    Note to self: Add a strawberry and vanilla flavour for all systems regardless of whether they need it or not, just to keep some members happy.
     
  3. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    >vanilla flavour for all systems
    I'm listening :D

    Also, AIDS is incredibly useful. I don't think you're good enough to understand its use.
    JASS:
    
    //! zinc
    library SwapUnit {
        struct Data {
            static unit LastEnteredUnit;
            static boolean Entered;
            real x ;
            real y;
    
            method AIDS_onCreate() {
                if not Entered {
                    Entered=not Entered;
                    thistype.LastEnteredUnit=this.unit
                    return;
                }
                this.x=GetUnitX(thistype.LastEnteredUnit);
                this.y=GetUnitY(thistype.LastEnteredUnit);
                SetUnitX(thistype.LastEnteredUnit,GetUnitX(this.unit));
                SetUnitY(thistype.LastEnteredUnit,GetUnitY(this.unit));
                SetUnitX(this.unit,this.x)
                SetUnitY(this.unit,this.y)
                thistype.LastEnteredUnit=this.unit;
            }
            method AIDS_onInit() {
                Entered=false;
                LastEnteredUnit=null;
            }
            //! runtextmacro AIDSZinc();
        }
    }
    //! endzinc
    There may be (probably is) an error, but this took me a minute or two. How long would it take you if you had to handle all the triggers yourself and code it? Maybe 10 minutes, and that's not because it's hard, it's because it's annoying.
     
  4. kingkingyyk3

    kingkingyyk3 Visitor (Welcome to the Jungle, Baby!)

    Ratings:
    +216 / 0 / -0
    AIDS alone is noob.
    But the AIDS struct is very very useful. :D
     
  5. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    green panda bear in shopping cart can i ask you what you are proposing to use that bit of code for?


    responses in color.


    hmm...i don't know hashtables. can you point me in the direction of where i can learn them? i remember blizzard supporting them and reading the documentation that came with the patch update but i didn't understand anything.

    if you want an idea of what systems i basically understand, check out my map the demon hunt tournament hosted at hiveworkshop. it's the most up to date version, and so i weeded out systems i don't use for their lack of purpose, so it excluded this system. at any rate, viewing the systems i am using in that should give you a starting point to understand what i understand. of course you can check out the other map referenced in the signature...but currently the trigger editor in that one is a big mess, so you might stumble around there.

    last i checked thehelper bans use of signatures except for use by moderators, and i can frankly understand why with the way a lot of users would abuse it...but i wouldn't abuse the signature feature and i wish i could have the link up but that's the way it is...
    no, i'm not kidding you, and if you are going to talk like that then i want some open source food, now!
    please feed me your code!
     
  6. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    >green panda bear in shopping cart can i ask you what you are proposing to use that bit of code for?
    Every time a unit enters the map, it gets swapped with the unit that last entered the map.

    >hmm...i don't know hashtables. can you point me in the direction of where i can learn them? i remember blizzard supporting them and reading the documentation that came with the patch update but i didn't understand anything.
    http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/

    >no, i'm not kidding you, and if you are going to talk like that then i want some open source food, now!
    His entire map script is online.
    https://github.com/Darthfett/Forest-CTF

    Can you please point out your argument, exactly? From what I understand, you are saying AIDS is not useful. But you don't seem to know vJASS very well. And that's not an attack on you, that's a fact.
     
  7. NeuroToxin

    NeuroToxin New Member

    Ratings:
    +46 / 0 / -0
    If you're not capable of seeing why indexing systems are good, then you're clearly not skilled enough to be using one anyway. In any case, it's not a problem with the system, but a problem with you. I'm confident that eventually you'l realise just how useful unit indexing systems are.
    someone pushed the rude button on his word processor today? yes.
    > u never dream of doing this crap on trees so why the special treatment for units?
    How often do you store or do actions with trees?
    don't change the subject. i'm talking about units, not trees.
    > best reason to use it would be it lets you use the damage system...can't you make a version that focuses solely on that?
    The purpose of this is to index units. It has a few little extras (which the Damage system uses anyway), but it all comes down to giving each unit a unique integer. You can't get any simpler than that.
    if it's so simple then why is the code SOOOO long? have you seen itemdex? vexorian may not have written unit indexing, but he was smart enough to keep the system he did write for indexing simple.
    > we have multuple flavors of timerutils why not for aids like an aids
    Note to self: Add a strawberry and vanilla flavour for all systems regardless of whether they need it or not, just to keep some members happy.now your rudeness is just over the top. this isn't even your system. why don't you crawl out from under your umbrella of snobbery and we can have a REAL DISCUSSION?

    Buddy, you made some pretty idiotic things said, and you don't even capitalize right, He's also an administrator, so he can say whatever the hell he wants. I personally was as ignorant as you were until I actually used it. Also, Green panda Bear is not his name. Its tooltiperror, Respect your seniors bud.
     
  8. Nestharus

    Nestharus o-o

    Ratings:
    +83 / 0 / -0
    Ok... let's say that you want to attach something to a unit. Remember the old handle attachment with H2I and etc?

    There are two ways to do that... one way is to use the unit's user data ( SetUnitUserData) and the other way is to do it via a hashtable/table call SaveInteger(myHashtable,GetHandleId(myUnit),0,value)

    Now, the hashtable call with the get handle id call is obviously way slower... the load call is also way slower than the equivalent GetUnitUserData call.

    By giving all unit's on the map a unique id stored in the user data, one can then attach structs via that id where the struct's instance is that id. This speeds the map up a bit and is actually very lightweight (the indexing/deindexing have a very small overhead).

    Virtually all maps attach something to a unit, meaning that virtually all maps use some sort of unit indexer, whether that be AutoIndex, AIDS, or UnitIndexer.

    So it's not just about damage... you could attach whatever to a unit from a custom buff in a spell to a custom inventory to just random data like the unit's quest info or something... any time you want to attach data to a unit, you use a unit indexer =).

    There have been attempts at an item indexer, but there won't be a good one until Bribe finishes his little project =P.
     
  9. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    i didn't even know thehelper had war3 editor help back when that was popular. i was busy struggling with learning jass by the time the patch that released hashtables came out.
    ok so my argument is you can make a map just fine without aids? check my map, it's without bugs and isn't even version 1.0 yet. meanwhile we have this admission from darthfett about his map which you linked me to:
    "Currently the game is version 2.0 alpha. It's not in any way ready for testing, and has many bugs and unimplemented \
    features. If the code is currently in a compilable state, you can play the game as a preview of what is to come."
    and you have the audacity to question my argument? lol. go you. you're running in the wrong direction, btw.

    oh and, thanks for the link. this is actually fascinating what he posted.
     
  10. Darthfett

    Darthfett Super Mod

    Ratings:
    +614 / 0 / -0
    The map is unfinished because at one point it was working, but is in the process of having a very complicated AI, as well as being overhauled. There was a working version that used AIDS, and was fun. It's possible to make anything without any resources, it merely means hardcoding everything you need into the map, which means your code is either reinventing the wheel, or just completely not reusable.
     
  11. Romek

    Romek Super Moderator Staff Member

    Ratings:
    +961 / 0 / -0
    > someone pushed the rude button on his word processor today? yes.
    Would that be referring to me?

    > don't change the subject. i'm talking about units, not trees.
    That's quite immature. You quite clearly started talking about trees in the quote I replied to.

    > if it's so simple then why is the code SOOOO long? have you seen itemdex? vexorian may not have written unit indexing, but he was smart enough to keep the system he did write for indexing simple.
    It's simple to use. There's effectively only one function that's exported in the system. How the code actually works is irrelevant, though you can be sure it works well.

    > last i checked thehelper bans use of signatures except for use by moderators, and i can frankly understand why with the way a lot of users would abuse it.
    Signatures aren't banned for anyone. It's something you earn around the forums for being helpful and for contributing positively. Moderators and higher get signatures by default, of course. Though the majority of members with signatures aren't moderators.

    Also, stop being so childish. You still seem to be under the impression that any code that is long or that you can't understand is rubbish. You have no reason to bash any systems, especially if you don't know what it does (take a hint from other members that are quite happy with it?). Not every system here is an absolute necessity in every map you make either, so if you can't find a use for something, chances are you simply don't need it. Also, being rude to those that help you isn't the way forward. As somebody mentioned before, we're not out to get you. Quite the opposite in fact - we're here to help. You're not going to learn much if you believe you're superior to everyone else here either.
    Cut it out.
     
  12. Rllulium

    Rllulium New Member

    Ratings:
    +10 / 0 / -0
    Oh god damnit, I've used this library hundreds of times before, why does it throw syntax errors at me when I try to import it...

    I can't live... err, map... without this Library!

    EDIT: Oops, silly me. Guess I shouldn't lament my fate before I really need help.
     
  13. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Gah, you're all making me read so much!! XD

    In regards to the AIDS flavouring, AIDS was originally written to support Damage, and almost all the functionality in AIDS is, in fact, used in Damage. If you look closely, there is flavouring in AIDS. There's the use periodic timer option. Depending on whether you use it or not, one chunk of code is essentially removed/unused. The irony is that this "flavouring" of sorts is what makes the code large, which was the suggestion you listed next to wondering why the code is large/complex. :p

    AIDS automates creation/cleanup of unit data and things attached to units, which is why it is important to many mappers. Damage, for example, uses it to attach a trigger to each unit automatically (without which the functionality of Damage is not possible). It is nice because it also cleans up the data at the right time without having to write the code to hook units being removed and manage the cleanup so much yourself. That's why at high levels of mapping, AIDS is a good convenience. :)
     
  14. luorax

    luorax Invasion in Duskwood

    Ratings:
    +67 / 0 / -0
    Where's the like button? :D

    BTW this system is one of the most useful system ever made. I use it each time I create a system that works with units: vertex colors, taunt, inventory, spell books.... the list is endless.
     
    • Like Like x 1
  15. vuongkkk

    vuongkkk New Member

    Ratings:
    +1 / 0 / -0
    JASS:
    function GetUnitIndex takes unit u returns integer


    This function does not have any filter. Why, Jesus4Lyf?
    When a unit enter map, your sys have a filter to prevent massive indexing at func IndexEnum (To exclude unexpected unit from this system)

    JASS:
    private function UnitIndexingFilter takes unit u returns boolean


    I supposes this function is the rule for the entire of AIDS. Should you place this filter func at function GetUnitIndex too?
    Or I misunderstood your mean, didnt I ?
     
  16. Bribe

    Bribe vJass errors are legion

    Ratings:
    +67 / 0 / -0
    I think you misunderstand. GetUnitId should always be used, not GetUnitIndex. GetUnitIndex should only be used if you want to index a previously-filtered unit.
     
  17. vuongkkk

    vuongkkk New Member

    Ratings:
    +1 / 0 / -0
    OK, what should I use if i want to index a placed unit in WE? In this case, use GetUnitId with debug mode you can see AIDS error mes ;)
     
  18. Bribe

    Bribe vJass errors are legion

    Ratings:
    +67 / 0 / -0
    GUI-placed units are indexed by this system.

    1. Are you using SetUnitUserData in any other part of the map?
    2. Are you calling GetUnitId from a library which initializes before AIDS?

    If you change your GetUnitId calls to after map-initialization, and that fixes the problem, then that means that the latter is the problem. You need to have your library require AIDS. I'm not sure if GetUnitId will return 0 with AIDS if called from a module initializer.
     
  19. mysteriis

    mysteriis New Member

    Ratings:
    +0 / 0 / -0
    Im really interested in using this, but everytime I save the map with the "//! external ObjectMerger w3a Adef AIDS anam "State Detection" ansf "(AIDS)" aart "" arac 0" line it shows THIS ERROR, although it saves the map.

    Tried with JNPG 5d, and 6a, excluding and reinstalling multiple times and got the same. No antivirus or anything that could possibly interfere.

    Please, tell me whats this error about and the most important, is the system going to work or not with this error, and how can I fix it.

    Thanks in advance.
     
  20. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    Delete the "!" at the start of the line as if it were a comment so that it does not get executed.

    Then, open the AIDS dummy map and copy the ability from that map into yours.
     

Share This Page