Game Development Community

dev|Pro Game Development Curriculum

Plan for Owen Ashcroft

by Owen "WDA" Ashcroft · 07/14/2002 (7:58 pm) · 9 comments

Unlike others I'm really quite happy with the current particle engine that Torque currently offers, however I have some things I am looking into, I'm sure others can tell me how to do it efficiently but that really isn't the point of this exercise.

Basically what I am looking at doing is prototyping my idea for the spells system I think would fit Realm Wars, it has already been accepted reasonably warmily but the creation of a spell with the various effects will hopefully pursuade James that I am onto a "good thing" here :)

Regardless my current challenge is to combine weapon charging I worked on today and failed with due to the fact the datablock system is bloody annoying, with a modifiable particle effect, the problem is that the datablocks constantly effect the value, so you create a new projectile and then change the datablock back it effects the existing projectiles, what needs to be done is to create distinct datablocks for each projectile, so once created they are unique until they "die", what makes this worse is that I can't even pass a modifier value as each shot fired will modify that value, ARGHH! I am going to have to figure this out as it is frustrating and seems to be impossible to sort out via scripting.

Anyway off to bed it is 4:10 in the morning and I should have been in bed 3 hours ago, perhaps a fresh perspective will prevail.

Oh well

Owen
- Realm Wars is good for you!
----------------------------------------------
A nights sleep has helped I have messed around a bit more and it would appear that modification to damage will have to be made at ShapeBase::damage, which is ok, however it means that a modifier variable will have to be passed in to the source code, which is a pain if ever I knew it. Oh well.

#1
07/15/2002 (2:38 am)
Owen, ask Phil about this, cause I know he had made some particules effects before...
#2
07/15/2002 (8:11 am)
It's not so much the particle effects more modifying them on the fly which I am trying to figure out.
#3
07/15/2002 (9:34 am)
How do you mean, Owen?

I'm very interested in learning all I can about the particle engine. I've done alot of work with it, but I know there is more.
#4
07/15/2002 (9:57 am)
basically the engine constantly refers to the datablock with the information, it doesn't, once creating an emitter, make it a datablock of its own to refer to, but constantly checks the original datablock. Try this for example:

Goto to crossbow.cs and do this:
- in datablock ShapeBaseImageData (CrossbowImage)

add the variables:

original_sizes[0] = 0.25;
original_sizes[1] = 0.5;
original_sizes[2] = 1;

scroll down to state[2] (the ready to fire state) and add:
stateSequence[2] = "ResetDataBlock";
then scroll down to the function OnFire and add just below %projectile = %this.projectile:
%this.original_sizes[0] = %projectile.particleEmitter.particles.sizes[0];
%this.original_sizes[1] = %projectile.particleEmitter.particles.sizes[1];
%this.original_sizes[2] = %projectile.particleEmitter.particles.sizes[2];
followed by
%projectile.particleEmitter.particles.sizes[0] = 50;
%projectile.particleEmitter.particles.sizes[1] = 50;
%projectile.particleEmitter.particles.sizes[2] = 50;
Once that is done scroll to the bottom and add:
function ResetDataBlock(%this)
{
projectile.particleEmitter.particles.sizes[0] = this.original_sizes[0];
%projectile.particleEmitter.particles.sizes[1] = this.original_sizes[0];
%projectile.particleEmitter.particles.sizes[2] = this.original_sizes[0];
}

What this will do is give you huge particles until the reload animation has finished, then the crossbow trail will return to original, which is what has frustrated me, because I would have much rathered that Torque create a temporary Data Block for that projectile alone, instead it will require a lot more playing. This problem extends to all datablocks, if you wish to modify the damage it will modify the damage of all projectiles currently in flight, and the next projectile fired will modify yours and other projectiles in the air e.t.c

Instead what now has to be done is modification to the actual code as new value, a modifier, has to be passed into the engine, so when it gets to the area that actually implements that specific projectiles particles the modifier can be applied there, rather than very neatly in one script.
#5
07/15/2002 (11:49 am)
Hhmmm... I guess I still don't understand. You want it to stay large, right?

I inserted what you have, above, and it seems to be working fine. No matter how many shots I fired, it stayed with the large particle. I even ran out and had to go get more bolts and it still did this.

I re-read your .plan. I'm presuming you are wanting to make a weapon that will increase in power the longer you hold the fire button?

It seems like I've seen a T2 forum with thoughts on something like this. I'll have to check it out and get back to you.
#6
07/15/2002 (12:33 pm)
Here's a T2 tutorial: www.mage-tower.com/BadShot/TutorialChargingPlasmaCannon.html
However, it apparently uses several projectiles to cause the charging effect.

Which brings to mind an idea: Have you considered making the weapon shoot more bolts at once--only side by side/clustered?
#7
07/15/2002 (2:09 pm)
That's the sort of system I want to avoid.

Also the multiple bolts I don't want to do. I have the source so I may as well do it properly.
#8
07/15/2002 (2:34 pm)
Figured out the damage bit can go through scripting which is nice.. Particles next (GAH!)
#9
07/15/2002 (6:24 pm)
Ok passed the modifier through to the engine, now all I need to do is rewrite the particle system a little so that I can pass the modifier through to it and let it increase the size of the particles (crazy!)