Archived

This topic is now archived and is closed to further replies.

Sphax

Just Another Particle Engine Demo

Recommended Posts

Sphax    122
Hi all, i've seen recently 2 particle engine demo posted here, so why not posting my own ? You can get it at http://www.grognon.com/doc Use the login "public" without any password and just follow the links to get ParticleSystem.zip. You can use the mouse to move around the systems, i hope you'll like the (basics) effects you'll see, your feedbacks are welcome. [EDIT] The site is in french sorry, but it's quite easy to get the demo, just follow the 2 or 3 links. And for those who are effraid of viruses (i can't blame you), you'll find also there a sample image, ParticleSystemImage.jpg [/EDIT] [edited by - Sphax on August 12, 2003 5:36:42 AM] [edited by - Sphax on August 12, 2003 9:41:47 AM]

Share this post


Link to post
Share on other sites
Hawkeye3    122
Hey thats pretty nice! I especially like the flame. How do you make it curve inward at the top like it does, and is the effect hard-coded?

Runs decently, I get 50 fps on a gf3 rendering 2500 particles.

Oh, and you should wait at least a day or two before getting discouraged. Some people only check the forums every couple days.

Share this post


Link to post
Share on other sites
Sphax    122
Oh thanks for the replies, i was a litle bit discouraged as you said Hawkeye3 . And sorry for my late reply, i was in hollidays.

Hawkeye3 : many partameters can be set for each particle system, and one of them allows the one you''re talking about. It''s the "attraction" parameter, where you can set an attraction point and an attraction power for the particles. The same parameter is used to achieve the "blob" effect you can see at the top left, just with different settings.
In fact i have a ParticleSystem class that have a method for each parameter you can set (position, gravity, attraction, speed, angular speed etc ...), and you just code :
MyFireSystem.SetAttraction(AttractionPoint, AttractionPower);
Those this answer your question about "hard coded" thing ? I didn''t anderstand it, sorry.

WhiteCrow: i didn''t limit the FPS to 50, in this exemple i limited it to 100 FPS, so i don''t understand why the performances are so bad (i can imagine some vertical sync problem since 50 is exactly the half of 100, but only 2000 particles in a scene should run much better no ?)

Share this post


Link to post
Share on other sites
Hawkeye3    122
Ah ok, point gravity, I have that in my particle system too, although I''m not sure if the formula I''m using is correct (it seems correct, but I''m no expert with vector math/physics either )

When I said ''hard coded'' I meant if the effect was a special case in which you coded that effect specifically for that emitter. You didn''t do a special case, so the effect isn''t ''hard'' coded. (Actually I''m using the term ''hard coded'' incorrectly... hard code is code that the user can''t change. For example, loading your particle properties from a text file would allow the user to customize the particle effects, thus making it ''soft'' code)

Share this post


Link to post
Share on other sites
deathtrap    364
i''m getting around 30 FPS on a 1.2 GHz athlon, with a geforce2 MX 400 32MB RAM. running 2500 particles. I think you need to optimize the code abit?

But it looks very nice, I like the flame effect, nice work.

Share this post


Link to post
Share on other sites
deathtrap    364
quote:
Original post by Hawkeye3
Ah ok, point gravity, I have that in my particle system too, although I''m not sure if the formula I''m using is correct (it seems correct, but I''m no expert with vector math/physics either )

When I said ''hard coded'' I meant if the effect was a special case in which you coded that effect specifically for that emitter. You didn''t do a special case, so the effect isn''t ''hard'' coded. (Actually I''m using the term ''hard coded'' incorrectly... hard code is code that the user can''t change. For example, loading your particle properties from a text file would allow the user to customize the particle effects, thus making it ''soft'' code)


Actually it depends on what you define "user" as. If you wrote your own particle engine class, and then another programmer were to use it, that would make him the user, and if the system basically uses variables to store the properties of the system then i would assume that it isn''t hard coded, since the programmer can make a few alterations to the system with a few simple variables. But if it the values for the whole system such as the gravity was set literally in the code then that would make it hard coded since the programmer would have to go through the source code to change the actual values.

Share this post


Link to post
Share on other sites
Sphax    122
Well in this case nothing is hardcoded in my code since all the system parameters can be accessed trough methods of the class (i''m trying to do good oop design, but it''s not easy and the danger is to spend more time in the design then in the coding ).

I have optimized the code already, and cann''t figure where i could optimize now :

- I use vertex buffer in place of "direct mode"
- I don''t create new particles, instead i create a particle array at the initialisation and then reuse dead particles (so no new/delete)
- i have a particle manager class that does all the redundant stuffs that each system needs (calculating the modelview matrix invert for example) so those stuffs are calculated only once instead of one per system.

But obviously there''s still something wrong , i''ll think about it ...


Share this post


Link to post
Share on other sites