Jump to content

Haxe runtime with Kha renderer


Recommended Posts


I am happy to announce the first release of a new spriter runtime for Haxe (https://github.com/wighawag/spriter ,  haxelib : http://lib.haxe.org/p/spriter/ ) It is originaly based on the great work of @Loodakrawa  for its c# implementation. I optimized it for Haxe and got rid of allocation (so no gc at all while spriter entity is animating!) This does not use pool neither.

The runtime itself contain no rendering code and there is currently only one library that do the rendering : https://github.com/wighawag/spriterkha This for Kha : http://kha.tech/ an awesome low level cross platform api.

You can find a test project here : https://github.com/wighawag/spriter_test

The api is still not complete and it is not yet a 1.0.0 release and I would be interested in feedback

Since Haxe can output to different languages, this could be used as a library for any such language as well. Let me know if you need help for that. My implementation has been tested on js and cpp only but should work on all target.

The library is unit tested with data from the c# implementation so it should behave in the exact same way

The "no allocation" claim is also unit tested (for the cpp target)

Hope someone find it useful.


Link to comment
Share on other sites


so no gc at all while spriter entity is animating!

Awesome! Sadly I still have many allocations (haxe as well) but I tend to reduce them in my dev branch

How did you managed to do that?

EDIT : Oh I see you use an abstract to use one big Vector instead of multiple Object for your computations. Nice ! I tend to use one static object instead but I still have some allocations (I'm cloning KeyB but I will use a static one for my computations soon).

Did you try this implementation of Kha for SpriterHaxeEngine?

Anyway, I'll give it a try. Did you make a performance test?

I'll be interested on how we can both optimize our libraries.




Link to comment
Share on other sites

Thanks Mike and loudo

I did not know SpriterHaxeEngine had a kha implementation

My main reason to do a new haxe impl was to make a version without reference to rendering and without alloc

Vector is the main trick but there are few other. Hxtelemetry was very useful for that. One of them is that because haxe Map do not have a clear method I had to keep track of the key in an array. Also I had to create a dummy key to I guess allocate first

I did not do any performance test apart from the alloc test on hxcpp. 


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...