Request : Dummy Recycling

13lade619

is now a game developer :)
Reaction score
399
since everyone is always complaining about 'recycle your dummy units' on systems.. can i request a simple recycling system?

here's a framework:

Code:
Global constant MAXDUMMIES = max amount of dummies in map
Global constant DUMMYTYPE = rawcode of dummy units.

function GetDummy() <-- returns a dummy unit to be used
function RecDummy(unit) <-- recycles the given dummy, when finished using it return it to list of unused dummies.
the system will just give you a unit to use, you do anything you want with it.
then return the unit to the unused list after.

*if there is already such system, direct me there :p.
 

tooltiperror

Super Moderator
Reaction score
231
Just use Jesus4Lyf's system, DummyCaster.
 

13lade619

is now a game developer :)
Reaction score
399
no not for casting.

it's for when we need some units to attach stuff too, like effect models.

for projectile systems / effect systems.

the system will just give you a unit to use, you do anything you want with it.
then return the unit to the unused list after.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
But DummyCaster is only limited on 0 second spell casting.

for projectile systems / effect systems.
xefx.
 

tooltiperror

Super Moderator
Reaction score
231
Use... does xe do dummies now? xe does everything.
 

Viikuna

No Marlo no game.
Reaction score
265
Aye. Youd need somekind of database thingy for getting each models death duration using model path as a key, in order to make your recycle timer to wait until the effect dummy is ready to be recycled..

Sounds awesome and hideously complicated to me.
 

13lade619

is now a game developer :)
Reaction score
399
Aye. Youd need somekind of database thingy for getting each models death duration using model path as a key, in order to make your recycle timer to wait until the effect dummy is ready to be recycled..

function setDeathTime(unit) ?, maybe..
and use some sort of ticker divisible by 0.03125.
 

Viikuna

No Marlo no game.
Reaction score
265
One timer per effect would be better, although it requires you to create quite many timers at the map init.

Then again, you also need to create an equal amount of dummy units too, so its not probably a problem.
 

tooltiperror

Super Moderator
Reaction score
231
I was thinking that you could do this pretty easily if you're getting consecutive dummy handle integers. But I was thinking this would also be difficult because you need to create a lot of dummies at once, which may cause lag?

JASS:

// globals
//   unit array DummyArray[100]
// endglobals
  function CreateDummy takes nothing returns nothing
      local integer index=0
        loop
          set DummyArray[index]=CreateUnit(x,x,x,x)
          set index=index+1
          exitwhen index==101
        endloop
  endfunction


I was then thinking you could create dummy units periodically and then stop when they reach one hundred, which would only work depending on your map style, so it would be recommended for things that will only use a few dummies every now and then. The problem with that would also be getting nice Handle Id's to line up.

Any more JASS-y people want to tell me if it would be unwise to create a buttload of dummies at start up?
 

Viikuna

No Marlo no game.
Reaction score
265
Creating handles is slow, and creating units is especially slow. Creating them all in game start affects the game play as little as possible, so its adviceable.
 

tooltiperror

Super Moderator
Reaction score
231
Alright, so what would be the most amount I'd want to create?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Total unit recycling is a pain in the ass because of these things :

- Special unit events : since you can't remove events, if you don't want the recycled unit fire again a trigger event, you have to destroy the trigger and rebuilt it without this event, can be done but hard and lame really.
You will also have to care about which groups the unit was inside or even unit variables.

- You can't directly give an instant facing, there is a trick to do it (not sure that is truly instant) but only work with special cases.

- The more unit types you need, the more you will have to keep units.
You could use morph abilities but these abilities are more or less bugged.

It's still a valid way for using units as an effect though.
 

Viikuna

No Marlo no game.
Reaction score
265
Its not easy for sure, but can be done. ( And have been done, for ToB O for example )

And you can make your own event systems, so events are no problem.

Chaos unit type morphing requires a very controlled envinronment, but works nicely.

For visual dummies, SetUnitLookAt provides a nearly instant facing angle turning thingy.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Sure, but honestly, does it really improve the player gameplay ?
I mean the player could notice the difference with or without unit recycling ?
Does it really justify this harder work or is it just for fun ?

Imho i think it's unnoticeable for players.

Note that i've already said that recycle units is handy if use as special effects.
I'm talking about total unit recycling here, no any unit removed in any way.

For chaos it doesn't work very well with unit types (worker and so one), bug with armours and such, in my point of vue it's kinda useless, can only be use for really really really special cases.
Again nothing wrong if the coder really want to use it and figure all the bugs, i just state that's definitely not a generic way for unit recycling.

SetUnitLookAt is very fast but not truly instant so, that was i thought.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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