Spine: 2D skeletal animation tool

Updated to the very latest C and C++ from GitHub and the memory issues are gone.

“No memory leaks detected.
Visual Leak Detector is now exiting.”

Thanks Nathan!

awesome work!

Latest version in GitHub does not seem to build:

5> CCSkeletonAnimation.cpp
5>g:2d-2.1rc0-x-2.1.2\spine-cocos2dx\src\spine\ccskeletonanimation.cpp(99): error C2065: ‘states’ : undeclared identifier
5>g:2d-2.1rc0-x-2.1.2\spine-cocos2dx\src\spine\ccskeletonanimation.cpp(99): error C2228: left of ‘.size’ must have class/struct/union
5> type is ‘’unknown-type’‘
5>g:2d-2.1rc0-x-2.1.2\spine-cocos2dx\src\spine\ccskeletonanimation.cpp(99): error C2065: ’states’ : undeclared identifier
5>g:2d-2.1rc0-x-2.1.2\spine-cocos2dx\src\spine\ccskeletonanimation.cpp(99): error C2228: left of ‘.size’ must have class/struct/union
5> type is ‘’unknown-type’‘
5>g:2d-2.1rc0-x-2.1.2\spine-cocos2dx\src\spine\ccskeletonanimation.cpp(100): error C2065: ’states’ : undeclared identifier
5> CCSkeleton.cpp
5> Generating Code…
Build: 3 succeeded, 1 failed, 0 up-to-date, 1 skipped

Compile++ thumb : storytellercore_static <= CCSkeletonAnimation.cpp
G:/cocos2d-2.1rc0-x-2.1.2/HeroesOfSteel/proj.android/…/…/StoryTellerCore/proj.android/jni/…/…/…/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp: In function ‘AnimationState* spine::getAnimationState(int)’:
G:/cocos2d-2.1rc0-x-2.1.2/HeroesOfSteel/proj.android/…/…/StoryTellerCore/proj.android/jni/…/…/…/spine-cocos2dx/src/spine/CCSkeletonAnimation.cpp:100:9: error: ‘states’ was not declared in this scope
/cygdrive/g/android-ndk-r8d/build/core/build-binary.mk:269: recipe for target `obj/local/armeabi/objs-debug/storytellercore_static///__/spine-cocos2dx/src/spine/CCSkeletonAnimation.o’ failed
make: * [obj/local/armeabi/objs-debug/storytellercore_static///__/spine-cocos2dx/src/spine/CCSkeletonAnimation.o] Error 1
make: Leaving directory `/cygdrive/g/cocos2d-2.1rc0-x-2.1.2/HeroesOfSteel/proj.android’

Ack! Sorry about that. Fixed!

Hi, I’ve just joined this forum, and find Cocos2d-x 3.0alpha1 really amazing so far. And spine is really awesome tool to make skeletal animation.

I want to integrate spine runtime using this code :

It works great on windows target, but fails on Android target.
This is the error I got when I run build_native.py :

[armeabi] SharedLibrary : libcocos2dcpp.so
jni/…/…/Classes/ExampleLayer.cpp:58: error: undefined reference to ‘spAnimationState_getCurrent’
jni/…/…/Classes/ExampleLayer.cpp:23: error: undefined reference to ‘spine::CCSkeletonAnimation::createWithFile(char const**, char const**, float)’
>
… still so many errors after libcocos2dcpp.so
>
collect2.exe: error: ld returned 1 exit status
make.exe: * [obj/local/armeabi/libcocos2dcpp.so] Error 1

And this is my Android.mk file

