Praytic / youtd2

Classic community-driven session-based Tower Defense game with RPG elements.
https://youtd2.com/
MIT License
87 stars 15 forks source link

Pack creep sprite sheets tighter #285

Closed Kvel2D closed 5 months ago

Kvel2D commented 9 months ago

To reduce size on disk and VRAM usage.

Current packing method makes a grid of sprites with the size of the biggest sprite. I originally made it this way because I assumed that sprite centers had to be the same for sprites in the same animation.

It should be okay to pack tighter if we save the offset between original sprite center and packed sprite center, for each individual sprite. Then load those offsets during runtime and apply offsets in a function connected to AnimatedSprite2D's frame_changed() signal.

Since tigther packing will not be grid-based, scripts will also need to generate/consume information about where each spritesheet is located in the spritesheet.

Scripts/PackSpriteSheet.gd generates packed spritesheets and metadata. Scenes/CreepSprite.gd consumes packed spritesheets and metadata.

Kvel2D commented 5 months ago

Moved to Backlog https://github.com/Praytic/youtd2/discussions/407