Author Topic: [Request] Solarus Particle Engine  (Read 1942 times)

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
[Request] Solarus Particle Engine
« on: September 22, 2015, 03:42:56 am »
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)
« Last Edit: September 22, 2015, 03:44:31 am by zutokaza »

Renkineko

  • Jr. Member
  • **
  • Posts: 81
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #1 on: September 22, 2015, 07:26:30 am »
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 ^^

Diarandor

  • Hero Member
  • *****
  • Posts: 1044
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #2 on: September 22, 2015, 04:15:35 pm »
@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.”

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #3 on: September 22, 2015, 11:08:02 pm »
@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. 

wrightmat

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #4 on: September 23, 2015, 12:56:30 am »
@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.

Diarandor

  • Hero Member
  • *****
  • Posts: 1044
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #5 on: September 23, 2015, 01:18:47 am »
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.
« Last Edit: September 23, 2015, 01:54:38 am by Diarandor »
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

wrightmat

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #6 on: September 23, 2015, 02:17:57 am »
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.

zutokaza

  • Full Member
  • ***
  • Posts: 146
  • Active - Making stories can take the most time.
    • View Profile
Re: [Request] Solarus Particle Engine
« Reply #7 on: September 23, 2015, 02:22:15 am »
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.
« Last Edit: September 23, 2015, 02:24:32 am by zutokaza »