does still anyone use kattana's system?

13lade619

is now a game developer :)
Reaction score
398
random question..

is there anyone here who still uses kattana's local handle vars system?

if not.. why? is it inefficient or something?
and what are the advantages of the system you're using now?

IMO, it's still good since it's an all around attachment system that can attach any data to any handle.. especially structs..

i'm just interested 'cause i'm still using it and maybe there's a better one out there.
 

Viikuna

No Marlo no game.
Reaction score
265
Not because of gamecache, but because of I2H.

If you need gamecache, you should use Vexorians Table, it has nicer interface.
 

Trollvottel

never aging title
Reaction score
261
Actually there are no problems with kattanas if you use it correctly. Its fast enough for the most things. And if you use it for struct attachment there will be no bugs at all.
 

wraithseeker

Tired.
Reaction score
122
But it's interface isn't really nice and like Viikuna said, I2H is bad. I seen one of the debating of I2H in a thread in WC3C where Vex talked about Icefrog using I2H and got some debug messages sometimes.
 

Flare

Stops copies me!
Staff member
Reaction score
662
what is I2H exactly and what's bad about it?
This should be informative, particularly this post.
rain9441 @ WC3C said:
Heres how the bug works:

Suppose you have a unit, a footman

You set FootmanIndex = H2I(Footman)
you call RemoveUnit(Footman).
you set Footman = null

Now the game recycles the Footman unit index that you have stored in FootmanIndex, and the next handle (or one of the many next) that is created gets the SAME handle index that the Footman has. This will also happen if the footman dies, decays, and gets recycled by the Wc3 engine as well.

Now lets say you set Footman = I2U(FootmanIndex). You now have a unit variable that isn't actually a unit, it is a Location! Uh oh! Call GetWidgetLife(Footman). Now you called GetWidgetLife on a Location! This is very bad, and is really unknown to what it specifically does, but it may crash (i never tried it).

So the act of calling I2H isnt actually bugged, its a reliable function, but the integer value you pass to I2H being corrupted causes the problems.

This problem is easily seen when storing H2I values in gamecache then nulling the handle variable. Then there is no guarantee that the I2H(gamecachevariable) call will give back the correct handle.

Theres one method that I know of that prevents this issue. When using H2I, make sure that you store not only the integer value it returns, but also store the handle variable. These must be stored in global variables, not gamecache. This will prevent the Wc3 engine from ever recycling the handle index until you null the handle variable.
Although, there are more problems supposedly associated with it, that's the first one I found with a good explanation
 

Trollvottel

never aging title
Reaction score
261
JASS:
library LHV
 
globals
    gamecache LOCAL_HANDLE_CACHE = InitGameCache("localhandles.w3v")
endglobals
 
// ===========================
private function H2I takes handle h returns integer
    return h
    return 0
endfunction
 
// ===========================
function LV takes nothing returns gamecache
    return LOCAL_HANDLE_CACHE
endfunction
 

 
function SetHandleInt takes handle subject, string name, integer value returns nothing
        call StoreInteger(LV(), I2S(H2I(subject)), name, value)
endfunction
 
 
function GetHandleInt takes handle subject, string name returns integer
    return GetStoredInteger(LV(), I2S(H2I(subject)), name)
endfunction
 
endlibrary


show me the I2H here.
 

Romek

Super Moderator
Staff member
Reaction score
960
It's still slow. :rolleyes:

And there are faster systems, with nicer interfaces and more 'features' available too.
 

Trollvottel

never aging title
Reaction score
261
JASS:
 	 It's still slow.

I've heard that GameCache is about 4 times slower than an array. Not very slow, is it?
and doesnt HSAS or HAIL (dont know which system) use Game Cache?
JASS:
And there are faster systems, with nicer interfaces and more 'features' available too.


I agree.
 

SFilip

Gone but not forgotten
Reaction score
634
> Not very slow, is it?
It is. Why use something slower when you don't have to?
 

Trollvottel

