HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

DummyEffect design-- struct inheritance

12-02-2007, 06:27 AM#1
grim001
Alright, I'm working on a class called DummyEffect. The purpose is to expand the usage of special effects. An invisible dummy unit with a special effect attached allows one to scale, fade, and "attach" the dummy effect to units.

I've never used struct inheritance before so I'm posting the design of this here before I start coding it for feedback.

This is what the parent class will look like (of course methods are empty for now because I haven't coded it yet):
Expand JASS:

Example of a typical effect:
Expand JASS:

So now we have this complex special effect all encapsulated in a neat struct. It is effectively a new special effect, based off of the original model, but now altered to follow certain behaviors. It grows and fades in when created, and shrinks and fades out on death. Of course more complex behaviors could be created as well. The point is that it's all swept away inside a struct for each unique special effect and can be easily called within your spells.

Example of using the Glow effect:
Expand JASS:
The effect would be created on top of the unit and follow it, grow and fade in, wait 2 seconds, then shrink and fade out while playing its death animation, then deallocate the struct. No mess and no hassle.

Anyway I want feedback about this design and whether anyone who reads this believes it should be implemented differently. Ideas for extra features are welcome as well.
12-02-2007, 06:40 AM#2
Ammorth
Nice idea.

I don't think there is a better or cleaner way of doing this, other than modifying the models itself. I guess the only issue is that the effects would revolve around a periodic timer(fading and movement), which means lots of effects could be costly.

I would also include an exponential fade as well as the current linear fade.

p.s. I hope you are still working on your physics system.
12-02-2007, 06:53 AM#3
grim001
You'd have to get into 100+ simultaneous effects before it could really cost noticeable performance. If used in any reasonable way performance shouldn't be an issue.

I don't really see the point of exponential fade, want to include an example of when it's useful?

Physics engine is still "almost done" like the past year or so. Finishing this is a prerequisite since they work together.
12-02-2007, 07:08 AM#4
Ammorth
It can be used as a decay starting at a min and then expanding to infinity. Usually exponential fades (and S fades) are used a lot in film and audio transitions since it appears to blend more naturally. Having an effect that just starts to fade versus one that gradually fades, one is more appealing.

http://www.transom.org/tools/editing...adetricks.html is what I mean, although their idea sound samples are rather stupid.
12-02-2007, 08:06 AM#5
Pyrogasm
Why aren't there .setX(newX), .setY(newY), and .setZOffset(offsetZ) methods?
I suppose one could attach the dummy effect to another unit... but why create another unit when you could do it in methods. Also, a . setZOffsetTimed(offsetZ, Time) might be useful.

Additionally, it seems you forgot to say anything about .setXOffset(offsetX) and .setYOffset(offsetY).

Oh, and you put your model path's slashes backwards in your example code; they go like this: \\.
12-02-2007, 08:59 AM#6
grim001
OK, I guess it needs some methods to support moving the effect.

Offsets aren't really meant to be manipulated; they're meant to correct for the fact that the graphic often won't be centered over the target since it's not truly attached. If you're doing some thing where you manipulate the offsets over time then it can just be coded manually.

Collapse JASS:
local DummyEffect de = Glow.createOn(someunit)
    set de.XOffset = de.XOffset + 1

Quote:
Oh, and you put your model path's slashes backwards in your example code; they go like this: \\
No one cares.
12-02-2007, 09:06 AM#7
Pyrogasm
I care.