External Particle Engine for Cocos (Magic Particles)

External Particle Engine for Cocos (Magic Particles)
0.0 0



I am developer of Magic Particles: http://www.astralax.com

Magic Particles allows to create the special effects and playback them from own program. Magic Particles is cross-platfrom solution. At this moment API of Magic Particles exists for Windows, Mac OS, iOS, Android, Windows8 / RT, Windows Phone 8, FlasCC and Marmalade SDK.
My API does not use any external functions except those ones which have been standard of C++ for a long time. That is why library draws nothing on its own, but it returns to user all information allowing to draw the special effect. Such a way allows to separate API from OS and graphic engine.
Also there is wrapper that allows to simlify the integration of API into user engine. Wrapper is an example with its own manual and open source code. The drawing of particles is exercised by wrapper.
You can download the wrapper for Cocos here: http://astralax.com/wrapper

List of commercial games that use Magic Particles: http://astralax.com/titles


New features of Magic Particles 2.22:

Physic objects were added: wind, obstacle and magnet. Wind is external power, obstacle allows to detect the collisions, magnet attracts or repulses the particles. The examples are located in file physics.ptc (folder Samples of installed program).

Possibility of managing the events was added. For example, it is possible at the moment of particle distruction to create another particle or to destroy the particle at the moment of collision with the obstacle.

Custom variables of the type bool, int, float and string appeared for folders, emitters and particle type. These variables are extracted with the help of API. It is possible to use the diagram as variable for emitters.

Possibility of objects finding by name was added.

At present the user may turn on or turn off the texture optimisation in storage.

Square sizes may be obligitary defined for textural atlases.

Magic Particles may be installed into separate folder. It allows not to delete previous version.

Possibility of hiding/showing Timeline was added. Use View->Timeline.

(API) Functions for working with Events appeared. For example, user can get the message about creation of new particle and execute some actions at this moment.

(API) Possibility of creating, changing and deleting of physic objects directly with the help of API was added. Magic Particles uses own decision to detect collision, but there is possibility of including external physic engine.

(API) At present user can control every particle directly changing the position, size and other properties of particle.

(API) Functions for I/O streams were added.

(API) Possibility of choosing the direction of axes X,Y,Z was added.

(API) Totally approximately 50 new functions were added to API, the description of which is possible to find in the file API.chm.

(API) Number of the wrappers for fast integration of API into engines was increased. Wrappers for Mac OS, iOS, Android, Windows 8 / RT, Windows Phone 8, Cocos2dx were added.


It looks really cool — but I am confused. Do I really need to add 10+ megabytes of application object code to use this? For plist based Cocos2d-x particles, I do not need to add anything.

Am I missing something?


Do I really need to add 10+ megabytes of application object code to use this?
All files of Magic Particles are located in the folder Magic_Particles

Files magic.dll, magic.lib, magic.h are API for Windows.
Files mp.cpp, mp.h, platform_win_posix.cpp, platform_win_posix.h are core of the wrapper.
Files mp_wrap.cpp, mp_wrap.h are wrapper for Cocos and OpenGL.
File stb_image.c is used to load png, jpg, etc.


Some bugs were fixed: http://astralax.ru/download/programm/cocos_wrapper_131108.zip
Also I updated all wrappers and all libraries.


HEy Alexey,
I am interested in Magic Particles, and trying to build the sample wrapper for Cocos2d-x. I could compile and execute it for the simulator, but no luck on device (ios 6.1), even though i linked with libimagic.a.

Any help or support forum somewhere, or additional documentation?



>I could compile and execute it for the simulator, but no luck on device (ios 6.1), even though i linked with libimagic.a.
Wrapper contains libimagic.a for simulator only. You need to change libimagic.a. Download library for device from: http://astralax.com/engine

>Any help or support forum somewhere, or additional documentation?
My forum: http://astralax.com/forum_en/index.php

There are 3 manuals for Magic Particles:

  1. Particles.chm describes visual editor of Magic Particles
  2. API.chm describes functions of API
  3. Wrapper.chm describes Wrapper, but only core was described. Unfortunately, it is impossible to describe all versions of wrappers.


