• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Collision Collectable Items

Status
Not open for further replies.
Level 6
Joined
Nov 3, 2005
Messages
103
Items that are collected simply by walking over them, like the coins in Heroes of the Storm. I've noticed that trying to find the location of each individual dropped item and then searching the radius around it for the hero dramatically every 0.01 seconds drops frame rate, even if there's only 4 or 5 of the item on the map. I've tried switching it around, searching the area around each hero for the coins instead, but that approach requires that the items don't have the Locust ability. Maybe if there was a way to make a unit un-clickable without using the Locust spell.

Is there anyway that may work more efficiently than this? I already have enough performance hindering enemies on the map.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
first of all, there is really 0 reason to use 0.01 over 0.02
and there is no reason to use 0.02 over 0.03
the difference between 0.03 and 0.04 is noticeable though
that is why everyone uses 0.03 for all his intervals and sometimes (1/32 = 0.03125)

You should be able to use a linked list to add and remove items just like an item group and pick every unit within its range
that should do the trick
 
Level 10
Joined
Apr 4, 2010
Messages
509
You could use a "check if unit is walking" system, I think it's by Bribe. Then only pick units that are walking. Or you can make the coins have immolation/short range attack and if they damage anyone, kill the coin and give the unit that got damaged money.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You could use a "check if unit is walking" system, I think it's by Bribe. Then only pick units that are walking. Or you can make the coins have immolation/short range attack and if they damage anyone, kill the coin and give the unit that got damaged money.

I haven't tested this yet, but does the system (Bribe's) consider the unit "is walking" if you have an ability that move you to a location instantly, say, a Blink ?

OT
I don't think you would need a 0.01s of interval, even in spells we use 0.03.
For this system, try values higher than that, like 0.10~0.20 and see which fits perfectly in a "human sense".
Try first, but remember to register only the unit that actually uses this system (Units with Inventory - or any specifics unit in your map), don't register to all units in the map.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
but that approach requires that the items don't have the Locust ability
As far as I am aware items in WC3 cannot have abilities. They can give a unit abilities in the form of passives or a single active but they themselves are not subject to abilities.

Or are you trying to say you want units to be processed when nearby?

Lag can be minimized by staggering the checks. Instead of checking all items every 0.03 seconds you can check just 1-2 items every 0.03 seconds.
 
Status
Not open for further replies.
Top