Game Development Community

Spiral particle effect

by Jonathon Stevens · in Torque Game Engine · 02/13/2006 (7:59 am) · 8 replies

Friends,

I'd like to make a particle effect that starts at the foot of a player (AI or human) that will spiral up the outside of the player until it reaches the top, and then starts the whole process over again. Any thoughts on how to do this? I'm new, so bear with me!

I'm wanting this for my targeting scheme. I click on a player/npc, then the spiral effect happens to let me know that I have selected that player. Is their a better way to achieve this result that I should know about?

About the author

With a few casual games under his belt as CEO of Last Straw Productions, Jonathon created the increasingly popular Indie MMO Game Developers Conference which. Following the success of IMGDC a new MMOG fan event called LFG Expo will debut in June of 2010.


#1
02/13/2006 (10:36 am)
You could have an emitter that shoots particles in a narrow direction, with a negative gravity (so the particles will float up), place the emitter in the player's feet shooting the particles horizontally, and make the emitter rotate around the world Z axis. That would create an spiral-looking effect, in theory. Not sure if it would look like the one you're imagining.

Getting the emitter to move around and rotate on it's own is the tricky part. You can schedule/itick it using script (might work, depending on the particles frequency, but it's not recommended if you have lots of those in our scene), or do some C++ changes to make it rotate like items do.
#2
02/13/2006 (10:43 am)
I have no clue how to do any of that is the problem. Is their a good particle tutorial that would describe how to do such things? How about one to use the particle editor?
#3
02/13/2006 (10:52 am)
Dishmal-

I've got a quick answer for you for getting the particle editor going: you've got to enable some keys to get it running (I found these in another thread):

Bindings:
C:\Torque\SDK\example\starter.fps\client\config.cs | 6 | moveMap.bind(keyboard, "f5", toggleParticleEditor);
C:\Torque\SDK\example\starter.fps\client\scripts\client\config.cs | 6 | moveMap.bind(keyboard, "f5", toggleParticleEditor);
C:\Torque\SDK\example\starter.fps\client\scripts\default.bind.cs | 32 | moveMap.bind( keyboard, F5, toggleParticleEditor);

In Common, where the exec and function starts:
C:\Torque\SDK\example\common\main.cs | 31 | exec("./editor/particleEditor.cs");
C:\Torque\SDK\example\common\editor\particleEditor.cs | 15 | function toggleParticleEditor(%val)

In theory, what Manoel is suggesting will do the trick, I haven't found any decent particle resources at all, so it looks like experimentation will work best.
#4
02/13/2006 (12:09 pm)
The particle editor will help a lot in getting the particles to look as you want. But be aware that the save feature will output the resulting datablocks in files somewhere in your mod folder (the mod root, I think). You'll need to copy them from there into a script that gets loaded by your game.
#5
02/19/2006 (8:26 am)
@Manoel - I don't see anything that has to do with rotating on the Z axis, do you know which option does this? Also, how can I attach the particle to the player? If I just set it at their feet, as soon as they move then it no longer would be at their feet.

The whole thing I'm looking for is a player selection effect. I just want to click on someone, and a beam of light or whatever spirals up their body until i deselect them or select something else. Maybe I'm going about this the wrong way?

I'd also want this all client-side. If I select someone, only I should be able to see the selected effect.
#6
02/20/2006 (4:54 am)
Quote:how can I attach the particle to the player? If I just set it at their feet, as soon as they move then it no longer would be at their feet.

There's no simple out-of-the-box way to mount particles to objects. Using some scripting, you can, at most, make a shapeBaseImage emit particles using an emiter datablock, and mount that to the player. For arbitraty mounting, some source-code changes are required.
You can use a schedule to keep a function running again and again at a fixed time interval, and reposition it at the player. Search for schedule using in the script docs.

Quote:I don't see anything that has to do with rotating on the Z axis, do you know which option does this?

There's no rotate method. You'll have to extract the rotation from getTransform() modify it and set it back using setTransform().

Quote:
The whole thing I'm looking for is a player selection effect. I just want to click on someone, and a beam of light or whatever spirals up their body until i deselect them or select something else. Maybe I'm going about this the wrong way?

I'd also want this all client-side. If I select someone, only I should be able to see the selected effect.

Hmm, that makes things a bit harder. Such client-side-only effect does require some C++ changes (adding methods to the player, making it instantianize a particle emitter in client-side, etc), unless you're willing to do some compromises based on your curent knowledge.
#7
02/20/2006 (5:09 am)
I think you must have some patience and wait for the ArcaneFx stuff , this looks more like the thing you want.
#8
02/24/2006 (9:14 pm)
It might be easier to forget particles and just create a dts object with an animation thread that does whatever your artistic abilities allow you to. Spawn that object at your players location, let the thread run, then delete it.

Realmwars uses a simlar method for a spawn in effect.