Spine: 2D skeletal animation

Ah, good to hear you are not restricting it to Java7. :slight_smile:

The new plist file you gave me doesn’t fix the problem… :-\

Ok, I managed to borrow a Mac and I think I’ve figured it out. I’ve updated the download links to 0.83beta. Can you give that a try, pretty please? :slight_smile:

Yup, it opens now. :slight_smile:

No splash screen, and it seemed to take slightly longer to load compared to the first release. But maybe I’m just imagining it.

Nice! Grrr stupid splash screen and Macs! :stuck_out_tongue: Thanks for trying it out so many times. I’ve updated the 0.83beta Mac download and I think I’ve got the splash screen fixed (didn’t think it was worth bumping the version number). I had to give back the Mac I had briefly borrowed, so I don’t know for sure.

Edit: nope, still didn’t work. After two more tries I got it working and confirmed with a friend that has a Mac. The next version (which isn’t up yet) 0.84beta will have a working splash on Mac. What a pain! Special thanks goes to Starfarer, who solved the bullshit Apple pulled in the latest OSX, where launching an untrusted Java app told the user “this app is damaged, you should move it to the trash”.

Hello. I’ve tested Spine on Windows and just recently on my Mac mini (OSX 10.8.1) and it works perfectly fine. It loads pretty fast and also works smoothly. By the way, switching between Setup and Animate was not intuitive, I had to watch the videos. But it’s not a big deal. I think Spine is an excellent tool, and I will buy it if our artists think it might contribute to their work.

Thank you very much Nagi, we are making a couple of small changes to highlight that you can actually press the SETUP/ANIMATE and spine logo buttons :slight_smile: Hope your artists like working with it.

I have just started testing Spine and it looks great, but I am having some troubles getting started. My OS is Ubuntu 64-bit and I run the *.jar file by “java -jar java -jar ~/Downloads/spine-0.81beta-linux.jar” and Spineboy appears. I go to the folder where I have my images for the limbs and import them, but I can’t really find out how to create spines to make animations. Each image has a slot and when I select a slot I can click on “Set Bone” at the bottom right, but nothing happens. Isn’t this the proper way to create a bone? I have tried clicking and dragging as well, but nothing happens then either.

I also had some troubles with Spine chrashing when deleting images under slots, but I can’t really reproduce those errors. The stack traces are sent through the great web though :slight_smile:

Krøllebølle, can you make sure you are using the latest? I see some exceptions were submitted from a Linux user, but the version is 0.81beta, which is now old. The current version is 0.83beta and the latest links are in the first post in this thread. That should fix the crashes.

To create bones, use the “Create” tool under the “Tools” group in the main toolbar at the bottom of the screen. Click and drag in the editor to create a bone, but first be sure to click the bone you want as the parent of the new bone you are creating. If you don’t have any bone selected, you can’t create a new bone.

Next, attach images to your bones by using drag and drop. It is easiest to drag an image from the tree to a bone in the tree. Once the image is on a bone, you can click it in the editor and position it where you like. After that you can click “SETUP” in the upper left to go to “ANIMATE” mode, where you can set keys and animate your skeletons.

Thanks, didn’t check for an update today, so that’ll be me then! ;D I’ll remember to check for updates from now on.

I guess I kinda started in the wrong end by importing the images first. Makes sense to create the skeleton first and then import images for the bones.

Either workflow can make sense, I suppose. In a lot of cases it is probably easier to arrange the images how you want, then create the bones in the correct place on top. You can do this by attaching images to the root bone, position them all, draw bones on top, then use the tree to move the images from the root to the appropriate bone. Tip: disable image selection in the “Options” toolbar group so you can create bones on top of the images. Also note you can drag images from the tree directly into the editor, which attaches them to the root bone.

So assuming I’m already working on a game in LibGDX (which would be a good assumption because it’s true) do you have any tips on what would make integration with Spine driven characters as painless as possible? Do I want to go back and use Scene2d as a base? Any suggestions/best practices that I can put in my codebase to make things easier to integrate once you guys start selling exporters?

There is not really anything special you need to do. You don’t need to use scene2d. The libgdx runtime is easy to use, I’ll describe it really quick and show the current API. Here is how you would load the data:


SkeletonJson json = new SkeletonJson();
TextureAtlas atlas = ...
SkeletonSkin skin = json.readSkin(skinFile, atlas);
Skeleton skeleton = json.readSkeleton(skeletonFile);
SkeletonAnimation animation = json.readAnimation(animationFile, skeleton);
SkeletonModel model = new SkeletonModel(skeleton);
model.setSlotImages(skin);

  • SkeletonJson: Loads from JSON files. There is also a SkeletonBinary class for faster loading and smaller disk size. The API is identical.
  • SkeletonSkin: Stores the data for images and their attachment SRT (scale, rotation, translation) for each bone they can attach to. It looks up texture regions in the atlas by image name.
  • Skeleton: Stores the bones, slots, and bind pose.
  • SkeletonAnimation: Stores the key frame data for an animation
    [li]SkeletonModel: Stores data per instance of a skeleton: the current color and image for each slot.


As you can see, the only state is in SkeletonModel, the other objects are just data. Your game will have a SkeletonModel instance for each thing you want to draw. To draw, first you pose the model’s skeleton by applying an animation, then you draw the model:


animation.apply(model, time, true); // true is for looping
model.update(deltaTime);
model.draw(batch);

That’s all there is to it. The time you pass to the animation is how much time (a float, in seconds) has elapsed since the model has been in the animation state. So the state you need to store in your game is 1) which animation a model should use, and 2) how long the model has been using that animation.

Of course if your model can attach various images to slots, you’ll also need to manage what images are attached. model.setSlotImages(skin) as shown above is a shortcut which attaches the first image for every slot. This is convenient for models that only ever have one image per slot, but you can also set the images yourself and that works like this:


SkeletonSkin skin = ...
SlotImage image = skin.getImage("slotName", "imageName");
model.setSlotImage("slotName", image);
model.setSlotColor("slotName", r, g, b, a); // rgba are floats

I also showed how to set the color for a slot, if you needed to do that. Note that an animation can change the image and color for slots, so you could use animations instead of tracking it in your code. Eg, if you want to equip a sword you can have an animation where the character pulls out a sword. Halfway through, the animation would attach the sword to the “hand item” slot. When you play this animation on your model, it changes the image attached to that slot until you or another animation changes it again.

Feedback on the API is welcome!

Thanks for the info, seems pretty easy to use.

I noticed a thing while playing around; if I switch desktop while Spine is open and then back to the desktop with Spine it is not possible to run animations anymore. It is on Ubuntu 64 bits. I guess this shouldn’t be a top priority, but now you guys know! This happens whether an animation is already running or not.

I’ve just tested this, and I believe it has to do with the way lwjgl handles key input, if you use the switcher and not the shortcut keys for it, it doesn’t cause any problems, ctrl seems to get stuck, so hit ctrl again after switching if you use shortcut keys to make it resume playback.

Yup, that seems to do the trick! When I reported this previously the whole OS freezed because of this, but I believe that is an Ubuntu problem, not a problem with Spine. I’ll just stick with pressing ctrl now and then :slight_smile:

Something weird happened just now when I loaded a project; I suddenly had moved to a position at around 200000,-50000. Dunno what happened, but it took some scrolling to get back to 0,0. Maybe a button “zoom to center” might be handy?

Btw, do you have an ETA for Spine? Is it more likely to be January instead of April for instance?

[quote]Btw, do you have an ETA for Spine? Is it more likely to be January instead of April for instance?
[/quote]
A little hesitant to give you an exact date, but it will definitely be in January, maybe even a version with export in December.

Regarding your position issue, that sounds very strange, I’ll see if I can reproduce. However click the zoom icon in the lower left corner of the viewport twice, to set the camera back to 0.0 :slight_smile:

Not sure if this was mentioned, but would it eventually be possible to “blend” between animations?

By that I mean… If the user is running, and then stops running, it “blends” smoothly into the idling position rather than just switching animations immediately.

[quote]Not sure if this was mentioned, but would it eventually be possible to “blend” between animations?
[/quote]
Yes this is something we want to add later, it should be pretty simple to do at runtime in your game given the data you get, but we want to add an animation mixer for creating this later on.

Since animations just pose the skeleton, blending two animations will be easy. I plan to write the method to do it, but haven’t gotten to it yet.

Don’t hold your breath on an animation mixer. :slight_smile: This is different than mixing two animations, it’s a tool in the editor like the dopesheet, but shows you animations instead of keys. This makes it easy to arrange various animations to build a cinematic cutscene. It would take a lot of effort to build though, and there are many features prioritized above it.

Normally I’d have more Spine updates in this amount of time, but I’ve moved 3 times in as many weeks (crashing on couches!). Tomorrow I’m on a plane to Austria, land of zee fried meats, to visit Mario.

Cool, what are you guys planning to do? Or is it just a friendly meet up?