• entries
    116
  • comments
    115
  • views
    104817

Effects

Sign in to follow this  

898 views

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.

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now