Standard Libraries

57005

New Member
Reaction score
0
Hi together,

i decided to get into jass few days ago, and it doesn't seem to hard to me since there are plenty of good tutorials out there and i'm a programmer anyway.

But i don't like to start with just knowing the basics of how the programming in jass works, i want to dive into my first jass-heavy map as good prepared as possible.
For me thats a question of standard Libraries. I've read around and found many different Libraries and such, but rarely they stated reasons for the beginner to use them, or there where different libaries trying the same thing etc.
So what are very useful Libraries to include in practically every complex map? And more important: Why are they so important, can you give some practical examples?

I'd be happy to collect all the info and merge them into a well organized form.
 
And more important: Why are they so important, can you give some practical examples?

The code is already there, well tested, and usually efficient. All you have to do is copy/paste it into your map. If you want to re-write all your own code, go for it.

Almost every complex map will need a unit indexer, I recommend AIDS.
 
I'm the only one here who care about structs extended array limitations ?
If one day i would use an unit indexer, AutoIndex would be my choice or UnitIndexingUtils.
 
The code is already there, well tested, and usually efficient. All you have to do is copy/paste it into your map. If you want to re-write all your own code, go for it.

oh you must have misunderstood me, all those are the usual qualities when i think of "standard library" anyway.

I meant what is important about Library X, why has it been made? What are typical practical examples where the use of such a library is either needed or recommended

it would be nice if you'd explain this for AIDS, like giving an example of a real map situation where it's typical to use AIDS. like where do i need unit indexing to begin with?

I'm the only one here who care about structs extended array limitations ?
If one day i would use an unit indexer, AutoIndex would be my choice or UnitIndexingUtils.

and why would that be? what are some practical examples where the limitations of AIDS cause problems?
 
You can't use array members with structs extends array.

So what would be a practical example of where i'd have to use array members? Which situation in a map would need that? or is it only structural overhead of code design?
 
Depends what you want to do.
I had the need at least :p

It depends what you want to code and how do you achieve it, there is not a generic way where you absolutely need an array member, it's all up to you.
 
You are doing it wrong way now.

This is how you should do it:

1) Think what you wanna do

2) Find out how to do it.

3) Find out systems that do it for you or help you to do it.


edit. About UnitIndexing systems: Id use AutoIndex or maybe some home made script depending on how I do my stuff in my map.
AIDS is some PUI and AutoIndex hybrid. It exists because of those AIDS structs, which are something I dont find useful.

But if you like AIDS structs then you should naturally use AIDS.

edit2. wc3c.net script section is a good place to go shopping. Theres loads of cool systems and scripts in there.

Its just that when making a map its usually easier to do your own scripts, because systems try to be generic and work for every situation so they end up doing load od stuff you dont really need in your map.

In other words: you know better what your map needs, thats why you can usually write systems that work better for it than use systems made for no specific map.

edit3.
For example: if you make a hero defence map, where you create bunch of guys who attack to players base. When one wave has been destroyed, another spawns.

You dont need any indexing system for that. Every time you create a wave you can index it manually. Who idiot would actually use some periodic timer leave detection ( PUI ) or undefend thingy ( AutoIndex ), when you dont need them at all?

( Well, maybe if he is as lazy as me and wants to save time time by doing some copy&pasta, but I think you still got my point. )
 
Depends what you want to do.
I had the need at least :p

It depends what you want to code and how do you achieve it, there is not a generic way where you absolutely need an array member, it's all up to you.

thats exactly what i want to get to know in this thread: What where you doing that you needed that library?

wc3c.net script section is a good place to go shopping. Theres loads of cool systems and scripts in there.

Its just that when making a map its usually easier to do your own scripts, because systems try to be generic and work for every situation so they end up doing load od stuff you dont really need in your map.

In other words: you know better what your map needs, thats why you can usually write systems that work better for it than use systems made for no specific map.

for those places i made this thread, just typical examples of your everyday's map, and what standard libtraries would be good in that place.

if it is something really special, i'd write my own things anyway instead of using a not thoroughly tested non-standard library by someone else just to save some coding time.

