Jump to content

SpriterDotNet - An implementation for all C# frameworks


loodakrawa

Recommended Posts

10 hours ago, alex2020 said:

I created a new library in dot net standard 2 and copied my code over.

The code is working (no Errors) and spriter.net 1.6.1 is includet  via nuget.

My Android and windows game projecty include the lib and complain that monogame is not compatible with dot net Standard 2.0. (or 1.0)

How is your project Setup for such a case?

 

 

Do you mean you're getting the NU1701 warning? If yes, just ignore it (or add it to the project's ignored warnings) - there's nothing really that can be done about it until (if) MonoGame Portable gets converted to a .NET Standard library. Everything should still work properly.

Or are you getting another error?

Link to comment
Share on other sites

  • 3 weeks later...

 Sry for the late response.

I got it working. After updating from vs 2015 to vs2017 i created new projects with .net Standard and copied the code over. For some unknown reason nuget installed everytime in one of my libs old Spriter 1.5.0. After Clearing the nuget cache and manually deleting the files nuget worked again.  But the monogame.portable was not working. I had to remove monogame.portable and add monogame.portable.opengl to my Windows project. (Android worked)

I dont know why the automatic switch for the portable wasnt working.

But now its working again.

Link to comment
Share on other sites

On 9/13/2017 at 4:54 PM, alex2020 said:

 Sry for the late response.

I got it working. After updating from vs 2015 to vs2017 i created new projects with .net Standard and copied the code over. For some unknown reason nuget installed everytime in one of my libs old Spriter 1.5.0. After Clearing the nuget cache and manually deleting the files nuget worked again.  But the monogame.portable was not working. I had to remove monogame.portable and add monogame.portable.opengl to my Windows project. (Android worked)

I dont know why the automatic switch for the portable wasnt working.

But now its working again.

Glad to hear you managed to get it working in the end. NuGet still seems confused with all this new .NET Standard stuff - hopefully they'll fix all these complications in the future. As for MonoGame.Portable - I'm trying to figure out how to depend on it without forcing the inclusion in the client because you end up with both the portable and real one which causes problems.

On 9/16/2017 at 8:07 AM, alex2020 said:

how do i use the new SpriterDotNet.MonoGame.Importer.dll ?

greetings alex

If you want to load the SpriterDotNet types directly with the content pipeline, you can include it in your .mgcb content file like this. Then you choose SpriterImporter as the importer for .scml files and load them like this. The alternative is loading the .scml files manually and deserialising them into the Spriter data structure which is a bit more complicated but you avoid dealing with the content pipeline which is a major pain.

Link to comment
Share on other sites

  • 2 weeks later...

Hello everyone! :)

I'm currently trying to replace a sprite part of an entity by another entity, but I don't really know how to do it properly.

I made a main menu screen into Spriter to easily place and animate every element. It works great, except I would like to animate each element independently.

Let's take the example of the play button. I would like to give it a pulse animation, so I created a new entity "PlayButton" with a single "Pulse" animation next to my "MainMenu" entity with its "Idle" animation where I placed all elements. When I load the Spriter file in my game, I will display the "Idle" animation of the "MainMenu", but I would like to replace the idle play button by the "PlayButton" entity.

For now, I add my 2 entities in my scene, and set the "PlayButton" entity position according to the position of the play button in the "MainMenu" entity. The problem is the idle play button is still visible. I already tried to hide it (alpha to 0, remove it from the Spriter collection, etc...), but it didn't work like I expected. In addition, I would like that the "PlayButton" entity follows the same behaviour than the play button from the "MainMenu" entity. If I decide to create an animation in the "MainMenu" entity that moves the play button out of the screen, I would like to combine this translation with the animation of the "PlayButton" entity.

Is someone already did this? Do you know how I'm supposed to do that properly?

Thanks in advance for your help :)

Link to comment
Share on other sites

On 10/2/2017 at 1:14 AM, Noxalus said:

Hello everyone! :)

I'm currently trying to replace a sprite part of an entity by another entity, but I don't really know how to do it properly.

I made a main menu screen into Spriter to easily place and animate every element. It works great, except I would like to animate each element independently.

Let's take the example of the play button. I would like to give it a pulse animation, so I created a new entity "PlayButton" with a single "Pulse" animation next to my "MainMenu" entity with its "Idle" animation where I placed all elements. When I load the Spriter file in my game, I will display the "Idle" animation of the "MainMenu", but I would like to replace the idle play button by the "PlayButton" entity.

For now, I add my 2 entities in my scene, and set the "PlayButton" entity position according to the position of the play button in the "MainMenu" entity. The problem is the idle play button is still visible. I already tried to hide it (alpha to 0, remove it from the Spriter collection, etc...), but it didn't work like I expected. In addition, I would like that the "PlayButton" entity follows the same behaviour than the play button from the "MainMenu" entity. If I decide to create an animation in the "MainMenu" entity that moves the play button out of the screen, I would like to combine this translation with the animation of the "PlayButton" entity.

Is someone already did this? Do you know how I'm supposed to do that properly?

Thanks in advance for your help :)

I'm not sure if I understand correctly but from what you said I think that you have a spriter animation for the whole menu. Technically you could make this work with sub-entities and a bunch of logic but I think a much better approach is to have individual entities for buttons and just assemble them in the program into a menu without having and actual menu entity in spriter.

If you still want to have a menu spriter entity, then you can probably achieve the result you want with sub-entities. I'm not sure if there's a more up-to-date explanation but check it out here:

 

Link to comment
Share on other sites

Hello loodakrawa,

first thank you very much for this amazing plugin. It's making my life a lot easier !

I've got a small bug? I am even not sure. So.. i want to upload character assets with spriter animations on the unity assets store. For this I'm including a small demo scene with the character and your plugin. Everything works well. 

 

Now for me to upload to the unity asset store I need to package the entire assets folder into an .unitypackage

Unfortunately when I create a new unity project and unzip the newly created unitypackage the sprites of the character are not linked anymore. Therefore on the scene itself nothing is shown.. I've to delete the created prefab and the .assets file. And reimport the .scml file so the 2 files are created again. It would be bad to expect my customers to do that themselves :D

Is there a way to fix this?

If it helps I can send you the unitypackage. 

 

Thank you for you time

 

Link to comment
Share on other sites

Thank you for your answer @loodakrawa

I was expecting to be able to do what is shown in the video, but didn't find anything about that in the documentation.

Unfortunately, even if it's cool, it doesn't match my needs because the animation of the sub-entity is stuck to the timeline of the main entity, so they are not independent like I would like them to be.

Another use case example is a "blink eyes" animation, I asked the question many months ago. You might want to have a "blink eyes" animation on an animated character that doesn't depend on every animation timelines, it's the same problem here.

What I have done to achieve this is that I created a class SpriterSubstituteEntity that take a reference Animator, the filename to replace (it would be better to be the name in the Spriter hierarchy, but I didn't be able to find how to retrieve this info), and an another Animator to use as replacement. This class will synchronize (transform + color) the Animator used as substitute with the sprite part filename found in the reference Animator:

new SpriterSubstituteEntity("play-button.png", Animators["MainMenu"], Animators["PlayButton"]);

I also create a child class from MonoGameAnimator to be able to hide the idle "play-button" from the main menu animation.

For now, it works like a charm :)

 

Link to comment
Share on other sites

18 minutes ago, Noxalus said:

Thank you for your answer @loodakrawa

I was expecting to be able to do what is shown in the video, but didn't find anything about that in the documentation.

Unfortunately, even if it's cool, it doesn't match my needs because the animation of the sub-entity is stuck to the timeline of the main entity, so they are not independent like I would like them to be.

Another use case example is a "blink eyes" animation, I asked the question many months ago. You might want to have a "blink eyes" animation on an animated character that doesn't depend on every animation timelines, it's the same problem here.

What I have done to achieve this is that I created a class SpriterSubstituteEntity that take a reference Animator, the filename to replace (it would be better to be the name in the Spriter hierarchy, but I didn't be able to find how to retrieve this info), and an another Animator to use as replacement. This class will synchronize (transform + color) the Animator used as substitute with the sprite part filename found in the reference Animator:


new SpriterSubstituteEntity("play-button.png", Animators["MainMenu"], Animators["PlayButton"]);

I also create a child class from MonoGameAnimator to be able to hide the idle "play-button" from the main menu animation.

For now, it works like a charm :)

 

2

Just a thought... for the blinking,m you could be tricky and set up character maps for the different states of all eye images... from fully open to half closed or fully clothed, and then use some code in your game engine to randomly trigger a timed sequence of changing the eye related character maps to make the blink sequence occur.

Link to comment
Share on other sites

On 10/7/2017 at 9:51 PM, Noxalus said:

Thank you for your answer @loodakrawa

I was expecting to be able to do what is shown in the video, but didn't find anything about that in the documentation.

Unfortunately, even if it's cool, it doesn't match my needs because the animation of the sub-entity is stuck to the timeline of the main entity, so they are not independent like I would like them to be.

Another use case example is a "blink eyes" animation, I asked the question many months ago. You might want to have a "blink eyes" animation on an animated character that doesn't depend on every animation timelines, it's the same problem here.

What I have done to achieve this is that I created a class SpriterSubstituteEntity that take a reference Animator, the filename to replace (it would be better to be the name in the Spriter hierarchy, but I didn't be able to find how to retrieve this info), and an another Animator to use as replacement. This class will synchronize (transform + color) the Animator used as substitute with the sprite part filename found in the reference Animator:


new SpriterSubstituteEntity("play-button.png", Animators["MainMenu"], Animators["PlayButton"]);

I also create a child class from MonoGameAnimator to be able to hide the idle "play-button" from the main menu animation.

For now, it works like a charm :)

 

I'm glad you managed to fix it - and this sounds like a perfectly good solution :-D

That being said - I'm doing a major overhaul of the whole project and I'll try to design it in the most flexible way to allow easier customisations such as this.

Link to comment
Share on other sites

  • 3 weeks later...
1 hour ago, ffman22 said:

I have a question, does spriter dot net support the animatior controller in unity? 

No since Unity's animation system doesn't support all the features Spriter has + it also doesn't provide enough low level access to do a proper integration (at least last time I checked). However, Dengar's implementation has a better integration with Unity so check that out. Also, there's another lib by Dengar that adds a portion of the same functionality to SdN) so you might want to check that as well.

Link to comment
Share on other sites

  • 1 month later...
On 10/7/2017 at 7:12 AM, Mike at BrashMonkey said:

Just a thought... for the blinking,m you could be tricky and set up character maps for the different states of all eye images... from fully open to half closed or fully clothed, and then use some code in your game engine to randomly trigger a timed sequence of changing the eye related character maps to make the blink sequence occur.

I have a related question - I also need to run two animations at the same time, when each animation affects different parts of my character. That's a bit like the blinking scenario, only more elaborate (so it can't be solved by swapping out sprites.)

The character has an attack that's done by waving one arm around. Because it's only one arm, I was able to implement this using Unity's animation layers - the attack is an animation that only moves the arm. Other animations (walking, jumping, the idle animation) affect other body parts. The attack animation is triggered by setting a boolean to true, and the rest is done by Unity's animation system. The result is pretty cool - the character can be walking, jumping or just standing, and start the attack immediately, regardless of where it is in the animation cycle. 

This was done with Spriter2UnityDX, and it works pretty well, except that I've reached the limits of what Spriter2UnityDX can handle (specifically, it messes up the z ordering of more complex characters) and I'm looking to migrate to using SpriterDotNet - the one blocking issue is that I don't see any way to implement the attack as described above. 

Any ideas on how to do that?

Thanks,

Ori

Link to comment
Share on other sites

On 12/26/2017 at 2:15 AM, Ori Pessach said:

I have a related question - I also need to run two animations at the same time, when each animation affects different parts of my character. That's a bit like the blinking scenario, only more elaborate (so it can't be solved by swapping out sprites.)

The character has an attack that's done by waving one arm around. Because it's only one arm, I was able to implement this using Unity's animation layers - the attack is an animation that only moves the arm. Other animations (walking, jumping, the idle animation) affect other body parts. The attack animation is triggered by setting a boolean to true, and the rest is done by Unity's animation system. The result is pretty cool - the character can be walking, jumping or just standing, and start the attack immediately, regardless of where it is in the animation cycle. 

This was done with Spriter2UnityDX, and it works pretty well, except that I've reached the limits of what Spriter2UnityDX can handle (specifically, it messes up the z ordering of more complex characters) and I'm looking to migrate to using SpriterDotNet - the one blocking issue is that I don't see any way to implement the attack as described above. 

Any ideas on how to do that?

Thanks,

Ori

Sorry, I'm less familiar with the SpriterDotNet Implementation .. It sounds like you need a method which sort of hijacks the animation of specific bones.. I'd search the thread and example files to see if there's such functionality.

Link to comment
Share on other sites

On 12/26/2017 at 12:15 PM, Ori Pessach said:

I have a related question - I also need to run two animations at the same time, when each animation affects different parts of my character. That's a bit like the blinking scenario, only more elaborate (so it can't be solved by swapping out sprites.)

The character has an attack that's done by waving one arm around. Because it's only one arm, I was able to implement this using Unity's animation layers - the attack is an animation that only moves the arm. Other animations (walking, jumping, the idle animation) affect other body parts. The attack animation is triggered by setting a boolean to true, and the rest is done by Unity's animation system. The result is pretty cool - the character can be walking, jumping or just standing, and start the attack immediately, regardless of where it is in the animation cycle. 

This was done with Spriter2UnityDX, and it works pretty well, except that I've reached the limits of what Spriter2UnityDX can handle (specifically, it messes up the z ordering of more complex characters) and I'm looking to migrate to using SpriterDotNet - the one blocking issue is that I don't see any way to implement the attack as described above. 

Any ideas on how to do that?

Thanks,

Ori

I don't think you can do this directly without some kind of trickery. Maybe have a completely separate entity for the arm and just play it on top of the rest of the character?

 

 

On 12/30/2017 at 11:19 AM, Ori Pessach said:

The functionality doesn't seem to be there, which is a shame - it's very useful and there doesn't seem to be a workaround to do what I need to do.

 

 

On 12/31/2017 at 4:07 PM, Ori Pessach said:

Another thing that doesn't seem to be supported (at least with the mecanim addon) is blend trees.

You're right, blend trees are not supported yet + lots of other advanced blending techniques. But feel free to implement them and open a PR and I'll gladly merge it.

Link to comment
Share on other sites

19 hours ago, loodakrawa said:

I don't think you can do this directly without some kind of trickery. Maybe have a completely separate entity for the arm and just play it on top of the rest of the character?

I thought of trying this, but I don't see a way to synchronize the two entities' animations, and keep them synchronized after playing the attack animation. Unity's layers work really well for that.

19 hours ago, loodakrawa said:

You're right, blend trees are not supported yet + lots of other advanced blending techniques. But feel free to implement them and open a PR and I'll gladly merge it.

Sadly, the amount of work needed to support this makes that unfeasible for me at this time. I have a game to finish...

Link to comment
Share on other sites

2 hours ago, Ori Pessach said:

Sadly, the amount of work needed to support this makes that unfeasible for me at this time. I have a game to finish...

Same here. I work on this library between a full-time job and the game I do in my spare time which unfortunately doesn't really leave a lot of time. I plan to rewrite the core of the library and add more advanced features in the future but that will take a while.

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

I could not find any tutorial and/or answer to this in the forum (only a few suggestions that the feature should be there):

Is there a way to explicitly position a bone such as manipulating it before the animation state or directly after? Typical example having a run animation with the weapon arm always targeting the mouse, so the weapon/arm would have to be rotated and positioned after applying the animation state. If this exists, does it also support simple IK so that for example the upper arm does not become disconnected from the weapon?

My target framework is Monogame.

Link to comment
Share on other sites

  • 2 weeks later...
On 1/21/2018 at 8:34 AM, johns1111 said:

Hi,

I could not find any tutorial and/or answer to this in the forum (only a few suggestions that the feature should be there):

Is there a way to explicitly position a bone such as manipulating it before the animation state or directly after? Typical example having a run animation with the weapon arm always targeting the mouse, so the weapon/arm would have to be rotated and positioned after applying the animation state. If this exists, does it also support simple IK so that for example the upper arm does not become disconnected from the weapon?

My target framework is Monogame.

Hi,

At the moment there's no API to do such a thing. I plan to add stuff like this into the new version (one fine day in the future). However, if you end up implementing something like that, please consider submitting a PR - I gladly accept contributions :)

p.s. MonoGame is awesome

Link to comment
Share on other sites

Hi, im new here :P

I have some issues (i use monogame with visual studio 2005)

1.- i Tried to import spriterdotnet.monogame 1.6.1 from nuget but when  it has installed send me some errors with Monogame.framenetwork... the same thing happen with spriterdotnet.monogame.importer 1.6.1... after that i choose the 1.6 version

 

2.- With 1.6 version i follow the example in github but in this part 

SpriterContentLoader loader = new SpriterContentLoader(Content, scmlPath);

loader.Fill(factory);

the loader fill part send me a null error message :(

 

I will be grateful if you can help me :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...