never aging title
Reaction score
261
I didnt say i use it... I just said its not too slow to use it. And it is 1 call per timer run - can it be that bad?
 

Romek

Super Moderator
Staff member
Reaction score
960
> and doesnt HSAS or HAIL (dont know which system) use Game Cache
Maybe as a backup or something, incase something goes wrong.
But otherwise, It's very unlikely.

I'm pretty sure ABC uses gamecache when there's a collision.
 

Trollvottel

never aging title
Reaction score
261
Maybe as a backup or something, incase something goes wrong.
But otherwise, It's very unlikely.
oh i think 1 of the system just stores values like H2I(h) - 0x10000000... in an array and if the value is above 8192 it just stores it in gamecache. but.... look a big map has about 5000 handles minimum at map initialization. look at the doodads etc. And everytime i tested a spell which used HSAS it lagged me to death -.-.
 

Azlier

Old World Ghost
Reaction score
461
Doodads are handles, now? I must test this, someday...
 

Trollvottel

never aging title
Reaction score
261
destructables are. i used the wrong word. but there are some maps which have thousands of trees, why do you think there is a destructable limit?
 

Viikuna

No Marlo no game.
Reaction score
265
I would still rather use Table.
Why?
Because it looks nicer.
And because most of recources in these days use it and not Handle vars.

And you dont really need gamecache too often anyways.

I use struct arrays and timer stacks for attaching timers.
I use UnitUserData for indexing units.

So I only rarely need Table for something.
 

Romek

Super Moderator
Staff member
Reaction score
960
Also, take into consideration that most current attachment systems were actually created to replace LHV, because it was slow and unsafe. So going back to using that because there's "nothing wrong with it", is a bit silly.

As Viikuna said, if you insist on gamecache, then at least go for Table.

Though the only time I need to use that is to attach structs to ID's or similar.

I use a static timer for attaching to timers.
PUI for unit attaching. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • jonas jonas:
    Oh, I see. I thought Chinese version of A-levels :D
  • jonas jonas:
    I've been using the translate app a lot on my phone. take a photo, translate. take another photo, translate again :D
  • jonas jonas:
    it also has voice translation, my colleagues sometimes use that
  • jonas jonas:
    You came during the 0 covid policy right? How'd you get through quarantine? Did you have some help with the apps and green codes?
  • tom_mai78101 tom_mai78101:
    If you have any Chinese you need help with, let me know.
    +1
  • vypur85 vypur85:
    @jonas Those were the things I did too. Translate app and VPN are always the most important things to have to survive. Lol.
  • vypur85 vypur85:
    Yea I came last year. I was quarantined for about 30 days. Fml. The first day of my quarantine was the eve of Chinese new year last year. Fml again... Lol.
  • vypur85 vypur85:
    @tom_mai78101 IIRC you're from Taiwan right.
  • The Helper The Helper:
    I thought China had cracked down on having any foreign teachers?
  • vypur85 vypur85:
    Yeah I've heard of the news before. My school is still actively hiring foreign teachers. Not sure how things work now.
  • The Helper The Helper:
    yeah it is hard to get reliable information about that kind of stuff
  • The Helper The Helper:
    but you are doing it so it is still doable
  • vypur85 vypur85:
    I think it doesn't affect existing foreign teachers. Then again, its still weird that my school is hiring.
  • The Helper The Helper:
    Happy Monday people hope everyone has a fantastic week!
  • Ghan Ghan:
    Happy Monday?! That's a contradiction.
  • jonas jonas:
  • jonas jonas:
    please put this in the news section, it's crazy
  • tom_mai78101 tom_mai78101:
    Technically, you can post in the Headline News. Just posted your news there.
  • tom_mai78101 tom_mai78101:
    I'm not aware of you not being able to post news.
  • jonas jonas:
    I think technically I can I just forget how
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    Happy Friday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday night!
    +1
  • vypur85 vypur85:
    Happy Sunday. Sigh. Work day tomorrow.
    +1

    The Helper Discord

    Staff online

    Members online

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top