Particle Effects in 2D-Games

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Particle Effects in 2D-Games

Post by DaChief »

hi all..

i'm at a 2D-Arcade Game at the moment and i tried to implement the Particle-System of Irrlicht into it.
I've started with the SpecialFX Tutorial and created a nice Flame ^^

My problem is the positioning of this ParticleEffectNode for example if i want the node to follow a 2D Image.

if i try to place this ParticleEffectNode into the 2D world i got some strange problems with the coordinates of the Node.
ok, sure the ParticleEffectNode is in 3D Space so there is a Z-Coordinate i had to set and a Camera to add.
with these Settings, i see the Effect right in the middle of the screen:

Code: Select all

ICameraSceneNode* camera = smgr->addCameraSceneNode(0, vector3df(0,0,0), vector3df(0,0,5));
pssNode->setPosition(vector3df(0,0,200));
Well.. it's quite simple at this time. But if i change the Position of the Node as i do it for the 2D Image the effect is a bit confusing.

So if someone can give me some "2D-optimised" Settings for the Camera and the ParticleNodes please tell me.
or teach me about a much simpler solution... :wink:

THX
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
MrPotatoes
Posts: 38
Joined: Mon Nov 07, 2005 5:55 am

Post by MrPotatoes »

what do you mean by confusing. i don't think that'll help the guys out too much

and why don't you pass it the coordinates of where the sprite is?
Guest

Post by Guest »

well, confusing...

i mean, it doesn't move that fast as the sprite do, if i pass the coordinates to the node.
i think it's because the node is in 3D-Space(z-coordinate) and the Sprite in 2D.
the Y-Coordinate is also wrong. if you move the sprite up, the node moves down. ok, you can simply make y*-1 and it works but because of the z-Coordinate the nodes doesn't move in the same speed.

Hmm... k.. maybe it is a bit confusing...

so tell me simply how i can make a ParticleSceneNode follow a 2D-Image.
Thats everything i want to know... thanks in advance....
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

ah, sorry... it's me.. i forgot to login :roll:
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

you can always use the 2d animated sprite class on the wiki for your sprites, that way they have a z-axis and can be easily mixed with 3d effects and stuff.
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

hmm.. sounds interesting...

But why should they have z-axis ?

well, i take a look at it, maybe it helps.

But if the Sprites got the same coordinates as the ParticleNode, they'll move the same way like the ParticleNode did after i send him the "2D-Coordinates".

You know what i mean ?
if you want to move an Image in 2D-Space from one edge to another if the Window got a size of 800x600 dots you move it from x=0 to x=800. But if the node is at a Z-coordinate like 200 or something this won't work because in "2D-Vision" the Node moves much less.

it's a bit hard to explain with my english. I think my english teacher could kill me if he reads that text :D
i hope someone got it, else i explain it with a universal language -> some Code for example ^^

EDIT:
Maybe it is possible to place the ParticleNode at z_pos=0 and scale it down.
i'm trying that at the moment but it doesn't work yet
If i don't get it to work i try the Sprite-Class in the Wiki
Last edited by DaChief on Tue Nov 08, 2005 2:19 pm, edited 1 time in total.
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
hybrid

Post by hybrid »

Did you mean something like 3D coordinate to screen coordinate? Having something move far away appears much slower. But shouldn't the effect be at the very same location as your sprite, or why did you choose to have it in different layers?
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

well, the best solution is to setPosition with vector2df.

i made the game in 2D by using draw2dimage because when you move the Image 20dots to the right it moves exactly 20dots.. if it is in 3D it will move slower if you dont place it at z=0.

to make it quick, i use 2D-Images because it is easier to manage the coordinates of the objects.

or did i miss anything ?

do you mean i should use the sprite class so it is all in 3D ?
well maybe this works..
i should test this class first, maybe it isn't that bad ^^

Do you got some experience with the class ?
whatever, it won't be that difficult i hope :wink:

by the way: thank you all for your answers ... ... and your patience :D
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

hey, it's me again...

i got this Sprite Class to work and i like it this far.

whatever, i was wondering, how to place a particle scene node over this sprite.
to tell the truth, i didn't try it some way, because i'm not sure, how the Sprite Class works and how it helps me, to place a particlenode over it.

i mean, yes, i got an z-axis now. But in the example it is z=0. And i think it is a quite good value for a simple 2D-Game.
But if i set the z-axis of the particlenode to "0" it will be right in front of the camera.. so you can see every single particle it is that big...

i hope someone can help me out of this.. it can't be that hard i hope ^^

EDIT:
or -> How can I place a ParticleSceneNode in 2D-Space ? (same x,y coords)

if someone don't get what i'm trying to say, so please tell me that.
My english is that worse, maybe something is unclear... :lol:
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
Guest

Post by Guest »

FWIW I understand what you are trying to say - basically how to use irrlicht as a pure 2D engine (2d in 3d) with particles at screen depth (transformed) rather than 3D. Just like many 2d games have particle effects. You are having probs with the z co-ord... are you using Orthagonal projection to ensure "2D" - if so you should be able to render at X,Y with z completely ignored (except maybe for sprite depth)...

you probably tried this already - I would like the info to do this correctly to.

rgds
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

are you using Orthagonal projection to ensure "2D" - if so you should be able to render at X,Y with z completely ignored (except maybe for sprite depth)...
ooh yeah ! sure... Orthagonal was the Key-Word... a very good idea !!

k, if someone can tell me the basics of how to create an Orthagonal Camera or something like that it will really help me.

i know how Orthagonal "perspective" works, but i don't know how to use it in IrrLicht so i need a bit help.

THX "Guest" :lol:
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
Guest

Post by Guest »

It is in the irrlicht docs - there is a different setup to be used to get orthagonal but it is all there. There may be something on the irrlicht wiki also (not sure).
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

Ok, i'll take a look at it..
THX
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
DaChief
Posts: 45
Joined: Tue Nov 01, 2005 9:02 am
Location: Switzerland

Post by DaChief »

The Orthogonal thing was a very good idea... it works now...
the only thing i was wondering is, if i want the particle-scene node exactly follow a 2dObject do i really have to initialise the matrix4 with for example 640 units width 480 units height ?

i've seen some examples with 16 units width and 16 units height and so i was a bit wondering..

maybe i need some noob-lessons in orthogonal perspective... but overall it works so this should be a tip for all these guys who wanted some ParticleEffects in their 2D-Games. With Orthogonal perspective it should work

@Guest
THX for your help
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
guest from above (GL.GX)

Post by guest from above (GL.GX) »

OK no worries, glad it helped. Not sure about your new problem though :)
Post Reply