Rigby2D: a free, open-source 2D skeletal animation editor, now with a native Defold runtime

Hi everyone! First post here :waving_hand:

I’m Jaisurya, and I make Rigby2D, a free and open-source 2D skeletal animation editor (MIT or Apache-2.0). Today’s release adds a full runtime for Defold.

What it is

The runtime is a native extension: the Rigby2D runtime written in C++, which your build server compiles for Windows, macOS, Linux, Android, iOS and HTML5. It plays everything the editor makes:

  • meshes and weights, IK, transform / path / physics / slider constraints
  • skins, clipping, two-color tint, blend modes, events
  • layered tracks with crossfades and queued animations
  • whole scenes: a stage with several characters, a camera and parallax

It matches the editor frame by frame: CI replays the reference runtime’s output against the C++ one on every commit (bone matrices, vertices, colors, draw order, events).

Install

Add this to game.project ▸ Dependencies and fetch libraries:

https://github.com/jaisurya-dev-art/rigby2d/releases/latest/download/rigby2d-defold.zip

Then, on a game object with a factory for /rigby2d/piece.go:

local rigby2d = require("rigby2d.rigby2d")

function init(self)
    self.hero = rigby2d.new({ skeleton = "/assets/hero.skel", atlas = "/assets/hero.atlas", animation = "idle" })
    self.hero:on_event(function(e) print(e.name) end)
end

function update(self, dt)
    self.hero:update(dt)
end

Scenes work the same way with rigby2d.new_scene({ scene = "/assets/intro/intro.scene.json" }).

Performance

The C++ code writes each frame’s triangles straight into the mesh components’ vertex buffers: no per-vertex work in Lua and no allocation in steady playback. NILA, our demo character (39 bones, 890 mesh vertices, hair physics), poses in about 12 µs.

Sprite sheets too

If you’d rather play frames, the editor can export a sprite sheet straight to a Defold atlas with one animation per animation.

Links

It’s brand new, so feedback, bug reports and “this broke in my project” are all very welcome. Thanks for making such a nice engine to build for!

11 Likes

The Dependency URL will be published with 0.5 Update, coming this Friday November 6.

Until then you can copy the runtimes/defold/rigby2d folder from GitHub. If you try it, I’d love to hear how it goes :folded_hands:

3 Likes

0.5 is out! The Defold runtime is now part of an official release, so the dependency URL in the first post works:

github.com/jaisurya-dev-art/rigby2d/releases/latest/download/rigby2d-defold.zip

If you tried it before today and got a 404, sorry about that: the zip only went up with this release. It’s there now, along with a ready-to-run demo project (rigby2d-defold-demo-0.5.0.zip, on the GitHub releases page).

Also in 0.5: sprite sheet export straight to a Defold atlas, SVG import, and one-click meshes from any image.

Thanks to everyone who’s had a look so far. Bug reports and API feedback are very welcome!

I plan to incorporate this into my MetroidVania Toolkit (and possibly the microvania toolkit as well).

One thing when I asked claude about Rigby2d…

*You can’t see the art in the Defold editor. Spine has a component (.spinemodel) you add to a .go and see in the editor. Rigby2D’s Defold runtime has no component: a script calls rigby2d.new{skeleton=…, atlas=…} and the art is drawn into mesh objects spawned from a factory. The character would be invisible until you run the game.
*
Is this accurate? So you never see the character until runtime? Do you plan to add a component so we can see the character in the defold editor?

Hi! Thanks for checking out Rigby2D and for the great question.

Claude’s description is totally accurate here. Because Rigby2D handles rendering through script calls and spawned mesh objects at runtime, the character won’t show up directly inside the Defold editor viewport yet.

It is scheduled for 0.5.1, expect it by next week.

It is awesome to hear you are planning to use it in your MetroidVania Toolkit. Let me know if you run into any feedback or ideas while testing it out

1 Like

Thankyou! Appreciate the kind words, hope you enjoy trying it out.