edit:
edit3.snip
if i understand you correctly you are basically saying: everytime one needs to react to specific unit events (contrary of unit type events and such) an indexing system is the best way.

is this correct?
 
Okay, well check these systems at least ( I just listed all I remember and which are cool ) :


wc3c.net:

Basic utilities: TimerUtils, GroupUtils, Table.

Data structure stuff: theres loads of that. ListModules, Pools, Stacks..

Unitindexing and Stuff: AutoIndex, StatusEvents.

Camera and TerrainFog thingies I think are cool: Oppicam and RegionalFog

Also theres damage detection systems, buff systems and other cool stuff.

Also SpellEvent is quite useful and cool.

Damn, theres too many of them. Cant list them all.

hiveworkshop.com:

UnitProperties ( probably the coolest system ever )


edit. UnitIndexing is mainly for this:

JASS:


struct array SomeData

//attach data to unit:
set SomeData[GetUnitId(unit)]= something

// get data:
set something=SomeData[GetUnitId(unit)]


You just use units id as an array index to find some unit related data for some spells or stuff.
 
Okay, well check these systems at least ( I just listed all I remember and which are cool ) :


wc3c.net:

Basic utilities: TimerUtils, GroupUtils, Table.

Data structure stuff: theres loads of that. ListModules, Pools, Stacks..

Unitindexing and Stuff: AutoIndex, StatusEvents.

Camera and TerrainFog thingies I think are cool: Oppicam and RegionalFog

Also theres damage detection systems, buff systems and other cool stuff.

Also SpellEvent is quite useful and cool.

Damn, theres too many of them. Cant list them all.

hiveworkshop.com:

UnitProperties ( probably the coolest system ever )

thanks for the list, but just compiling a list of Library Names is not really what i was looking for in this topic.

it'd be nice if you could add why you needed those libraries:
-what's the advantage of using timerutils over built in timer?
-Whats the purpose of GroupUtils where is it used?
-Table?
-Whats the purpose of StatusEvents, what's a typical reason to use it?
-Whats the general idea and reason behind damage detection and buff systems?
-And why exactly is SpellEvent so useful?

no need to list them all, just tell me a bit more about those you use most regularly, others will fill in the gaps

edit. UnitIndexing is mainly for this:

JASS:


struct array SomeData

//attach data to unit:
set SomeData[GetUnitId(unit)]= something

// get data:
set something=SomeData[GetUnitId(unit)]


You just use units id as an array index to find some unit related data for some spells or stuff.

thats a perfect explanation, exactly what i was looking for, thanks.
but whats the big difference now in the different indexing systems that Troll-Brain talked about?
 
Well all they index units but they do stuff like detecting unit removal differently:

PUI uses fast periodic timer for checking every units userdata all the time.
AutoIndex uses defend ability and registers undefend orders.

( AIDS seems to have options for both of those now. )

edit.

-what's the advantage of using timerutils over built in timer?

TimerUtils is used to recycle timers, which is good to avoid some weird random bugs and its alse better performance wise, since creating handles is quite slow. It also does data attaching stuff for timers.

-Whats the purpose of GroupUtils where is it used?
It has some basic group related functions to help with groupenum stuff and it also recycles your groups.


Table used to be a wrapper for gamecache with H2I, but now since we have hashtables for that, its just a hashtable wrapper thingy. Its for basic data attaching, and many old systems from gamecache time work today, thanks to new table version.

-Whats the purpose of StatusEvents, what's a typical reason to use it?

It just adds some new unit related events. Theres also this Transport Events which detects when unit is loaded or unloaded to transport thingy. Both require AutoIndex.

-Whats the general idea and reason behind damage detection and buff systems?

Damage detection is quite useful for many reasons. ( Actually those systems exist just because Blizzards natives are so retarded ) Its basicly just so you know when some unit takes damage by how big amount and who did it.

Most people dont seem to be liking buff systems, but Im actually making one now by myself too. Its basicly for handling all timed effects. ( Like adding damage to unit for X seconds or stuff like that. )

-And why exactly is SpellEvent so useful?

It fixxes Blizzards fucked up spell event responses and also makes stuff work lil bit faster than doing it with traditional way.


edit I forgot to mention that theres also many cool systems for moving units. Physics systems and knockback systems and stuff like that. You can do pretty impressive looking stuff with those.
 
thanks for your effort again that really helps me.

Damage detection is quite useful for many reasons. ( Actually those systems exist just because Blizzards natives are so retarded ) Its basicly just so you know when some unit takes damage by how big amount and who did it.

So what are the most typical/best working Damage Detection Systems out there?

Most people dont seem to be liking buff systems, but Im actually making one now by myself too. Its basicly for handling all timed effects. ( Like adding damage to unit for X seconds or stuff like that. )
why should anyone dislike those? from my POV using buffs for timebased things is a great advantage for people playing the actual map later on

It fixxes Blizzards fucked up spell event responses and also makes stuff work lil bit faster than doing it with traditional way.
hehe i think i know those problems already, so what are the best spellevent systems out there?
 
So what are the most typical/best working Damage Detection Systems out there?

Dont know really, I can just give some examples: Detecting attacks, blocking damage, doing lifesteal and critical strike stuff and things like that. Since most maps have lot of combat all this damage stuff plays major role naturally.

why should anyone dislike those? from my POV using buffs for timebased things is a great advantage for people playing the actual map later on

Dont know. Some people just prefer to make stuff in hard and bad way I guess. Also the only real buff system for long time, ABuff, is hideosly complicated, which of course scares people away. ( Actually theres also Dusks new inuitive buff system, but I didnt really like it for some reason. It lacked some features I want I guess )

hehe i think i know those problems already, so what are the best spellevent systems out there?

Anitarfs SpellEvent is the only one I know that fixxes that crap, so its only one worth of using right now.
 
I love using Rising Dusk's inuvative Damage Detection library, since you can modify any aspect of damage taken/dealt
 
You should just search for what you need and look at their threads to see why you should use it instead of whatever.
 
>I'm the only one here who care about structs extended array limitations ?
There are none. Even array members can be done in AIDS. It just takes some thought... the tradeoff is efficiency and typecasting, which matters.

AIDS is not only useful for AIDS structs. It is very efficient.

AIDS structs are extentions of units which contain data. The lifetime of the data is the same as the lifetime of the unit, except you can also "lock" a struct which provides the ability to keep that data alive a while longer, until all locks are released.

Example: You want to store, for every unit on the map, the position at which the unit spawned (let's say for a creep revival system or something).
JASS:
struct SpawnData extends array
    //! runtextmacro AIDS()
    real x
    real y
    private method AIDS_onCreate takes nothing returns nothing
        set this.x=GetUnitX(this.unit)
        set this.y=GetUnitY(this.unit)
    endmethod
endstruct

Done. Now you can access this stuff:
JASS:
function GetUnitSpawnLoc takes unit u returns location
    local SpawnData d=SpawnData<u>
    return Location(d.x,d.y)
endfunction</u>

In AIDS, [LJASS]local SpawnData d=SpawnData[/LJASS] will compile to [LJASS]local integer d = GetUnitUserData(u)[/LJASS] which makes it more efficient than any other unit attachment method.

As for damage detection systems, only one works correct for recursive damage events as far as I remember, which is Damage. This has an "any unit damaged" event, from which you can do things like damage blocking in one line: Damage_Block(amount). This works if the unit would otherwise die, or anything... if you obey the instructions nicely, you can even do Damage_GetType() or things like Damage_IsSpell. So you could make a shield ability that only blocks magic damage, for example. Or you could make an AoE in which all damage is randomly redirected to other units. In things like IDDS, (last I checked) if you have an item that returns physical damage when hit by a spell, and then something else fires off the damage event, the DamageType recognition will return that the damage is physical for the next thing that fires, not spell. Damage supports this sort of situation correctly instead. This system requires AIDS.

T32 is hands down the fastest timer "attachment" to date. It is useful only in one specific situation - periodic effects. It fires 32 times a second, allowing you to do smooth unit slides and such. This is what you should use for smooth effects which work with increments, such as projectiles, sliding units, jump functions, etc.

There are some other things you should know also. How to use unit groups is one thing. Not listening to system authors advertising their systems is another. ;) (Jokes, but all the systems I mentioned are mine.)

