Effects

posted in Blue stain for project Shoot
Published May 16, 2016
Advertisement

Hello.
The work on the effects took longer than I thought but the result is not far from what I was expecting. It is now possible to create things like smoke trails, explosions and maybe other effects that can be achieved with the system. They can be associated to objects as active effects, that is while the object's energy is above 0, or they can be associated to objects as destruction effects and triggered when the object's energy reaches 0. Each category can have more than one effect.

In the video below, you can see smoke trails, small impacts of shots on the structures and big explosions.

How it works.
The definition is similar to the one of the weapons (https://www.gamedev.net/blog/635/entry-2261780-collisions-and-weapons/):
- the different effects are described in a file
- the objects have 0 or more effects instances associated to them in the objects description file. An instance is a reference to an effect and its location relative to the object.
- the objects instances (from the level file, referencing an object) have effects states that are references to the effects instances and the dynamic properties (number of points, current radius, ...).

The effect can be of type "trail" or "sphere". It is defined by a material ID, the number of sides (think of a lathe), a maximum number of points, an initial and maximum radius and a few other parameters. The "trail" and "sphere" are defined in the same way. The effect state contains a list of points/radius couples. The "sphere" type is created by adding at once the maximum number of points along the diameter with, for each point, the radius of the corresponding latitude circle. The "trail" is created by adding a point calculated from the parent object position at each update (the oldest point is removed when the maximum number of points is reached).

The level maintains a list of the active effects states. The list is built from the visible objects and the effects still active after the parent object was destroyed. These effects are updated at a specified rate (set in the effect description, can be different for each effect type). The effects in this list are given to the EffectsVisual in charge of the building of their visual representations as geometries. Finally, the geometries are rendered as any other objects by the renderer.

The EffectsVisual converts the effects states points into a group of cones/truncates cones/cylinders depending on the radius associated to each point.

And voila.

I did not do a lot of optimization for now as I may rework some parts when adding more types but it is fast enough for now.

Bonus image: a wire-frame view. It is clear that I have to work on some lighter trees and grass.
[sharedmedia=gallery:images:7412]

Thanks for reading.

Previous Entry Let's rock
3 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Not my game but...

1469 views

Spaceship update

1840 views

Big WIP

2290 views

Late creation

1318 views

Hidden gold

2178 views

Effects

2389 views

Let's rock

3257 views

Pick-ups

2409 views
Advertisement