URL:
<http://gna.org/bugs/?11706>
Summary: Extensions for particle engine
Project: Battle for Wesnoth
Submitted by: jetryl
Submitted on: Monday 05/19/2008 at 20:18
Category: Feature Request
Severity: 4 - Important
Priority: 1 - Later
Item Group: Graphics
Status: None
Privacy: Public
Assigned to: boucman
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 1.5.x
Operating System: any
_______________________________________________________
Details:
Right now our engine allows support for drawing additional, arbitrary
animations, each moving along arbitrary x,y, positions over time. This gets
a heck of a lot closer to being useable as a "particle engine"; the main
thing that's missing is to make a movement path that has some element of
[b]randomness[/b] in it - such as a linear slide from a fixed starting
position to a random end position.
We can even deal quite well with a fixed number of particles being emitted,
the key thing is simply that their paths be different each time they're
emitted - that is the main thing that's useful about particle engines, their
ability to produce a infinite number of variations of something that would
otherwise have only one variant. If, for example, a few sparks burst off of
the victim of a magic missile - if they fly off in random directions, every
single time the animation plays, it will look different. [u]And it will look
different with no additional content creation cost.[/u]
[b]There are a few movement behaviours I can see being useful for
"particles":[/b]
Linear - particle moves from one spot to another
Arbitrary physical behaviour:
particle moves under the affect of in-game gravity
particle floats up and is caught by wind
particle bounces, etc
particle flutters back and forth like a falling leaf/feather
The best way to do these would simply be to allow the animation to call some
sort of referentially transparent function during the animation, to determine
the x,y position of the individual animation (be it "missile" "" or any
special animation name). This function would be a function of time - for any
input time, it would need to be able to return arbitary values of x and y. (I
understand that randomness would goof with the ref transparency; possibly we
could store a seed, or something. It needs to appear random, rather than
actually be random.)
This function would need to be able to do the following:
- evaluate arithmetic formulas (Dave's formula system might apply here)
- use a few basic trig functions (cos, sine, etc)
[b]Example syntax:[/b]
[missile_frame]
offset=0~random(.5,.8)
# this frame would travel from an offset of zero, to an offset that was
randomly chosen to lie in the range between .5 and .8. This final position
would be determined when the animation started.
[/missile_frame]
Typically, for a given animation, it would emit a fixed-number of particles
(around 4-10) for each missile frame. Use of these would be fairly rare, and
would generally only get used on animations that would sensibly kick up debris
- smoke from a thunderer's muzzle flash, sparks from a magic missile, etc.
Most units would not have particle effects.
This request is currently for a "fixed number of particles", but it would be
worthwhile to look into ways to extend this, or design this so it could be
extended in the future, to create a random number of particles (preferably
from a description of a single one which there will be several copies of).
>From my experience, we'll do rather well with a fixed number, but having a
random number would improve things.
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?11706>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs