Game Development Community

waterfall particles

by Dr. John Nobody · in Torque Game Engine · 10/24/2002 (11:09 am) · 14 replies

hey guys, been working on a map for almost a week now and I'm soooo close to being finished, some screenshots are at

http://planbgames.tripod.com/progress.htm

just scroll down to the bottom to see what I have been working on... but anyway, I REALLY need to get particles going to make the waterfall look good. I've tried adding Eric Forhan's new particle editor, that let me add particles to the map, but I can only add one at a time and I cant make it animate, it just sits there... I have tried to read up a bit on how to make particles work with little success, I read something about using max to export particles with the model, but I know torque has its own particle system and read some stuff about adding datablocks to the model's script to play particle animations.... so what do I do? could someone help me?

#1
10/24/2002 (11:23 am)
You could probably use a particle emitter node like in Realm Wars. That's how the fire and smoke works (chimneyfire.cs). Just use a positive gravity setting for water falling instead of a negative one that the smoke uses. The node is then added to the stronghold mission file, so you might want to check that out too.

Hope that gets you started.
#2
10/24/2002 (11:26 am)
I'm not sure I'm following you, Eric.

Perhaps turn up the particle lifetime? It's one of the sliders below the colors.

Eric
#3
10/24/2002 (11:56 am)
Sabrecyd, thanks for the suggestion, I took the smoke and fire particle datablocks from RW, and made the gravity positive, it was a good idea and is almost what I need, except for a few little problems, the first being that my waterfall is HUGE and unfortunately the particle cant even bee seen in comparison, is there anyway to make it bigger? I tried resizing it with ctrl alt click, but it wouldnt resize. I also need to make it last longer, but I think theres a variable in the script to do that. Another thing I would need is to change the initial velocity, I dont know if you checked out the pictures, but when the waterfall hits the knight I need the water to spray off kinda up and out, then let gravity take over and bring it down. Last but not least, is there any way to set up the datablock to make more particles spray out from a point? sorry for asking so much at once, just anxious to get this looking awesome

Eric, after looking into it further I dont think I'm even brining up your particle editor.... it said in your readme thing that it should have a keybinding, but I dont think I have one... but your particle datablocks are loading, so that kinda gives me something to work with :)
#4
10/24/2002 (11:59 am)
The Max Paricle system is not supported in the exporter, you would want to use the Torque particle engine.
Odd I can use the Particle editor to make what ever I want, I just can't save it still. Post your dataBlocks (particle and emmitter) so we can see what you have made.
As for E. Forhan what was the fix to save them in game I think my paths are all messed up :(
#5
10/24/2002 (12:18 pm)
Yep, almost all those things can be set in the script. In fact I think you have to do it that way, although using that particle editor would make it much easier to see how your adjustments look. It takes some playing around to get things how you want by just changing the script values.

The only one I'm not sure about is the hitting the knight and spraying etc. Don't think it can do that. That might need to be a projectile or trigger or maybe more then one emitter. I was going to look at the link again but it was unavailable :(
#6
10/24/2002 (12:44 pm)
datablock ParticleData(ChimneySmoke)
{
textureName = "~/data/shapes/particles/smoke";
dragCoeffiecient = 0.0;
gravityCoefficient = 0.5; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 3000;
lifetimeVarianceMS = 250;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;

colors[0] = "0.6 0.6 0.6 0.1";
colors[1] = "0.6 0.6 0.6 0.1";
colors[2] = "0.6 0.6 0.6 0.0";

sizes[0] = 0.5;
sizes[1] = 0.75;
sizes[2] = 1.5;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};

datablock ParticleEmitterData(ChimneySmokeEmitter)
{
ejectionPeriodMS = 20;
periodVarianceMS = 5;

ejectionVelocity = 0.25;
velocityVariance = 0.10;

thetaMin = 0.0;
thetaMax = 90.0;

particles = ChimneySmoke;
};

datablock ParticleEmitterNodeData(ChimneySmokeEmitterNode)
{
timeMultiple = 1;
};


//-----------------------------------------------------------------------------

datablock ParticleData(ChimneyFire1)
{
textureName = "~/data/shapes/particles/smoke";
dragCoeffiecient = 0.0;
gravityCoefficient = 0.8; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 500;
lifetimeVarianceMS = 250;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;

colors[0] = "0.8 0.6 0.0 0.1";
colors[1] = "0.8 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.0";

sizes[0] = 1.0;
sizes[1] = 1.0;
sizes[2] = 5.0;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};

datablock ParticleData(ChimneyFire2)
{
textureName = "~/data/shapes/particles/smoke";
dragCoeffiecient = 0.0;
gravityCoefficient = 0.5; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 800;
lifetimeVarianceMS = 150;
useInvAlpha = false;
spinRandomMin = -30.0;
spinRandomMax = 30.0;

colors[0] = "0.6 0.6 0.0 0.1";
colors[1] = "0.6 0.6 0.0 0.1";
colors[2] = "0.0 0.0 0.0 0.0";

sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.5;

times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};

datablock ParticleEmitterData(ChimneyFireEmitter)
{
ejectionPeriodMS = 15;
periodVarianceMS = 5;

ejectionVelocity = 0.25;
velocityVariance = 0.10;

thetaMin = 0.0;
thetaMax = 90.0;

particles = "ChimneyFire1" TAB "ChimneyFire2";
};

datablock ParticleEmitterNodeData(ChimneyFireEmitterNode)
{
timeMultiple = 1;
};

Anthony, thats the script I'm using, its just the realmwars chimneyfire datablock. Could anyone give me any advice as to how I could modify it for my purposes? especialy making it bigger, that would really help me out... thanks guys for your comments :)
#7
10/24/2002 (12:48 pm)
We need to get melv doing some particle engine work... torque's particle engine just isn't up to snuff, compared to some of the other particle engine's I've worked with... oh well, maybe one of these day's I'll finally get around to learning more about the torque source (I bought it and haven't done much with it at all, since I'm still working on learning C++, which has been put aside because of my girlfriend... (long story))

~ Sang
Sanguinus::OnThink(%self, %thought)
{
if(%thought.gettopic() = "Girlfriend")
%self. HardonState = true;
else
return false;
}
#8
10/24/2002 (12:50 pm)
The lines that have sizes are for the particle sizes. Give those some larger numbers. instead of 0.5 or whatever try 10.0 and see what happens :)
#9
10/24/2002 (12:50 pm)
haha, truer words... errrm, code was never spoken. I think we've all been there.... poor melv, we overwork him
#10
10/24/2002 (12:53 pm)
Sabrecyd, thanks for the suggestion, I just did, it seems to be working, now I'm tyring to make it last longer (at its new size it doesnt even seem to be emmiting particles)
#11
10/24/2002 (1:00 pm)
That would be the ejectionPeriod setting. It may be opposite of what you'd think though. Try a larger and smaller number and see which is better. You probably want to adjust the ejectionVelocity too for faster moving particles.

edit: oops, actually it's the lifetime setting you want first. The ejectionPeriod is a little different.
#12
10/24/2002 (1:06 pm)
Sabrecyd, its the ejectionperiod? I changed the lifetime variable and it lasts longer, but now I have it going on for forever, I will try changing it back and changing the lifetime period, thanks :), this fixes almost all of my little problems... just need to get this velocity thing figured out, anyone else have any ideas?
#13
10/24/2002 (1:23 pm)
lifetimeMS = 800; opps need to finish reading
#14
10/24/2002 (1:28 pm)
Anthony, I haven't had the chance to look at the particle ed. guts in at least a month. I'm soooooooper busy. lol
I do remember that at one point I was able to save the particle in a game, so it's possible I did fix it (don't count on it just yet, tho. ;) ) Perhaps after the IGC I'll be able to breathe a little easier.

The Torque Particle Engine really is quite a powerful tool--it just takes some getting used to. The screenshots of our particle f/x are nothing compared to watching them in action. Two of our weapon trails actually use animated particles (where instead of a single texture it uses eight or more).

I have plans on doing an in-depth tutorial on the particle engine, once things slow down for me. Like others have said--if only there were more hours in the day. ;-)

Eric