• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Snippet] Dummy Reuser

I tried to make this system a year ago and I failed, and in this system it did the same problem that make system a failure.

Here the problem. I create a dummy with revive effect and I rotated it to 90 deg. When I reuse it, the dummy takes time to face to another location.

Hope you will find a way out of this.

Bribe's dummy system keeps additional copies of dummies facing particular angles so that when it reuses a dummy--it'll use a dummy with a similar facing as your end goal, so that allows you to have pretty good results as far as facing/orientation goes.

If you don't care about the pitch angles provided by vexorian's dummy model, then you can achieve instant facing with a special model + technique:
http://www.wc3c.net/showthread.php?t=105830
 
It's just simple as this(my algorithm)

- Create a table for normalizing angle, where this table will contain dummies for every angle division(360/n, where n is the number of angles for normalizing)
- Create dummies for each angle 360/n on initialization
- Get dummy based on normalized angle given for the player(eg. I requested 9 and we have 36 divisions, this will be normalized to 10 degrees, the system then gets a dummy for it). After normalizing, make the dummy face that angle(e.g. given 9 degrees, make 10 degree dummy face it)
- If no dummies are available(all of them are in use or the angle is too far to be normalized from the available dummy), create a new dummy instead.
- When the dummy is "destroyed", return it to the place where all dummies are then normalize it's facing
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The best algorithm was the one I came up with several years back. Not only does it do what people are talking about, but it keeps the collections of dummies as equal as possible. This means that if there are 500 dummies in the recycler and you always get angle 90, it'll end up using all 500. The others would only use a small subset of them. It also does this in O(1) >.>. The thing's on GitHub. Google nestharus, it'll be the first link. No other system does this ^)^.

~ Data Structa Masta
 
The best algorithm was the one I came up with several years back. Not only does it do what people are talking about, but it keeps the collections of dummies as equal as possible. This means that if there are 500 dummies in the recycler and you always get angle 90, it'll end up using all 500. The others would only use a small subset of them. It also does this in O(1) >.>. The thing's on GitHub. Google nestharus, it'll be the first link. No other system does this ^)^.

~ Data Structa Masta

The Masta.


Btw, I get that you use Stack for every angle, but what about Queue? is this for double-ended queue?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
It's just simple as this(my algorithm)

- Create a table for normalizing angle, where this table will contain dummies for every angle division(360/n, where n is the number of angles for normalizing)
- Create dummies for each angle 360/n on initialization
- Get dummy based on normalized angle given for the player(eg. I requested 9 and we have 36 divisions, this will be normalized to 10 degrees, the system then gets a dummy for it). After normalizing, make the dummy face that angle(e.g. given 9 degrees, make 10 degree dummy face it)
- If no dummies are available(all of them are in use or the angle is too far to be normalized from the available dummy), create a new dummy instead.
- When the dummy is "destroyed", return it to the place where all dummies are then normalize it's facing

I did exactly this in MissileRecycler and Nestharus expanded on it for his more complex version
 
Top