FreezingMoon / AncientBeast

The Turn Based Strategy Game/eSport. Master your beasts! 🐺
https://AncientBeast.com
GNU Affero General Public License v3.0
1.67k stars 580 forks source link

sprite sheet animation support #1692

Open DreadKnight opened 4 years ago

DreadKnight commented 4 years ago

The modular unit abilities classes should be extend to properly support animation sprite sheets which will be rendered in blender and assembled using https://github.com/FreezingMoon/Spritify Will need to store the animation info in different files: assets/units/animations/unit_name.json.

andretchen0 commented 1 year ago

Using sprite atlases would probably cut down page load times quite a bit.

I checkout out Spritify, linked above. There's the Sharp library on npm that doesn't require ImageMagick to be installed on the user's system.

I've got a simple sprite atlas creator that uses Sharp. It's really simple though. It only makes a single "page" of images and doesn't care much about efficiency. (I was just making pixel art games and everything easily fit in a single 1024x1024 image, so I didn't bother improving the packing or implementing multiple pages.)

With an extra script, we could have multiple "pages" – but I don't know if it's worth implementing for the current version of AB.

Fwiw, I've already put it into the Vue/Three.js version I've been working on. Here's the current sprite sheet.

atlas

DreadKnight commented 1 year ago

Using sprite atlases would probably cut down page load times quite a bit.

I checkout out Spritify, linked above. There's the Sharp library on npm that doesn't require ImageMagick to be installed on the user's system.

I've got a simple sprite atlas creator that uses Sharp. It's really simple though. It only makes a single "page" of images and doesn't care much about efficiency. (I was just making pixel art games and everything easily fit in a single 1024x1024 image, so I didn't bother improving the packing or implementing multiple pages.)

With an extra script, we could have multiple "pages" – but I don't know if it's worth implementing for the current version of AB.

Fwiw, I've already put it into the Vue/Three.js version I've been working on. Here's the current sprite sheet.

atlas

Nice, wasn't aware of Sharp, could come in handy. The sprite sheets are important when we'll have unit animations, hence why later in the milestone. For now we could use it for unit sets avatars, like in unit grid and queue, #1736 Pagination will be good, as there are plans for 2 more unit sets; Dark Priest could be skipped to stick with power of 2.

I'll update #198 in a bit to be about Phaser, but same idea, that way we'll reduce 1-3 Dark Priest sprites. And in v0.6 we can migrate to Phaser v3 #1584 so that we can implement #678 and make the game be lightweight initially & load fast.

DreadKnight commented 12 months ago

Death animations should deprecate #2520 if accepted.