I think it would be a good innovation, if there is support for particles (particle system).
Printable View
I think it would be a good innovation, if there is support for particles (particle system).
Hi Bagamut,
how would you envision the support for particles?
Michael
Hi guys,
I have some draft spec ready for the particles. Till 25th I am under heavy work load, but then I will arrange the file and post it here for your review.
So far it is in my mind as standalone system, which can be used as is or with entity system.
Petr
So you could use them in 2d too?
Hi Mike,
yes, I would like it to work that way.
Also some elemental setup of particle life time changes of color/alpha/size are planned - I want it very robust and universal.
Petr
Bagamut, Mike,
to update you on the progress, there are two facts I am considering for particles:
- designing the particles system the OOP way Eros starts to implement to ThinBASIC module development (see this article)
- make it as separate module (but usable with TBGL, including entity system) - it seems there will be lot of functionality and the TBGL would become big collosus, where half of help file could end up being just about particles
It could lead to some more intuitive coding. Instead of:
It could go as:Code:DIM myFlame AS DWORD
myFlame = TBGL_CreateParticle(ImageHandle, Color, ...)
TBGL_ParticleSetSize(myFlame, 1)
TBGL_ParticleSetAlpha(myFlame, 255)
TBGL_ParticlePush(myFlame, 1, 2, 3)
The same for ParticleEmitter and so on.Code:DIM myFlame AS Particle
myFlame = new Particle("c:\flame.bmp", 255, 255, 255)
myFlame.Size = 1
myFlame.Alpha = 255
myFlame.Move(1,2,3)
Petr
Hi Petr,
sure the second version looks better and is easier to read.
Michael
Thanks Mike,
yes, much easier on the eyes. I will try to follow this pattern.
In future, it could be great new approach even for scene-entity system as well...
Petr
One more idea from my confused draft, I hope you don't mind I put it here per partes, but it seems easier to discuss for me.
Resource management - in TBGL, it is my motivation to simplify this side of graphic coding as much as possible, which is already reflected by fact all TBGL objects are garbage collected.
With Particles, I would like to take it one step further. For example - unless needed for advanced tasks, there would be no need to manage texture handles at all! Only thing referenced will be the particle itself.
Once you define texture as particle property by filename for example, engine will store the texture handle internally and programmer will not have to care about it anymore. In case of multiple particles with the same texture, only one handle will be used internally (no repeated texture loading) to save GPU memory. Something similar is already present in m15 file handling.
Then the particle emitters and particles themself will be garbage collected as well, so programmer can focus on using them instead of scratching head where did he forget to release memory.
Petr
I am happy to hear that!
Do you have any special requirements or simply list of features you need in the particle system?
Petr
The particles themself don't need to be referenced, but the emitters. You need to able to transform them like other entities. Features?
Like I said, emitters should be transformable. Move, Rotate, Scale.
Reflectors who be awesome too. Maybe gravitiy fields too.
Thanks Mike,
regarding referencing particles ... for some simple cases I think why not, I will keep it as an option.
Could you explain more on reflectors, I must admit I don't understand the term precisely
Gravity fields are good idea, and on the similar note, I was thinking about emitting surfaces. That means you could for example define square, and then say you want to emit particles with custom frequency in direction perpendicular to its surface, which could be great for weather.
Imagine putting such a virtual square on top of your city model, then animate just the square to gentle periodic wave movement (+/- 5 degrees), and you have nicely randomized direction for rain particles...
Petr
http://www.ru.is/kennarar/hannes/use...i/ch20s03.html
Sometimes people name them reflectors or deflector. It is basically defining an object as one and then particles bounce of them.
Perfect, now I get it. Ok, I am adding it on the list!
Petr