SFML community forums
General => SFML projects => Topic started by: zarka on September 22, 2007, 11:51:00 pm
-
I thought i would share some screen shoots of my current SFML project, as the topic already reveled it's about particle systems.
I have used an approach similar to that of Ogre3ds with particle systems built up by emitters and affectors. the system is being developed for use in 2d but shouldn't be to hard to scale up to 3d.
(http://thumbnails.freeimagehost.eu/108/40933b1073243.gif) (http://www.freeimagehost.eu/image/40933b1073243)
what is seen in the picture?
one particle system containing 2 point emitters. each emitter is affected by a fade in affector a fade out affector and a linear force affector.
what is currently on my to do list? Adding manager and factory classes, perhaps some way to create system from config files, code cleanup and bug testing.
EDIT: code now available on the wiki: http://www.sfml-dev.org/wiki/en/projects/particle_system
-
Looking good, good luck with it!
-
So i have made some (slow) progress, and implemented a bunch of different emitters and affectors and here you can see the result
(http://thumbnails.freeimagehost.eu/113/517aed1128634.gif) (http://www.freeimagehost.eu/image/517aed1128634)
-
Really impressive I must say, the top left one looks great.
-
do you use direct openGL calls for rendering??
-
I have derived my ParticleSystem class from sf::Drawable and written my own rendering function. i did this to be able to optimize the drawing of multiple particles with the same texture/material. (less texture switches = greater speed).
hmm been a while since i posted this.. not much have happened visually now I have mostly been working on getting a nice file format for loading particle systems and optimizing it a bit.. next step would be to get rid of immediate mode OpenGL rendering ... but I really suck at OpenGL so we wil lsee how long it will take to get it done .. probably a while ;)
-
well, thats what I thought^^ just wondering;) cause I was thinking about doing some particles for my game and was not sure wether it would be fast enought to render a few hundret sprites.. (In fact 3000 are no problem at hmm 30-60 FPS on my old machine with compiz desktop->even slower^^)
-
I'm planning to improve the performances a lot, especially when rendering a lot of sprites with the same texture / states.
-
So, i have now finally managed to make a more sfml friendly version of this code (no dependencies on boost/my other code) and added it as a contribution on the wiki http://www.sfml-dev.org/wiki/en/projects/particle_system . It builds and links with the latest SVN sources.
if you find any bugs with the code please don't hesitate to tell me and i will try to fix them :)
-
Awesome work!
I almost want to create a sandbox game with this.
-
What license are you releasing this under? Can the code be used/modified in commercial apps?
-
zlib/libpng so it's the same as SFML :)
EDIT: This is now also stated in the wiki page
-
I finally got it working, nice job!
I used to get a stack overflow error. The reason was that the path to the font was wrong.
-
I finally got it working, nice job!
I used to get a stack overflow error. The reason was that the path to the font was wrong.
ah yes, the code assumes you have the "bin" folder as working directory :)
-
Wow, funny enough I just did this exact same thing about a month ago.
I based it off of Ogre3D's system as well.
I wrote Squirrel bindings for mine so you could have scripts like:
TestParticleSys = ParticleMgr.addSystem(300);
local Params =
{
Position = Vector2f(getMouseX().tofloat(), getMouseY().tofloat()),
Direction = Vector2f(1.0, 1.0),
EmissionRate = 100.0,
MinimumAngle = 0.0,
MaximumAngle = 360.0,
MinimumSpeed = 20.0,
MaximumSpeed = 20.0,
MinimumTimeToLive = 1.0,
MaximumTimeToLive = 1.0,
MinimumColor = Color(0, 0, 255, 255),
MaximumColor = Color(0, 120, 255, 255),
MinimumScale = 0.5,
MaximumScale = 0.6,
};
TestEmitter = TestParticleSys.addEmitter("Point", Params);
Params =
{
SubtractAlpha = 0.5
};
TestParticleSys.addAffector("Color Fader", Params);
Particle systems are too much fun.
I've spent so many hours just staring at cool particle effects.
P.S: I wish your screenshots would load. :(
-
Wow, funny enough I just did this exact same thing about a month ago.
I based it off of Ogre3D's system as well.
I wrote Squirrel bindings for mine so you could have scripts like:
Particle systems are too much fun.
I've spent so many hours just staring at cool particle effects.
P.S: I wish your screenshots would load. :(
Cool :) in the version i use i have made a particle definition language where you can give initial params to the system (this also quite heavily based on how ogre does it ;) ). But i to have had plans to use squirrel for adding scriptable emitters/affectors :)
hmm the imagehost i used must have deleted the pictures.. il see if i can find another one and upload some pics :)
-
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"
Where are these?
They wasn't included in your package!
-
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"
Where are these?
They wasn't included in your package!
oops some leftovers from my other code.. it should work by just removing them.. i do not believe they are used anywhere... but i will try to get a new package up when i get home :)
-
#include "Affectorfactory.h"
#include "Random.h"
#include "ConfigData.h"
#include "Variant.h"
Where are these?
They wasn't included in your package!
where did it complain about theese? i can't find theese includes anywhere in the package i uploaded here: http://www.mediafire.com/?i1hwmluqmgq