Alright thanks,
giving it another go.



I have downloaded and linked the new libimagic.a for ios under Apple/Device/arm_7_7s, but still no cigar.

Execution of the wrapper xcode project on device (ipad4) turns up this error:

`2013-12-12 13:23:49.675 wrapper_cocos[9252:907] cocos2d: surface size: 2048x1536

cocos2d.x.version: 2.1rc0-x-2.1.4
cocos2d.x.compiled_with_profiler: false
cocos2d.x.compiled_with_gl_state_cache: true
gl.vendor: Imagination Technologies
gl.renderer: PowerVR SGX 554
gl.version: OpenGL ES 2.0 IMGSGX554-73.16.1
gl.max_texture_size: 4096
gl.max_texture_units: 8
gl.max_samples_allowed: 4
gl.supports_PVRTC: true
gl.supports_NPOT: true
gl.supports_BGRA8888: false
gl.supports_discard_framebuffer: true
gl.supports_vertex_array_object: true

dyld: lazy symbol binding failed: Symbol not found: ___sincosf_stret
Referenced from: /var/mobile/Applications/76DF0678-B1CB-4F07-B908-4B1DE6546FFC/wrapper_cocos.app/wrapper_cocos
Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___sincosf_stret
Referenced from: /var/mobile/Applications/76DF0678-B1CB-4F07-B908-4B1DE6546FFC/wrapper_cocos.app/wrapper_cocos
Expected in: /usr/lib/libSystem.B.dylib
Linking libSystem.B.dylib does not help. In the new download i also see a magic.h, that so far i have not used…
I’ll try integrating directly into my own project so that i might pinpoint what i may be doing wrong.


Loic Argelies
I tested my library on iPad Air and it works: http://www.astralax.com/images/internet/ipad_video.mov

But I rebuilt other version for you: http://www.astralax.com/hlam/libimagic_test.zip
Please, test it and inform me about results.


Thank you for the quick answer and support. Will let you know how it goes.


So with the new lib i am still getting the same error. It’s either something i am doing wrong in my build setup - so i will try adding things step by step in another project to try and identify that, or possibly it has something to do with the deployment target and ios version.

Have you had a chance to test it on a prior version of ios? ipad air would be ios7, and i am building for 6.1.


>Have you had a chance to test it on a prior version of ios? ipad air would be ios7, and i am building for 6.1.
Yesterday I gave my user this library and he answered:
“It can be compiled on my ipad1 and works well.”
“Compilation environment: Xcode 4.5.2, iOS SDK 6.0, Apple LLVM 4.1”

But he uses my API without Cocos.

Perhaps, your xCode uses old version of library yet. xCode may copy old library to temporary folder and use this version. New version may be ignored while old version is located in temporary folder. I am not sure, but it seems to me I fixed analogical situation recently.


Alright, many thanks for investigating. This must be something on my end then ; I’ll dig further.



Loic Argelies
>Alright, many thanks for investigating.
You are welcome

I have uploaded new version of wrapper for Cocos: http://www.astralax.com/wrapper
Perhaps it will help you to resolve the problem.


Thank you for letting me know, downloading now.



Hi, When the wrapper for Cocos2d-x-3.0 will be published?



Hi, When the wrapper for Cocos2d-x-3.0 will be published?

I will deal with it, when I have time. Currently I do not see that many users are interested in usual Magic Particles with Cocos2dx. Therefore I will spend my time on development new version of Magic Particles. Besides, any user will be able to integrate Magic Particles with any version of Cocos2dx on his own.


@Odin_KG Thanks for your reply. I encountered a problem when i integrated Magic Particles with Cocos2dx, I found that I could not set the rendering order of the emitter,whatever I did, the emitters(particles) are always at the buttom of other nodes, such as sprites,layers.Could you please tell me how to solve it.



Thanks for your reply.

You are welcome.

I used layers of Cocos2dx in wrapper:

class CCMagicEmitter : public cocos2d::CCLayer

It works and I tested it.

If you want to integrate Magic Particles on your own then notice Magic Particles do not have the own layers. It is enough to draw the emitters in the necessary order.