Sign in to follow this  
willthiswork89

hmm particle systems rule

Recommended Posts

i wanted to add a particle system to my sdl game. like an overlap...any tutorials on doing this or making a particle system? im new to open gl but i would rther stick to sdl, 400 lines of code to make a blank window and crazy math just isnt my cup of tea just yet... im only in 10th grade so the matrices and vertices look like babble. so anyways ide like to do a particle system, if i HAVE to do that math ill look it up but ide like to sway away from the math and sh*t

Share this post


Link to post
Share on other sites
particles are easy if you understand the basics of whatever drawing API/library you're using, and dynamic memory allocation to a degree (to not overflow with undeleted particles of course) and a little bit of physics. You can definitely do something basic like snow with very little practice.

The tricky part is extensible engines. Anyway, what I was going to say was that the articles on this website, particularly NeHe's particle guide which can give you a good idea on physics and implementation of particles, and the Extensible particle system guide, were quite useful to me. Just study their code and implement it to draw in SDL, and you're good to go.

I can tell you though, that the basic beef of a particle will include position on the x and y, velocity on x and y is a good idae, a life cycle to keep track of when to delete them. When creating particles you'll prolly wanna spawn them with randomized start location, or else randomized velocities, and a good way to keep track of all your particles at once would be to store them all in a vector, which is why I do, and it works pretty well. On my website, you can download latest version of a demo im writing which has a simple particle engine, it's not extensible, but you can check it out if you like. good luck

Share this post


Link to post
Share on other sites
If you want a realistic explosion, a little more advanced physics may be necessary, or create different instances of expanding particle spheres... A little creativity and you can pull it off, but if you're new to something you should usually start small before trying to tackle something big and causing a lot of problems on accident

Share this post


Link to post
Share on other sites
If you are using OpenGL, check this out:
http://www.codesampler.com/oglsrc/oglsrc_6.htm#ogl_particle_system
It's also very easy to initialize an OpenGL window with SDL
see http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01
There is a link at the bottom with Linux/SDL code for initializing a window- It should probably also with with OSX and Windows, as SDL and OpenGL are cross platform.

Share this post


Link to post
Share on other sites
technically to initalize a window, you need to make a window class, which is only a couple of lines, but also a window procedure 0_0, it can be as many or as little lines of code as you want. typically, the more, the better/faster, i think.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this