• Runtimes
  • [SFML] New here, need some basic info before trying it

Related Discussions
...

Hey there! So I'm making a game and one of the biggest goals is to make it as moddable as possible. However, the next fork in the path is a bit tricky as I'm no artist nor do I really know about software (I think this is the best out there?)

So right now, my game uses spritesheets. The problem however, is that I want to allow modders to create new abilities AND new items / new character models. I don't really know how I could allow one person to animate a model that does not exist yet, so I have to make a decision unless the following is true:

Can Spine export not just spritesheets but 'bones' as well? Is that what this whole run time thing is about? So, can one person animate a set of bones and add a few sparks or whatever, and then another person (without communicating anything but a simple base template) attach custom graphics to said skeleton? So a player could have a mod for a new character AND a mod for a new ability, and the ability will animate the different character perfectly?

I don't know if I'll come across as making sense - I'm only making the engine and have yet to find artists. However, if this is true, then wow this software is amazing and I'll buy it regardless of the fact I'm not the best at art :p

Thanks!
Ashe

Yes, the primary export formats (skeleton json and binary) store the skeleton/bone structure and animation data sorta like FBX does for 3D models and animations.
The Spine runtimes runtimes read, simulate and render those skeletons in realtime, as well as allow you to re-pose and manipulate them at runtime, just like 3D models and animations.

The Spine editor CAN sorta convert/export the skeletons and animations into pre-rendered spritesheets, but it's not the primary way to use Spine.

How easy your characters/effects/abilities to mod really depends on how you set it up.
But yes, effects/weapons/items can be separate— and are probably best kept separate anyway for highly-customizable characters, even just according to game development conventions— and you can attach them in a variety of ways to your skeleton at runtime.

Nice! This sounds amazing! Hopefully I can get this nice and set up then as that would be amazing. I was only asking about the spritesheets as I was unsure of how Spine's exporting works, but after your answer I can see that exporting to spritesheets isn't really the point here, the point is that it is the animation you export and not the thing you're animating (if you want), which is exactly what I need. I saw that there is an SFML runtime, so I will dive into that and see what there is.

Are there any sample assets that come with my purchase (going to do it in an hour) that I will be able to use? I'm no artist but I can't really make my game without some form of test assets as I keep saying.

Thankyou for that answer <3

Both the trial and full versions of Spine come with 13 example projects with data exports and packed texture atlases. Look in the examples subfolder under your Spine installation folder.

Hey there you guys,

I did it, I bought the pro edition and have seen the light. I need to get this to work with my own project now - but I have found it a bit tough.

I'm following the usage part of this: spine-runtimes/spine-sfml at master

Linked above, I'm following the steps to include it into my project, not the example but my own. When it says "Add the sources from spine-c/spine-c/src/spine and spine-sfml/src/spine to your project", does it mean locally copy an paste them into my project? I'm unsure really what to do.

Should I have the runtimes external and its include path added to my project settings, or do it locally and try it that way?

Secondly, what exactly are the files I'm #including? is it "#include <spine/spine.h>"? Is this the only file?

I know what I'm doing is wrong, as following this tutorial Loading Skeleton Data - Spine Runtimes Guide the first step is to type the following:

TextureLoader textureLoader = ...
Atlas atlas = new Atlas("myAtlas.atlas", textureLoader);

Nothing here is being recognised when I have <spine/spine.h> included.

A bit more of a step by step guide would be really appreciated, thankyou! I'm a student programmer so while I've done a lot of programming i'm still a little new to using other people's files

My discord incase you think it'd be better to message on there: Crysikrend#9746

Yes, it means to copy the source files into your project. It's the easiest way to get going, as C++ project setup can get complicated.

You need to #include <spine/spine-sfml.h>. Note that the Spine Runtimes Guide is general documentation for all runtimes, so the code provided is pseudo code. See the SFML example for a working example. You can get that going, edit it to use your own skeleton, etc and then when you are ready, integrate it into your project.

If you are new-ish to coding, I wouldn't suggest SFML or C++. You might try libgdx which is fantastic and east for desktop app development and other platforms are possible (HTML5, Android, iOS). Spine is written with libgdx and myself and badlogic are the libgdx founders (there are hundreds of libgdx contributors).

Okay, I think I'm getting somewhere, I didn't realise the code wasn't exactly code.

The only thing in the spine:: namespace is SkeletonDrawable, is that right?

I'll dissect that example now, thankyou! 🙂

Yes, only SkeletonDrawable in the namespace. The rest of the runtime is C, eg SkeletonJson_create etc. SkeletonDrawable provides some convenience methods, but likely you'll want to use some of the C API, eg to grab a bone and manipulate it, set an attachment to be visible, etc. API docs are here, you just have to map that to the spine-c API, which is very similar:
API Reference - Spine Runtimes Guide

Oh, and welcome to the Spine world! :party:

Got it working, now to understand it!

Thanks! I can't wait to get frustrated reimplementing my graphics rendering 😉

Nice! SkeletonDrawable should take care of rendering for you. :clap:

Yeah I was a little quick on the trigger when I said I got it working. I got rid of most of the errors, but after sifting through a bunch, more came about out of nowehere.

The problem seems to be that having spine-c/spine-c/src/spine as the only thing in the included directories list means that nothing can use #include <spine/spine-sfml.h>. I can use " " instead, but this would require me going through all of spines files and finding the correct path to where spine-sfml.h is copied locally.

So let me bring up the readme and go through and ask for details to make sure I can understand this right:

  1. Add the sources from spine-c/spine-c/src/spine and spine-sfml/src/spine to your project

  2. So, is the entirety of the contents of the zip from here GitHub - EsotericSoftware/spine-runtimes: 2D skeletal animation runtimes for Spine. copied to somewhere in a project, or just the files in the src/spine folders?

  3. Add the folder spine-c/spine-c/include to your header search path. Note that includes are specified as #inclue <spine/file.h>, so the spine directory cannot be omitted when copying the source files.

  4. Again, is this a link to somewhere inside the project or to somewhere external? Is this the only include? As I cannot do #include <spine/spine-sfml.h> as that isn't the include file

Thanks again!


More info, after diving into the files, spine-sfml requires the following

#define SPINE_SHORT_NAMES
#include <spine/spine.h>
#include <spine/extension.h>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/RenderStates.hpp>

however, I am also trying to use #include <spine/spine-sfml.h>. With both things requiring spine in the beginning, doesn't this mean there's going to be conflicts when trying to include things?

I know you said c++ is a bit nasty, and it is, I honestly don't know if I'm just being stupid or whether the instructions are as unclear to follow as I've found them. Not trying to be an annoyance or anything, but maybe a bit of elaboration would help many people trying to get started with the spine runtimes 🙂

You should only need to #include <spine/spine-sfml.h> and make sure spine-c/spine-c/include is in your include paths. spine-sfml.h does include all the other things, including the SFML includes. You should not have to modify any of the Spine header files!

I'm sorry for not replying in a while! I did manage to get it sorted, I restarted tried with a clean head and its nice!

Now to read online / find a tutor about how this example actually works and dissect the code! 🙂