[Request] Solarus Particle Engine

Started by zutokaza, September 22, 2015, 03:42:56 AM

Previous topic - Next topic
September 22, 2015, 03:42:56 AM Last Edit: September 22, 2015, 03:44:31 AM by zutokaza
Hello,

I was wondering if a Particle engine will be implemented later? That way it would be easier to make blast attack animations without frame by frame effort.

For a better understanding of what I mean by Particle Engine...please check here.
http://forums.rpgmakerweb.com/index.php?/topic/4918-sapphire-action-system-iv/

Other Requests:
http://forum.solarus-games.org/index.php/topic,409.0.html (Tabs for other tilesets to bypass license issues)
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616

A request existed about a particle engine, but accordingly to wrightmat it can be made in pure lua (see: https://github.com/christopho/solarus/issues/415 ).

So I don't know if a particle generator on the engine side is still in the plans of christopho or if he changed his mind ^^

@zutokaza:
About that video, I wouldn't say that's exactly a particle engine. It seems more like some scripts with collision tests on some sprites. It should not be too hard to make a script to do all of that if you have enough free time.

Well... I don't really know if there is a universal concept of "particle engine", but I had a different idea of it, something more like what wrightmat described in https://github.com/christopho/solarus/issues/415 and the videos he linked there.

@wrightmat:
I'm interested in your scripts for particles, did you finish it or are you still working on it? (If that's the case maybe I could help a bit with the scripts, to quicken the work.)

I suppose that could be done using surfaces of 1 pixel, or maybe with sprites. The problem of drawable surfaces is that they cannot use collision tests (that could be needed for some purposes), and the problem of the sprites is that you cannot change the color or transparency dynamically, so maybe it's not so easy to do something very general...
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

@Diarandor
It is close enough, but I am not really interested in writing any major scripts any time soon or really don't have the time. Got a lot of major and minor stories for games to write. After that I will be making a whole ton of pixel art.

@Renkineko
That is great news and it seems it is already being worked on. 
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616

@Diarandor - I have since scrapped my original attempt at a particle engine. I then attempted to adapt an existing lua-based particle engine and had no luck with that either. I'd be happy to collaborate, and maybe we could figure out something together, but I think we should just start from scratch.

September 23, 2015, 01:18:47 AM #5 Last Edit: September 23, 2015, 01:54:38 AM by Diarandor
Ok, I would like to help with this, so I will try to code it someday soon.

EDIT: we would need to concrete what the script will allow to do. I mean, we need to know which customizable properties we will allow to the particles emitter, like: number of particles, speed and color (which could change with time), max distance, possible directions for emitted particles, and also which altorithms we will use, etc.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Those are all good properties, but should probably be separated out by the properties carried by the emitter and the properties carried by a particle itself.

Typically, the emitter would have: number of particles, direction, emission rate, gravity/physics (if desired).

The particle would have: velocity, life (how long the particles stays on screen, typically it will fade out over time and the max distance will be determined by the speed over the life), color (including delta, if desired) and size.

In order to improve performance, you can cap the total number of particles and utilize a pool (probably a table in Lua). The emitter has a particle_count which indicates how far back into the array/table/pool the live particles go, beyond particle_count is where the dead ones live. Whenever a particle dies, we swap its position with the last live particle, and decrement particle_count. Then we just need to iterate from 0 to particle_count when updating the particles.

Anyway, those are the basics as I've considered them. I'm just not sure how to get it all working in Solarus/Lua.

September 23, 2015, 02:22:15 AM #7 Last Edit: September 23, 2015, 02:24:32 AM by zutokaza
These links might help with the thought process.

http://rbwhitaker.wikidot.com/2d-particle-engine-2 (This has a lot of coding info)

http://wiki.blender.org/index.php/User:Phonybone/Archive/Particle_systems_thoughts

Hope it helps.
Solarus Works on ReactOS Opensource Windows OS

https://www.reactos.org/forum/viewtopic.php?f=2&t=14759&p=120616#p120616