Aside from these things, TimerUtils is vital more or less, but that was mentioned.

For a simple example that a programmer may appreciate:
JASS:
struct FlyingSystem extends array
    private static constant real DISTANCE = 200 * T32_PERIOD
    private static method AIDS_filter takes unit u returns boolean
        return IsUnitType(u,UNIT_TYPE_FLYING)
    endmethod
    //! runtextmacro AIDS()
    private method periodic takes nothing returns boolean
        local real r = GetUnitFacing(this.unit) * bj_DEGTORAD
        call SetUnitX(this.unit, GetUnitX(this.unit) + Cos(r) * thistype.DISTANCE)
        call SetUnitY(this.unit, GetUnitY(this.unit) + Sin(r) * thistype.DISTANCE)
        return GetWidgetLife(this.unit)&lt;=0.405 // Ever tried resurrecting a flying unit?
    endmethod
    implement T32
    private method AIDS_onCreate takes nothing returns nothing
        call this.startPeriodic()
    endmethod
endstruct

That is a system written in AIDS/T32. It makes it so flying units never stop moving, and fly a bit faster when they're issued orders.
 
Ofc you can use hahstables but naturally you can't use array members with structs extends array.
Thats why i don't like it.
 
>Ofc you can use hahstables but naturally you can't use array members with structs extends array.
Nono.
JASS:
struct IntArray6
    private integer array myArray[6]
    method operator[] takes integer i returns integer
        return this.myArray<i>
    endmethod
    method operator[]= takes integer i, integer val returns nothing
        set this.myArray<i>=val
    endmethod
endstruct

struct MyArrayUnitData extends array
    private IntArray6 dataz
    
    private method AIDS_onCreate takes nothing returns nothing
        set this.dataz=IntArray6.create()
    endmethod
    private method AIDS_onDestroy takes nothing returns nothing
        call this.dataz.destroy()
    endmethod
    method doThings takes integer i returns nothing
        set this.dataz<i>=this.dataz[i+1]
    endmethod
endstruct</i></i></i>

But typically you use linked lists when you're attaching. A case where you want an x sized array like that is rare (I don't come across it).

PS. I think in vJass there is much nicer syntax for this. Something like [LJASS]type IntArray6 extends integer array[6][/LJASS].
And there is nothing to stop:
JASS:
struct RealData
    // members
endstruct

struct Wrapper extends array
    RealData d
    
    private method AIDS_onCreate takes nothing returns nothing
        set this.d=RealData.create()
    endmethod
    private method AIDS_onDestroy takes nothing returns nothing
        call this.d.destroy()
    endmethod
endstruct

That will be the same efficiency as AutoIndex then. :p

PS. If it is that big a deal, I can release a new module for non-array extending structs.
 
You are doing it wrong way now.

This is how you should do it:

1) Think what you wanna do

2) Find out how to do it.

3) Find out systems that do it for you or help you to do it.

This is the way to do it. Every single one of the systems I use/create are there to fill a need. The entire point of functions/libraries is re-usable code, that is, to avoid rewriting the same things over and over again. When you see yourself doing this, look for a system that will prevent this, or build a system/template for yourself.

I map using very few imported systems, simply because I create templates and I make all my systems work together. There isn't really any required systems/essential systems, though there are a few that you'll probably need.

Generally, you'll be making custom spells. For these, you're usually doing some periodic effect, and a timer attachment system is usually the easiest way to do it. There's a ton out there, though my first recommendation would be KT2 because it's simple. I personally use a modification of CSData (I recently changed it, but I think it's become direct hashtable use) and standard timers.

Some people find a need for Unit Attachment as well. I personally use the PUI section of AIDS (either would work, I'm just using it to attach spell instances to the caster).

I also use the Multi-Kick library I created for online tests/games (I don't like having to deal with evil people, especially if I created/hosted the game), a modification of emjlr3's Handle Counter, and Advanced Strings (requirement for Multi-Kick, to create commands, and to easily display colored strings).
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      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