Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Create Spine Skeleton Without LoadSkeleton2DFromSpineFile

Author
Message
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 13th Jun 2017 15:30
Hi. I've recently encountered a problem where to create a character in my game with a Spine skeleton, I have to create the skeleton by calling LoadSkeleton2DFromSpineFile. However this command is very slow (80-120ms on my machine), presumably because like the other load commands it is actually reading in the spine data and parsing it. I have a large number of characters in my game using skeletons, and so what I want to be able to do is to load in the spine file once and then create instances of it, in the same way that I load in each image once and apply it to many sprites. However having looked through the documentation, I can't immediately see a way of doing this. There is the CreateSkeleton2D command, but as far as I can see, there aren't enough other commands for me to be able to read the data from an existing skeleton and copy it into a new skeleton.

If anyone has any thoughts on how I might be able to do something like this, it would be much appreciated. Thanks!
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 14th Jun 2017 10:39
@Lucas Tiridath,

I think, you could create a 3D model with meshes and bones. Maybe you could use Blender or so and convert Spine JSON to *.X (DirectX Objects)
Than you don't have the Spine file 2D like in AppGameKit, but this would have some advantages with object instances, bones, performance and you could use better layering. But! Could cause flickering when not correctly layered in Z-Buffer.

Other option would be, to render your animations to a sprite and clone that sprite or reference to that sprite. But this would use a lot of memory with large animations and you don't be able anymore to interpolate between bones and animations.

In praxis you yould use skinning. One Spine-JSON-file. One Load, and when change the skin of your character, if the character has the same skeletton.
This is how it works in GameMaker Studio 1.4 / 2.x

Missing in AppGameKit are: Skinning, use other Atlas, Attachments

Spine animations is something, where I would prefer Game Maker Studio. That is, why I changed to 3D. But here we also miss animation blending and layered animation
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 14th Jun 2017 21:01
Hi Xaby. Thanks for the thoughts.

Quote: "I think, you could create a 3D model with meshes and bones."

So does Blender support converting Spine animations into DX animations? I couldn't immediately see an import option for it. Does it require a plugin or something?

Quote: "Other option would be, to render your animations to a sprite and clone that sprite or reference to that sprite."

Unfortunately I can't pre-render as sprite sheets because I attach the parts to the characters dynamically at runtime.

Quote: "In praxis you yould use skinning."

I don't think skinning would work, because the characters are not all playing the same animation. In AppGameKit, you play an animation on a skeleton, and so if I only have one skeleton, I can only play one animation.

I agree with you that the Spine support in AppGameKit doesn't feel very mature at the moment. I've actually run into quite a few other limitations, but I was able to hack around those at the time. However I don't think I can work around this one. As I'm working in Tier 2, I've spent the day integrating the Spine C runtime myself, and completely bypassing AGK's Spine commands. It's a shame, and I've still got some bugs to work through with it, but I don't know how else to work around this issue. Of course, this is of no comfort to Tier 1 users who don't have that option, so it would still be nice to see the Spine commands extended!
Xaby
FPSC Reloaded TGC Backer
17
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 16th Jun 2017 13:03
@Lucas Tiridath, so you ended up with a "wrapper"? Would your program also run in Android or other than Windows in this way?

And converting Spine to Blender would need a python-thingly in Blender, I think. I also thought about an converter from SpineToSpriter and from SpriterToSpine, with limitations, but in AppGameKit it would have no benefit one over the other. I think, that is also a problem, because Spine is the more advanced format. Since I have Spine Pro, I also can do Mesh-deformations, and some otherthings, which are not played correctly in AppGameKit Tier 1 Basic. But using a wrapper, would question, if AppGameKit is the right "engine".

I am also thinking about switching from Tier 1 to Tier 2, but a lot things are not work well in Tier 2. So Tier 1 is robust, and maybe Tier 2 is later easier for port and combine with other C++ libraries? I, don't know.

Would be nice, to here from you, what are your results.
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 16th Jun 2017 15:51
Quote: "so you ended up with a "wrapper"?"

Well, not really a wrapper, as it's a C API and I'm working in C++, so I can just use it directly. I'd only need to wrap it if I wanted to expose it to something else, like writing a plugin or something.

Quote: "Would your program also run in Android or other than Windows in this way?"

It runs fine on Windows and Android. I've not compiled on the other platforms since my changes yet, but I don't see why not. it's all written in ANSI C so it should be fine.

Quote: "converting Spine to Blender would need a python-thingly in Blender"

Yeah but I mean, are we talking about a Python script that already exists, or do you mean I could write one?

Quote: " Since I have Spine Pro, I also can do Mesh-deformations, and some otherthings, which are not played correctly in AppGameKit Tier 1 Basic"

Yeah the support seems really limited at the moment. Even though I'm only on Spine Essential, I'm still missing features like events etc.

Quote: "I am also thinking about switching from Tier 1 to Tier 2, but a lot things are not work well in Tier 2"

What things are you having trouble with? I've been using Tier 2 for several years now and haven't had too many problems, although I'll admit setting up the templates can be a bit of a pain.

Quote: "maybe Tier 2 is later easier for port and combine with other C++ libraries?"

Yeah this is one of the (many) big advantages of Tier 2. I integrated FreeType 2 a couple of years before AppGameKit got truetype font support, and although I've moved over to using AGK's implementation again now, my current project is still making use of other 3rd party libraries like Lua and GLM (and now Spine), as well as the various different platforms' threading APIs. I try to keep this to a minimum, because it adds to my workload, and one of the big advantages of using AppGameKit over a custom engine for me is its out of the box cross platform support. That said though, being able to bring in third party libraries when you need them can be a lifesaver (as in this case - I would be completely stuck if I were working in Tier 1).

FWIW, moving over to using the Spine runtime directly has made a huge different to my load time. The initial cost of parsing the JSON file is exactly the same, but now I only have to do it once instead of for every character, and given that I can easily have ~100 characters in the game, this makes a really big difference.

Login to post a reply

Server time is: 2024-11-24 14:25:15
Your offset time is: 2024-11-24 14:25:15