Jump to content

Spine items performance / optimization


Recommended Posts


I'm developing a game using ejecta and pixi.js. What I noticed is that I can easily put 400 elements (bunnies) and render them @60fps, but when trying to do the same with spine animations I can go as far as 15 items before the cpu load goes wild and performance decreases.

Is there a way to optimize spine object creation and rendering? 

Below is an example derived from the spine boy demo:

function onAssetsLoaded() {    var num = 10,        spineBoy = [];    for (var i = 0; i < num; i += 1) {        spineBoy[i] = new PIXI.Spine("data/spineboySpineData.json");        spineBoy[i].position.x = i * 40 + 40;        spineBoy[i].position.y = h;        spineBoy[i].scale.x = spineBoy[i].scale.y = h / 2400;        spineBoy[i].stateData.setMixByName("walk", "jump", 0.2);        spineBoy[i].stateData.setMixByName("jump", "walk", 0.4);        spineBoy[i].state.setAnimationByName("walk", true);        stage.addChild(spineBoy[i]);    }}
Link to comment
Share on other sites

It seems that the major load is happening in the spine runtime - For pixi to be effective with spine the runtime must be updated to the latest spine features.

For now you can find a neat build of pixi.js here: https://github.com/MKelm/pixi.js 
It uses the native atlas files provided by pixi export (no texture packer - yay!) and it's actually 50% faster than the current pixi implementation in the master branch.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...