Game Development Community

dev|Pro Game Development Curriculum

TGE Patch: Project Interaction with Water

by Tim Gift · 05/09/2003 (3:08 pm) · 5 comments

Download Code File

Allows projectiles to emit different particles while underwater and produce different explosions.

Robert and I are currently discussing changes to this patch, so there may be a new submission.

#1
05/09/2003 (3:10 pm)
This is a straight forward patch, but right after Robert submitted it I thought of a different way to organize volume interaction data and so didn't apply it. Robert and I have recently been discussion those changes, we'll try and shift our discussion on to this thread...
#2
05/10/2003 (1:17 pm)
Currently the engine doesn't recognize when a projectile enters a specific volume, in this case water. The patch fix above attempts to fix this issue by providing more datablock values to the projectile class which have the user specify new explosion and particle emitter objects to the projectile for when the projectile enters water. This patch also uses a SplashData datablock to create a splash on the surface of the water when it first comes into contact with it. Also in this patch is an attempt to get projectile sound to work, ie the sound of a bullet passing inches from your ear.

However, currently Tim and I are discussing the idea of environment volumes to be used for some of these projectile values and we would appreciate some feedback.

Via this new patch, new explosion and emitter values are specified like so:
explosion= ProjectileExplosion;
waterExplosion= BubbleExplosion;
particleEmitter= SmokeEmitter;
waterEmitter= BubbleEmitter;

With this concept of volumes the code above would be changed to:
explosion[air]= AirExplosion;
explosion[water]= WaterExplosion;
explosion[lava]= LavaExplosion;
particleEmitter[air]= SmokeEmitter;
particleEmitter[water]= BubbleEmitter;
particleEmitter[lava]= LavaEmitter;

I'm using air, water, and lava as examples here because currently these are the only 3 volume types in the engine. A volume datablock class would also have to be created and the different volumes in the game can then use this new datablock to help define what type of volume it is. For instance, with this new datablock, we could create several different variations of a water volume and then in the water datablock itself or through the mission editor, we could specify what type of volume the water we place in a mission is, and when a projectile, player, or other object enters that volume, it uses the explosion, emitter, physics, and other values for that specific volume type.

The environment volumes could be defined like so within script:
datablock VolumeData(water)
{
   ...
};

There is a snag that I've come across in this design, however. Currently datablock fields only take array variables with integer index's, ie:
value[0]
value[1]
value[2]
// and so on..

So the issue becomes, how are we to tell datablocks, which use these volumes, what volumes alter what variables. Tim has suggested that each unique volume type is assigned a fix number by the engine so that we could use that number to pass to the array fields.

This brings you up to speed with Tim and I in our current discussion and I'm hoping others in this community can provide insight, suggestions, and so forth. I think this idea of volumes can become a very powerful feature for the engine which has the potential to effect how every object in the engine interacts with every other object. I'm looking forward to what you all have to say.
#3
05/20/2003 (2:45 pm)
I like the volume idea myself. Even more so if it would also, at some point, include expanding the waterblock code to support multiple water volume's.
#4
06/06/2003 (6:05 pm)
I agree, Multiple volumes = good :: drools :: :]
#5
06/10/2003 (1:26 pm)
Tim, Robert,

Wow ! I've just applied this and this is really cool ! Keep going ! :)