Spine tilemap support

Hello everyone, I have some projects that use DragonBones, but I found that the number of draws is quite large. Can this be ignored for C++? If not, is there a way to implement a renderer using Tilemap?

Updated on September 19th:
I gave up on exploring DragonBones. Currently I use Spine to render animations and I already support Tilemap and Sprite renderers.

Sure, I think the DragonBones library has implementations for Starling and for the OpenFL display list. I think it uses drawTriangles, which should be hardware accelerated now, assuming there aren’t too many other graphic types. If it uses lineTo then it may fallback to software, which would be slow

In what version does the drawTriangles method take effect? I am using openfl8.2.0 now.

drawTriangles doesn’t seem to work, I can’t draw graphics, I actually want to deal with a Spine-related high-performance renderer, but it fails. I’ve looked at the old haxelib, which is basically not well maintained, and spine-hx has no renderer.

If I use drawTriangles, should drawcall not be lowered? I have tried it for no difference.


drawcall:144
This is dragonbones, but after putting 5 objects, FPS has already started to fall.


Spine’s Tilemap renderer is currently being implemented, but encountered some problems. But what’s better is that drawcall only draws once.

%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_46046de0-ad12-4eb1-a1c1-1dcf6e606c17
The good news is that I solved this bitmap problem! I have implemented a simple Tilemap Spine renderer! I want to organize and share this Tilemap Spine, but I don’t know how to submit Haxelib.

1 Like

Is this openFl implementation or Starling?

:grinning:It is implemented by OpenFL

1 Like

@singmajesty Does Tilemap now have a way to implement grid rendering? I hope to have this support. currently this SpineTilemap renderer does not support grids.

50 Spine objects on the same screen can run smoothly with only 1drawcall, and the result should be more.

1 Like

At this point, the Tilemap renderer does not support grid rendering, so I reimplemented a drawTriangles version to implement grid rendering.:grinning:

@singmajesty I want to know the correct usage of drawTriangles. Can I merge all the points into one array and then just call it once?

Wow, it’s great. I’m very interested to try it :slight_smile:

Sure, git source:https://github.com/rainyt/OpenFLSpine

But this library does not support color modification, etc. Currently I want to improve performance first.

1 Like

SpriteRender:
import spine.openfl.BitmapDataTextureLoader;
import spine.openfl.SkeletonAnimation;

TilemapRender:
import spine.tilemap.BitmapDataTextureLoader;
import spine.tilemap.SkeletonAnimation;

TilemapRender does not support grid rendering, but it does a good job.

var loader:BitmapDataTextureLoader = new BitmapDataTextureLoader("assets/");
		var atlas:TextureAtlas = new TextureAtlas(openfl.Assets.getText("assets/sxk_N_Cloth.atlas"),loader);
        var json:SkeletonJson = new SkeletonJson(new AtlasAttachmentLoader(atlas));
        json.setScale(0.6);
        
        var skeletonData:SkeletonData = json.readSkeletonData(new SkeletonDataFileHandle("assets/sxk_N_Cloth.json"));
        // var tilea:openfl.display.Tilemap  = new openfl.display.Tilemap(Std.int(getStageWidth()),Std.int(getStageHeight()),loader.getTileset());
        for(i in 0...10)
        {
            var skeleton:SkeletonAnimation = new SkeletonAnimation(skeletonData);
            skeleton.x = Math.random()*getStageWidth();
            skeleton.y = Math.random()*getStageHeight();
            // tilea.addTile(skeleton);
            // this.addChild(tilea);
            this.addChild(skeleton);
            skeleton.scaleX = 3;
            skeleton.scaleY = 3;
            _a = skeleton;
            _as.push(skeleton);
            _a.state.setAnimationByName(0,"walk",true);
            _a.advanceTime(1/60);
        }

 override public function onFrame(e:Event):Void
    {
        if(_a != null){
            for(i in 0..._as.length)
            {
                _as[i].advanceTime(1/60);
            }
           
        }
    }

Demo Code! :laughing:

I tried a lot of methods, so I found that beginBitmapFill+drawTriangles could not be accelerated, and drawcalls still increased. :disappointed_relieved:

Hmm, beginBitmapFill + drawTriangles should be accelerated with OpenGL in the current releases. What are you using to count the draw calls?