• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion Graphic artifacts with Spine animation

S

Sergei

Guest
Good day!

I'm using the latest version of GameMaker Studio 2 and the latest version (not Beta) of Spine. I created a character with several animations: standing, coming, swinging, hitting and returning. For the standing and walking animations, I have key points for all the bones (well, maybe I did not set Root for the bone). In general, I try to set key points only for those bones that I need to somehow control. For swing, hit and return animations, I set key frames for only two bones of the hand, since I do not want to influence anything else here. So I can attack in motion. Animations of standing and motion are cyclical, so here I do nothing. But other animations should not be played back cyclically, so I hang events on them. They look like this: AttackSwing, AttackHit, and AttackReturn.

Actually it all starts with the fact that I force the character to stand:
Code:
skeleton_animation_set("Stay");
All this is reproduced on track 0. When I press 1 (I'm checking for the moment of the first press, and not on hold), I want the character to hit with his right hand. On track 2, I set the animation:

Code:
if(keyboard_check_pressed(ord("1")))
{
    skeleton_animation_set_ext("AttackChopSwingRight",2);
}
Everything is working fine here. However, the animation is circulating. For this, I start processing the Animation Event:
Code:
var eventName=event_data[?"name"];
var eventTrack=event_data[?"track"];
var eventInteger=event_data[?"integer"];
var eventFloat=event_data[?"float"];
var eventString=event_data[?"string"];

var trackLeft=1;
var trackRight=2;
var trackBoth=3;

if(eventTrack==trackRight)
{
    if(eventName=="AttackSwing")
    {
        skeleton_animation_set_ext("AttackChopHitRight",trackRight);
    }
    else if(eventName=="AttackHit")
    {
        skeleton_animation_set_ext("AttackChopReturnRight",trackRight);
    }
    else if(eventName=="AttackReturn")
    {
        skeleton_animation_clear(trackRight);
    }
}
My idea is correct. Indeed, there is a swing, kick, return and then a standard animation of standing. I have not done the smooth transition yet. Faced artifacts. Watch the video:
Where do these artifacts come from? How to fix it?
 

rIKmAN

Member
Are you keying any slots for the animation, or is it all just keying bones?

My first guess would be something to do with using multiple tracks - maybe this post might help?
 
S

Sergei

Guest
Are you keying any slots for the animation, or is it all just keying bones?
In Spine, I animate only the bones. However, for the convenience of the animation, it's in Spine that I put a picture with a sword on the slot. I do the necessary movements and then turn off the display of the sword picture when I'm going to export the character.

My first guess would be something to do with using multiple tracks - maybe this post might help?
But I need to use several tracks, since I need an attack in motion, as well as parallel attacks for each hand. Redone the code:
Code:
var eventName=event_data[?"name"];
var eventTrack=event_data[?"track"];
var eventInteger=event_data[?"integer"];
var eventFloat=event_data[?"float"];
var eventString=event_data[?"string"];

var trackLeft=1;
var trackRight=2;
var trackBoth=3;

if(eventTrack==trackRight)
{
    if(eventName=="AttackSwing")
    {
        var frame=skeleton_animation_get_frame(0);
        skeleton_animation_set_ext("Stay",0);
        skeleton_animation_set_frame(0,frame);
        
        skeleton_animation_set_ext("AttackChopHitRight",trackRight);
    }
    else if(eventName=="AttackHit")
    {
        var frame=skeleton_animation_get_frame(0);
        skeleton_animation_set_ext("Stay",0);
        skeleton_animation_set_frame(0,frame);
        
        skeleton_animation_set_ext("AttackChopReturnRight",trackRight);
    }
    else if(eventName=="AttackReturn")
    {
        var frame=skeleton_animation_get_frame(0);
        skeleton_animation_set_ext("Stay",0);
        skeleton_animation_set_frame(0,frame);
        
        skeleton_animation_clear(trackRight);
    }
}
I reproduce in slow motion:
And here I reproduce as it was before, only in slow motion:
Any ideas?
 

rIKmAN

Member
Do you have R/T/S keys set for every bone at the beginning and end of every animation - even if they aren't being used?
Do you have any animations that have only 1 frame? (ie. a static idle animation)
 
S

Sergei

Guest
Do you have R/T/S keys set for every bone at the beginning and end of every animation - even if they aren't being used?
In the three animations, I only used the R keys. Now installed two more: P and S. Is it necessary to add all three keys in the last key frame of the animation? At the moment I added all three keys at the beginning and end of each animation. Intermediate frames I do not use P and S. I do not use the Shear modifier at all. Unfortunately, animation is reproduced in the same way with defects.

Do you have any animations that have only 1 frame? (ie. a static idle animation)
No, I do not have any animation from one frame.

What other ideas can there be?
 
S

Sergei

Guest
For debugging, I decided to play all the animations only on track 0. When I press 1, I switch the animation:
Code:
if(keyboard_check_pressed(ord("1")))
{
    skeleton_animation_set_ext("AttackChopSwingRight",0);
}
It turns out this picture:
It is seen that when I click, another animation starts cyclically. Though sharp transition, but it was done. Everything is normal. Next, I decided to play the following animation when I got one of the events:
Code:
var eventName=event_data[?"name"];
var eventTrack=event_data[?"track"];
var eventInteger=event_data[?"integer"];
var eventFloat=event_data[?"float"];
var eventString=event_data[?"string"];

var trackLeft=1;
var trackRight=0;
var trackBoth=3;

if(eventTrack==trackRight)
{
    if(eventName=="AttackSwing")
    {
        //var frame=skeleton_animation_get_frame(0);
        //skeleton_animation_set_ext("Stay",0);
        //skeleton_animation_set_frame(0,frame);
        
        skeleton_animation_set_ext("AttackChopHitRight",trackRight);
    }
    else if(eventName=="AttackHit")
    {
        //var frame=skeleton_animation_get_frame(0);
        //skeleton_animation_set_ext("Stay",0);
        //skeleton_animation_set_frame(0,frame);
        
        //skeleton_animation_set_ext("AttackChopReturnRight",trackRight);
    }
    else if(eventName=="AttackReturn")
    {
        //var frame=skeleton_animation_get_frame(0);
        //skeleton_animation_set_ext("Stay",0);
        //skeleton_animation_set_frame(0,frame);
        
        //skeleton_animation_clear(trackRight);
    }
}
The result is the following:
And here you can see the complete nonsense. How to fix?
 

rIKmAN

Member
Are you sure you aren't keying any slots on/off, like in this thread: https://forum.yoyogames.com/index.php?threads/spine-2d-slow-compiler-limited.27412/

Without seeing your Spine project and full code it's hard to tell, so all I could suggest is filing a bug with the helpdesk and attaching the project which shows the problem.

Make sure to update this thread with any information you get in a response.

Also you don't say which version of GMS and which version of Spine you are using.
 
Last edited:
S

Sergei

Guest
Are you sure you aren't keying any slots on/off, like in this thread: https://forum.yoyogames.com/index.php?threads/spine-2d-slow-compiler-limited.27412/
What do you mean by disabling slots for animation? I have a character with lots of bones. The main bone is called Root. It leaves three bones: BodyPivot, HipLeft and HipRight. And the bounding box is also bound to it. I created the BodyPivot bone to manipulate it from under GameMaker Studio 2. Therefore, when I create a character's pose, I turn off its display (I just do not need it to be able to allocate it). From the bone of BodyPivot, I have the bone of Body. And from it go the bones: ArmLeftPivot, ArmRightPivot and HeadPivot. And here also all these bones are hidden, since they are necessary for me to control only from under GameMaker Studio 2. Consider what comes from ArmRightPivot. From it go the bones, already a chain: ShoulderRight and then HandRight and closes it all bone WeaponRight. There is a WeaponRight hidden, since I do not need to manipulate it in Spine. And to this bone hangs a nest where I picked up a picture with a sword. All the bones with the Pivot prefix are hidden from me and have zero length. Bone WeaponRight is also hidden and also has zero length. All this I set up for this character settings. In animations, I never change the visibility of bones or slots. In the animation, I manipulate only the rotation and position.

Also you don't say which version of GMS and which version of Spine you are using.
GameMaker Studio 2 (IDE: 2.0.6.146 Steam, Runtime: 2.0.6.96) and Spine 3.5.51 Essential.
 

rIKmAN

Member
What do you mean by disabling slots for animation?
I meant exactly what it says - do you enable/disable and key any slots during the animations.
You said you don't though, so I guess that isn't it.

Do you apply any of the R/T/S keys to the root bone?
If so, this can cause issues, create a "myRoot" bone under "root" and use this instead.

GameMaker Studio 2 (IDE: 2.0.6.146 Steam, Runtime: 2.0.6.96) and Spine 3.5.51 Essential.
Until recently Spine 3.4.02 was the supported version, and I don't remember seeing anything in the Release Notes regarding Spine support being updated, although it does say 3.5.xx in the SDK Versions article.
Might be worth running a few tests with 3.4.02 just to rule it out as it's possible the docs are incorrect.

Rather than that wall of text describing your bone hierarchy, would it not be easier to post a screenshot - or at least format it properly so it doesn't hurt peoples eyes to try and read it?

As I said there are a lot of silly rules you have to follow when working with Spine in GMS, so you have either fallen foul of one of these or discovered a bug with tracks.

I have not used tracks myself yet so I can't comment on whether that might be the issue, but still send the project to helpdesk with a bug report and see what they say while trying to find a fix yourself.

Also - if you know any other framework or languages that support Spine via a module or plugin etc, try using the same Spine files with that and see if you get the same issues.

This will help narrow down whether it's a GMS+Spine specific issue, or a problem with the way you have setup your skeleton and animations.
 
S

Sergei

Guest
Rather than that wall of text describing your bone hierarchy, would it not be easier to post a screenshot - or at least format it properly so it doesn't hurt peoples eyes to try and read it?
I can provide the Spine project file. I'm interested in hearing your advice on how not to do and because of what I have such problems. Project.
 
S

Sergei

Guest
Also - if you know any other framework or languages that support Spine via a module or plugin etc, try using the same Spine files with that and see if you get the same issues.
I started using Spine at the same time as GMS2. And it happened not long ago.
 

rIKmAN

Member
I started using Spine at the same time as GMS2. And it happened not long ago.
Do you know any other languages, engines, or frameworks other then GMS?
If so, try loading up the same Spine files using that and see if you get the same problematic results/
 
S

Sergei

Guest
Do you know any other languages, engines, or frameworks other then GMS?
I know other languages. But it takes time to try all this. It is possible to find an error in my project will be much faster than spending a lot of time on making Spine Runtime work in another environment.
 

rIKmAN

Member
I know other languages. But it takes time to try all this. It is possible to find an error in my project will be much faster than spending a lot of time on making Spine Runtime work in another environment.
I just had a quick look, and you don't have R/T/S keys for every bone which I mentioned you should do earlier.
ie.ShoulderLeft, HipRight, HipLeft etc only have a scale key set on the final frame.

Try setting R/T/S keys at the start and end of every bone, in every animation, even if the bone is not used.
Check this mantis entry: http://bugs.yoyogames.com/view.php?id=25597
 
S

Sergei

Guest
Try setting R/T/S keys at the start and end of every bone, in every animation, even if the bone is not used.
Is it like this?! If I do this, I will contradict myself! Motion animation. When the character moves, I change the positions for the legs and hands. Animation of attack. I change the position for the hands. But if I do as you say and I change positions for the legs, then when I attack in motion, I will not have the character to move, but will play the animation of the attack, where I installed, for some reason, key frames for the bones Feet. Just do not say that GameMaker Studio 2 is intended only for this kind of animation, where you could only play one action at a time (either going or attacking). After all, there are the same tracks. So at all it is not necessary to install to me in animation key frames on those bones, which I do not need to change. I will recheck R, P and S for the first and last keyframes. On intermediate frames, I do not need to do them?
 

rIKmAN

Member
Intermediary frames don't need them no, but you must have them at the start and end of every bone in every animation.
Don't ask me why as it isn't required in other languages I've used Spine in - that's why I submitted that ticket - but I had weird things happen in GMS when I didn't.

In terms of the way you are using tracks, as I said I'm not sure as I haven't needed to use tracks in GMS yet so I can't help you with any problems that might create or bugs it may have.

I would submit a helpdesk ticket, attach your GMS project and Spine project and see what they say.
 
S

Sergei

Guest
I saw this on Mantis and wondered whether it may be related to the issue you were having using multiple tracks?
No, he can not. Since I tried this whole thing to use only on track 0. The result is the same. I reported the problem to the developers yesterday. While the answer was not.
 

rIKmAN

Member
OK well you didn't update the thread so I didn't know you'd tried it all with track 0.

Let us know what the devs say when they get back to you, and whether it's a bug with GMS or a bug with your setup/code.
 
Top