Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Particle effects — Gideros Forum

Particle effects

brigosxbrigosx Member
edited April 2013 in Plugins
Hi to all. My game which is written in ObjC uses the Cocos2D particle system in order to accomplish some nice effects. The particle solutions I found in the forum are not even close enough to what I already have with Cocos2D. So I tried to make a plugin DLL by calling the effects from the C++ version of the Cocos2D particle system but Gideros seems to unable to load the plugin. If I remove the Cocos2D library the plugin DLL is loaded normally. I know I could use Wax and import the ObjC version but I wanted a multi-platform solution if that can be possible. Any ideas?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @brigosx here is a great discussion about multi platform plugins:

    http://www.giderosmobile.com/forum/discussion/comment/23509#Comment_23509

    Basically you don't need dll files for ios, you can use cpp files straightly. Only there needs to be some modifications to bind to lua and bind as Gideros plugin, all discussed in that thread.

    There it is also mentioned that right not, you can't access Gideros drawing surface, thus this might be something that can not be done right now, but most probably will be able to with the next Gideros version ;)
  • Thanks ar2rsawseen. However, I still don't understand why the Gideros Win32 player is not able to "find" the plugin when the DLL has the cocos2d class (I bind the class as a metatable to lua). The same plugin works fine with any other C++ class binded!!!
  • Well, I finally managed to produce a respectful particle effect with the help of cparticle.lua (found here in the forum). I just made a small correction and changed the data table a bit and voila. By the first chance I will send posts to this discussion.
  • Just as I said to the previous post, here is the modified cParticle.lua and a small sample which also has the ability to loads plist particles from the Mac's Particle Designer.
    zip
    zip
    ccParticles.zip
    16K
  • ar2rsawseenar2rsawseen Maintainer
    @brigosx maybe cocos2d class is platform dependent?

    And great idea about parsing plist ;)
  • fxonefxone Member
    edited April 2013
    @brigosx have you noticed significant drop of fps after mouse down (under Gideros Player Windows, fps 12-36)? Snow performance looks great (59-60), but explosion messes up everything...
    Edit:
    Under Android Gideros Player test performance armv6 device: Snow 7 fps... after explosion 2 fps
  • ar2sawseen actually I haven't tested for android. I'll try it today after work. fxone I did not notice that and thanks for mentioning it. I will check both issues and I will let you know.
    +1 -1 (+1 / -0 )Share on Facebook
  • Sorry for the mispelling of your name ar2rsawseen in the previous post (my damned iPhone typing). Well guys here is another version of the ccParticles project in which I have corrected the dropping FPS issue after applying the explosion effect (the particle was running constantly even it was out of emitters). However, it is still a bit slow on iPhone (no more than 24 FPS). It is a bit better on an Android tablet with better CPU. Maybe you can add some ideas to optimize this code (it is shared by another dude here in the forum). Thanks for your time mates.
    zip
    zip
    ccParticles.zip
    209K
  • @brigosx I think in utils.lua file you can "cache" some math function for better performance:

    local math_random = math.random;
    local math_sin = math.sin;
    local math_cos = math.cos;

    local math_atan2 = math.atan2;
    local math_abs = math.abs;
    local math_acos = math.acos;

    local math_sqrt = math.sqrt;
    Coming soon
  • That's not a bad idea vitalitymobile. I will try it but I still believe that particles are a bit expensive as effects. In the Cocos2D version of my game I used them only as a part of an event e.g. explosion for a crash and the snow as a background to a static screen, like the high score table etc.
    +1 -1 (+1 / -0 )Share on Facebook
  • Well I cached the maths but it didn't increase the performance on the Android tablet. Maybe as a stand alone app would have better performance than on the player...
    +1 -1 (+1 / -0 )Share on Facebook
  • OK We need some other coding guru to optimize this code :)
    I really love this approach!
    Coming soon
  • Well I found that if I reduce the number of totalParticles for the explosion effect to 500, it produces a nice effect without affecting the speed too much (the plist has 835!!!)

    However, I am sure that adding so many childs to the container sprite maybe the reason for the slowing down. I'll try something tomorrow (it's a bit late in my place and I need some sleep) and I will let you know.
    +1 -1 (+1 / -0 )Share on Facebook
  • brigosxbrigosx Member
    So I ended up with something closer to the Cocos2D approach. However, it still show small FPS on my old 3Gs iPhone. I hope someone may improve the code one day :D
    zip
    zip
    ccParticles.zip
    209K
    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.