Sprite Factory - an open source sprite animation editor

Sprite Factory

An open source sprite sheet animation editor.

What does it do?

I made Sprite Factory to solve a very specific problem. Sometimes you find awesome art on the internet and you want to animate it for your game.

Adventurer
credit: Eltan

You could always hand roll the animations in code but that can get tedious pretty quickly. Especially if you’ve got a lot of content to animate.

Or you could download Sprite Factory and spend a few minutes creating the animations and saving them as JSON files.

{
  "textureAtlas": {
    "texture": "adventurer.png",
    "regionWidth": 32,
    "regionHeight": 32
  },
  "cycles": {
    "idle": {
      "frames": [0,1,2,3,4,5,6,7,8,9,10,11,12],
      "isLooping": true
    },
    "walk": {
      "frames": [13,14,15,16,17,18,19,20],
      "isLooping": false
    }
  }
}

Then you can load them into your game** and get on with game development.

var spriteSheet = Content.Load<SpriteSheet>("Animations/adventurer.sf", new JsonContentLoader());
var sprite = new AnimatedSprite(spriteSheet);
sprite.Play("idle");

** The loading code above currently works in the develop branch of MonoGame.Extended

Wait, it’s really open source and free?

There aren’t many open source editor type tools around that use MonoGame under the hood. I thought it might be nice to have this as an example of what can be done. It’s my hope that having the code open will inspire others to create more tools.

I have a few other ideas for tools in the works. If you like what I’m doing check out my patreon page for some other awesome things.

What’s left to do?

The main problem with the tool right now is actually loading the files into MonoGame. I’ve written a basic loader in the develop branch of MonoGame.Extended but I’ve been struggling to get it working with the MonoGame Content Pipeline. I would love some help with this.

Right now the tool only works with this one specific type of sprite sheet layout. There’s plenty of room for improvement to add more features to the tool for sprite sheets that are packed differently, or even add a texture packer to the tool itself.

Where do I get it?

You can either:

7 Likes

The main problem with the tool right now is actually loading the files into MonoGame. I’ve written a basic loader in the develop branch of MonoGame.Extended but I’ve been struggling to get it working
with the MonoGame Content Pipeline. I would love some help with this

Getting it working with the MonoGame Content Pipeline, are you specifically wanting help getting it to work in relation to MonoGame.Extended or something more vanilla MonoGame?

(also, been following your progress on twitter with this, and absolutely love the idea)

1 Like

Ideally I would like anyone to be able to import the files regardless of what game framework they choose to use. Funnily enough I’ve already had someone tell me they might write an importer for Phaser 3 which would be cool.

Of course, even if the MonoGame importer is separated from Extended then there’s still the matter of how to actually animate the sprites. I’ve already got sprite animations working in Extended so having an importer in Extended is a natural extension :wink:

That said, maybe the solution is to try and have the best of both worlds. The importer and animation code could live in the Sprite Factory repository and get used in Extended as a NuGet package or git submodule perhaps.

Thoughts?

I think having something that’s the best of both worlds would be the better approach. Sprite Factory stands alone by itself, not necessarily tied to MonoGame.Extended or even MonoGame in general. I would just ensure that the exported JSON is documented well enough, and has enough properties, that it’s easily digestible into whatever framework/engine a user chooses. Then having an importer written for MonoGame.Extended would be just one example of how to use the tool.

With someone writing an importer for Phaser 3, that’s another environment that would support the tool, and for something more vanilla MonoGame, I wouldn’t mind putting something together for that. When i wrote the importer for Aseprite animations, I tried to keep it generic enough that I could work easily into any Monogame project and could piggy back off that for this importer.

1 Like

Yep. That’s pretty much exactly what I had in mind.

In terms of the JSON format, right now it’s quite simple but as Sprite Factory evolves I’m going to need to think about how to version the file format and supporting old versions.