LOCAL_PATH := $(call my-dir)
>
include $(CLEAR_VARS)
>
LOCAL_MODULE := cocos2dcpp_shared
>
LOCAL_MODULE_FILENAME := libcocos2dcpp
>
>
LOCAL_SRC_FILES := hellocpp/main.cpp > …/…/Classes/AppDelegate.cpp > …/…/Classes/ExampleLayer.cpp
>
SRC_LIST := $(wildcard) (c:/spine-runtimes-master/spine-c/src/spine/*.c)
LOCAL_SRC_FILES = $/=)
>
SRC_LIST := $
LOCAL_SRC_FILES
= $(SRC_LIST:$(LOCAL_PATH)/=)
>
>
LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes > C:/spine-runtimes-master/spine-c/include > C:/spine-runtimes-master/spine-cocos2dx/src
>
>
>
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
>
include $(BUILD_SHARED_LIBRARY)
>
$(call import-module,2d)

Am I missing something?

Thanks in advance…

Do you have the spAnimationState_getCurrent function in your source?
https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-c/src/spine/AnimationState.c#L279

Not sure what else could be wrong…

Solved it, I wrote wrong codes in Android.mk to parse source files, I modified default Android.mk to refer to other drive letter, but it seems to not working. So, I change the code to default, and copy spine-cocos2dx and spine-c to working dir. Problem solved, and I also added some include files in $(LOCAL_PATH)/…/…/…/…/cocos/2d/platform

I don’t know why I have to add it since it should already be added by
$(call import-module,2d)

But it works now :slight_smile:

That is how I did it at first as well, but once I upgraded to 2.2 I found using the included extension (with some patches) to be a great option.

Hey guys, the official Spine runtimes started out as open source (New BSD), but some time ago we had to change the license in order to protect our business. :frowning: Since then, the license requires a Spine license to use the official Spine runtimes. The license is here:
https://github.com/EsotericSoftware/spine-runtimes/blob/master/LICENSE
Unfortunately this makes the official Spine runtimes not open source. I wish there was a better way, but there really isn’t. I’m afraid cocos2d-x should no longer include the official Spine runtimes, else anyone using cocos2d-x needs to buy a Spine license. Sorry!

An alternative would be to separate the module containing the official Spine runtimes from the rest of cocos2d-x. This way using the module requires purchasing a Spine license, but using cocos2d-x does not.

That is just such a huge disappointment, and I am certain I am not the only KickStarter backer who is unhappy with this.

Didn’t a specific sponsor come forward to fund a big part of your first KickStarter for Cocos2d-x? I believe it was HandiGames.

I guess we need a separate module because of what Nathan has decided to do. I hope it does not reduce adoption or excitement about Spine but I can certainly see how this type of action would have a negative impact on people who are looking for an animation framework.

I feel strongly that Cocos2d-x needs something like the Spine runtime in the extensions library.

If it cannot be Spine, is there another worth while project that we could support (even another KickStarter?) and include with Cocos2d-x?

Sorry. :frowning: I do a lot of open source and I really would prefer the Spine runtimes to be open source. We put a lot of thought into ways we could keep the official runtimes open source. Unfortunately, if they are open source then someone could write an alternative to Spine, output Spine’s data formats, and then benefit from all the Spine runtimes. We’ve put considerable effort into our 18+ runtimes and our intent was that they will be used with Spine. It wouldn’t be fair to bypass Spine and make use of all our runtimes.

To be clear, what changed is that now you can’t use the official Spine runtimes unless you have a Spine license. Anyone with a Spine license can use the official Spine runtimes in their apps, even if they don’t use Spine. Note as a KickStarter backer you have a Spine license, so nothing changes for you, or most people. I doubt anyone was trying to use the Spine runtimes without Spine yet, but we can’t wait until its too late either.

Putting the official Spine runtimes into cocos2d-x was a little weird anyway, since that forked the code. We have had a few confused users because cocos2d-x changed the runtime (regarding content scale). Getting the code from GitHub is not quite as convenient, but still very easy and means you have the latest code.

Nathan Sweet wrote:

Unfortunately, if they are open source then someone could write an alternative to Spine, output Spine’s data formats, and then benefit from all the Spine runtimes.

It sounds like you are saying that (re)creating Spine is a piece of cake.
I believe that people are paying you because they love Spine as an editor, not a bunch of runtimes. They like the interface and the features, the experience which Spine gives them. Attaching the runtime to the main game code is just an accompanying routine.
If someone creates a superior editor of 2d skeletal animation you are in danger no matter if your runtimes are open source or not. Moreover if that “someone” manages to create a worthy alternative to Spine, writing the runtimes is almost nothing comparing to that amount of work (I’m sure you know it much better than me).
If the alternative is not that superb as Spine, why should you worry? People will still buy your editor.

But if you try to limit people’s expectations (which will happen if the runtimes cease to be open source), you’ll definitely diappoint them and you can lose their loyalty. And this can cost you more than the potential material losses caused by hypothetical competitor.

So, my point is that:
* changing the license for runtimes is ok;
* ceasing to be open source is not ok.

Keep up the good work and be cool.

Making a better Spine isn’t easy for sure. :slight_smile: The license change keeps competitors from using Spine’s runtimes, regardless of whether the competitors are subpar. The runtimes are (and continue to be) a lot of work and an important piece of the puzzle. Creating great animations only matters if they can actually be used in your games.

The latest source for the runtimes is still on GitHub as it always has been, only the license changed. Everyone using Spine can just get the runtime source and use it.

3 days ago you said:

Unfortunately this makes the official Spine runtimes not open source.

Now:

The latest source for the runtimes is still on GitHub as it always has been, only the license changed. Everyone using Spine can just get the runtime source and use it.

So, where is the truth? Does it mean that runtime updates won’t be open source (but previous versions remain open source)?

Sorry for the confusion. The latest source is still on GitHub but to use it a Spine license is needed. The source is provided so it really is “open source”. I think most people (including myself) tend to think open source is the same as “free software”, but I see now they are two different things.


Yeah, that’s a common misunderstaing. There is even a term which means a truly free and open source software: FOSS (http://en.wikipedia.org/wiki/Free_and_open_source_software)

Well, I’m glad that runtimes stay open source. Good luck and happy holidays!

Nathan Sweet wrote:

Sorry for the confusion. The latest source is still on GitHub but to use it a Spine license is needed. The source is provided so it really is “open source”. I think most people (including myself) tend to think open source is the same as “free software”, but I see now they are two different things.
http://en.wikipedia.org/wiki/Open-source\_software
http://en.wikipedia.org/wiki/Free\_software

Could we continue to include the Runtime source in Cocos2d-x if the application required that the user add a license key or define to the code to acknowledge that they have a Spine license?

While i am not certain of the current state of Spine vs. Spine in v2.2 I know that I am dependent on the Spine-in-Cocos2dx-implementation at this time.

Nathan, you were very vague about the differences between the official runtime and the Cocos2d-x version — as a regular backer and repeat buyer (in addition to the KickStarter, we buy licenses for EVERY team member) I’m a bit confused and frustrated with this.

  • Will you help those of us who purchased licenses and chose to use the Cocos2d-x runtime? *

While I am glad that you haven’t done anything totally insane (like pulling the sources from GitHub) this general line of logic concerns me.

i really hope you are not putting too much energy into these phantom concerns about people building competitors and using your runtimes — and I say this as a popular Android developer (and you know how often pirates take our stuff.)

Spine is a great product. We will pay for it over and over. We will back anything you put on KickStarter. We love you.

Please, honor that and remember that there are many of us who would not compete nor take from you and we are hurt by any action that reduces our ability to use Spine.

Cory Trese wrote:

While i am not certain of the current state of Spine vs. Spine in v2.2 I know that I am dependent on the Spine-in-Cocos2dx-implementation at this time.
>
Nathan, you were very vague about the differences between the official runtime and the Cocos2d-x version — as a regular backer and repeat buyer (in addition to the KickStarter, we buy licenses for EVERY team member) I’m a bit confused and frustrated with this.

The spine-cocos2dx library is an official Spine runtime. The latest official source is always available on GitHub, where I develop and maintain the library:

Using it is as easy as copying the source into your project (or using it as a dependent project). You don’t even need to use git, you can download the runtimes as a ZIP:
https://github.com/EsotericSoftware/spine-runtimes/archive/master.zip

The spine-cocos2dx library was forked when copied into cococ2d-x. This is not ideal, as now there are multiple codebases which confuses users (who don’t know which they should use) and confuses me (I don’t know what changes the cocos2d-x guys have made or which version a user has).

Could we continue to include the Runtime source in Cocos2d-x if the application required that the user add a license key or define to the code to acknowledge that they have a Spine license?

This is an interesting idea, though the license would have to change to allow this. I think it would be better all around to just avoid forking the spine-cocos2dx library.

* Will you help those of us who purchased licenses and chose to use the Cocos2d-x runtime? *

Yes of course, I support Spine and all the official runtimes for all our users. :slight_smile:

Spine is a great product. We will pay for it over and over. We will back anything you put on KickStarter. We love you.

We love you too! <3 Without you guys making great stuff with Spine, we wouldn’t be motivated to keep working on it.

Please, honor that and remember that there are many of us who would not compete nor take from you and we are hurt by any action that reduces our ability to use Spine.

It’s a good reminder, and we do definitely remember. :slight_smile: The changes should not hurt anyone using Spine or the runtimes, they are just a necessary precaution.

For what it’s worth, I have no problem with this change. It’s still trivial to drop the runtime files into your project, and the only people who need them will have a Spine license anyway. It’s a simple change and if it helps protect the future of Spine then I’m all for it.

Nathan: keep up the good work man. Thought you might want to know that our new game (Safe Cracker: http://tiny.cc/safecrackerios), uses Spine, albeit with Unity rather than cocos2d-x. It’s currently featured in the “Best New Games” section on the iOS app store in a bunch of countries and is getting great exposure. Your tech is up there and sitting alongside the likes of Cut The Rope 2, Infinite Blade 3, Rayman Fiesta Run, etc. Great work! Also, our team love Spine and we’ll definitely be using it again for the next project! Thanks to you and your team!

Ben

Nathan, you said this:

“We have had a few confused users because cocos2d-x changed the runtime (regarding content scale).”

Can you help me understand how I would bridge between using the Cocos2d-x runtime that is bundled with 2.2 and this:

“Using it is as easy as copying the source into your project (or using it as a dependent project). You don’t even need to use git, you can download the runtimes as a ZIP.”

Is there a patch to apply? Or does the ZIP file you refer to continue to support the changes “regarding content scale” within the Cocos2d-x runtime? I’m making extensive use of setScale() against CCSkeleton / Spine runtime objects.

Ben Ward said this:

“It’s still trivial to drop the runtime files into your project, and the only people who need them will have a Spine license anyway. It’s a simple change and if it helps protect the future of Spine then I’m all for it.”

And I definitely agree. We used the Spine Cocos2d-x runtime like this from 2.1.x to 2.2.x which worked very well. it wasn’t as convenient as having it included with Cocos2d-x but it does work.

Whatever protects the future of (my use of) Spine :wink: