bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.25k stars 3.58k forks source link

2D Skeletal Animation #5280

Open maxtongwang opened 2 years ago

maxtongwang commented 2 years ago

What problem does this solve or what need does it fill?

For 2D games that want to have configurable characters with body parts, it's extremely verbose to create animation assets. Using sprite sheet animation only, the application suffers from art workflow, sheer raw amount of animation atlas, fragile parsing mechanism, and some runtime dynamic atlas building.

This is one evaluation point for choosing Bevy for our product's production use.

What solution would you like?

A 2D skeletal animation system where body parts are designed to be attached to certain bones. This will leads to a simpler art workflow, skeletal animation to replace sprite sheets, and no more fragile parsing.

Performance impact on this could be more significant than sprite sheet animation. A good benchmark example of such feature would be nice to have, so that it's up to the dev team to decide whether to use this feature.

The solution you propose for the problem presented.

What alternative(s) have you considered?

Spine is a good solution out there, but Rust is lacking up to date spine runtime library.

arnavc52 commented 2 years ago

Spine is a good solution out there, but Rust is lacking up to date spine runtime library.

Spine appears to be proprietary, so we can't integrate it into Bevy (even if it had a Rust runtime), since Bevy is open-source.

arnavc52 commented 2 years ago

Also, using Bevy for a production game is probably a bad idea. But you can make it a slightly less bad idea by contributing!

maxtongwang commented 2 years ago

@x-52 this is a feature request I was encourage to put on here in one of the production use evaluation thread with @aevyrie and @superdump

Understood that Spine wouldn't/couldn't be integrated into bevy. It's simply an example to fill in alternatives that was explored to demonstrate the idea .

arnavc52 commented 2 years ago

Bevy already supports 3D skeletal animation. A 2D skeletal animation system would probably reuse much of the same code, but only allow movement on the X and Y axes. There are two ways to go about this:

  1. Create a Keyframes2D enum
  2. Add 2D-specifc variants to the existing Keyframes enum

Either way, the variants of the enum will simply use Vec2 instead of Vec3 (for Translation and Scale), while Rotations would simply be Euler rotations on the Z axis.

yumaohua commented 8 months ago

To achieve stunning procedural animations like Rain World, a good 2D skeletal animation system is necessary