View Single Post
Old 12-19-2008, 01:01 AM   #30
Evil Emoticon
moyack's Avatar

Respected User
Project Leader: PoC
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack

Originally Posted by cohadar

Ok I see some of you people really need a mathematical explanation,
so here it is:

Lets suppose we have a unit whose handle number is 'u001'
Now you attach to that unit some data.

During the course of spell before we get to retrieve that data 
the unit 'u001' dies, decays and it's handle gets recycled.

Now somewhere on the map a new unit is created,
and that new unit get a recycled handle 'u001'

After that we decide to retrieve units data and continue our spell execution
using a wrong unit - FUCKUP

This cannot happen with PUI.
well, it can happen, but it would happen if the code that uses the attaching procedure doesn't take into consideration the unit death. So the problem is not gamecache on units but the coder if it doesn't take into account that situation. I take that situation into consideration using the buff, because as you know, a buff is turned off if the spell duration is reached, or when a unit dies or when is debuffed. In my code, by using the buffs I take in account these scenarios making the code reliable.

Now about your other arguments...

If groups get too large IsUnitInGroup() gets slow.
Well, and doing a full code that search on units can be faster than a native function? I don't think so...

You would also have to use that refresh-group thing that griffein made.
What refresh group?? Did I miss something... EDIT: found it:

And sometimes you want to add some unit-property to all units on the map preferably with some default value.
Spells are not the only things that need custom unit properties you know.
Physics engine, Buff engine, DamageDetection engine....
Yes, sometimes, but attaching a struct data to a unit is not a big deal regardless of the attaching system, IF AND ONLY IF THE USER CODES PROPERLY.
moyack is offline   Reply With Quote