Tilengine - The 2D retro graphics engine forum
Release 2.8.0 - revamped animation engine - Printable Version

+- Tilengine - The 2D retro graphics engine forum (http://tilengine.org/forum)
+-- Forum: Tabloid (http://tilengine.org/forum/forumdisplay.php?fid=4)
+--- Forum: News & Announcements (http://tilengine.org/forum/forumdisplay.php?fid=6)
+--- Thread: Release 2.8.0 - revamped animation engine (/showthread.php?tid=573)

Pages: 1 2


Release 2.8.0 - revamped animation engine - megamarc - 05-03-2020

This release doesn't introduce new features, but enhances existing ones.

Revamped animation engine

Prior to this release, animation engine was a globally slotted one, in the same way as sprites or layers. Each animation of any kind required a slot that had to be managed. That was tricky with tileset animations, where slots had to be allocated beforehand without having knowledge of how many slots was going to need. This was cumbersome to say the least.

No more.

Sprite and tileset animations are self sustained: they don't use slots anymore, using them is straightforward:
  • Tileset animations are started automatically when setting up a layer that has animated tileset
  • Sprite animation just require the index of sprite to animate.
  • Tilemap animations were a legacy feature don't used anywhere, removed
  • Slotted animations are now only used by palette animations (color cycles).
This of course has some minor breaking API changes to the animation system:
  • Removed `TLN_SetTilesetAnimation()` and `TLN_SetTilemapAnimation()`.
  • Removed parameter "index" from `TLN_SetSpriteAnimation()`, requires only sprite number.
  • Replaces `TLN_DisableAnimation()` with `TLN_DisablePaletteAnimation()` and `TLN_DisableSpriteAnimation()`
Improved sequence support

Now it's possible to have a tileset animation where one of the frames can be the same as the tile being animated, it's usual to do this way by map creators. You can now do this:

Code:
47 <- [47, 49, 50, 53]

In this example, tile 47 is both the tile being animated, and one of the frames of the animation.

Enhanced asset packer support

Previous version of asset packager format had a flaw where improbable -but possible- hash collisions weren't handled properly. That could lead to loading a different asset than intended. ResourcePacker has been updated without this flaw, and its loader is now integrated in this release. I also allows unlimited password length. Upgraded packer can be downloaded at itch.io: https://megamarc.itch.io/resourcepacker

Enhanced .tmx loader

It now supports up to 64 layers per .tmx file, and tilesets are cached. If multiple layers use the same tileset, only one copy of the tileset is loaded and animated, shared between all the tilemaps using it.

Updated examples

All examples are updated to be compliant with the new API changes. In addition "forest" sample now accepts optional command-line parameters to load assets from password-encrypted asset pack. For example:

Code:
forest assets.dat my_password

Starts forest example with assets being stored inside "assets.dat" encrypted with password "my_password"


RE: Release 2.8.0 - revamped animation engine - RootBeerKing - 05-03-2020

Very nice update! This is a very good quality of life change. Can’t wait to play around with it.

So if I understand correctly, can we now use one tmx file for multiple layers; instead of having to use multiple tmx files for each layer, like in previous versions?


RE: Release 2.8.0 - revamped animation engine - megamarc - 05-04-2020

Thanks for your feedback!

Previous versios could already load different layers (tilemaps) from a single .tmx file. But now it can load even more layers, and it has better handling of shared tilesets used in more than one layer. As always, you need a call to TLN_LoadTilemap() for each unique layer, passing the name of the layer to load on each call, albeit they're all on the same .tmx file.

TLN_LoadTilemap()


RE: Release 2.8.0 - revamped animation engine - Uneven_Prankster - 05-04-2020

Very smart to have it keep track of you having already loaded a tileset from the map Biggrin Should reduce load on the program.


RE: Release 2.8.0 - revamped animation engine - megamarc - 05-04-2020

Thanks  Smile  it is specially important with the animation engine, that was starting multiple instances of the same tileset animation (one per copy), colliding between them and not showing expected animation. Having just a single instance of the shared tileset makes animation straightforward.

I've discovered all this because a game developer sent me a test trying to load a .tmx he's working on, and release 2.7.0 had problems with it. It contains 37 layers with different sprite priority (3/4 pseudo 3D perspective), and shared animated tilesets. I can't publish its work here, but this is its itch.io page:
https://ioribranford.itch.io/demonizer

This complex map have helped me to improve this kind of setups


Release 2.8.1 - tileset animation bugfix - megamarc - 05-09-2020

I've pushed release 2.8.1 to GitHub, there's a bug introduced in new animation system in 2.8.0 that makes tileset animations not play correctly on other layers than 0.


RE: Release 2.8.0 - revamped animation engine - megamarc - 05-09-2020

Updated again to release 2.8.2: Enhanced TMX compatibility
  • handles visible property on layers and objects
  • correctly loads Rectangle objects in addition to "Tile" ones
  • TLN_ObjectInfo returns standard TMX properties: name, type (integer) and visible



RE: Release 2.8.0 - revamped animation engine - megamarc - 05-13-2020

Release 2.8.4 with following improvements:
  • Deprecates old TLN_SetLayer() that required passing a NULL tileset, and replaces with new TLN_SetLayerTilemap() that just requires the tilemap
  • TLN_SetLoadPath() not needed anymore: chain loading of resources being loaded from subdirectories (.tmx -> .tsx -> png)
  • TLN_DrawFrame(): frame parameter can be always 0, in that case it auto-increments internally. Application doesn't need to keep track of frames just to make the animation engine work.
  • Updates many samples to use current features, making them easier to follow
So this now works:


Code:
TLN_Tilemap tilemap = TLN_LoadTilemap("path/to/asset/tilemap.tmx", "layer");
TLN_SetLayerTilemap(0, tilemap);



RE: Release 2.8.0 - revamped animation engine - RootBeerKing - 08-07-2020

I’ve been thinking about tilengine again(as I often do), and I was reading through the updated docs and I was getting really excited to use Tilengine again, after a little break to learn more about C, it was nice to come back to the updated documentation, it’s very much appreciated, and I look forward to more updates in the future, especially regarding guides for color cycling and raster effects.

I was wondering if I might request a feature for tilengine? I’d really appreciate more ways of loading palettes, currently you can only load act files, and that’s great and all if you work in photoshop, but the pixel art program I use exclusively, does not output that file type for palettes... It would be nice if Tilengine could load palettes from a simple png image, or a .pal file instead of just act files.


RE: Release 2.8.0 - revamped animation engine - megamarc - 08-08-2020

Hi!
Nice to hear from you again, I'm glad you like the news about tilengine. I'm still working on the documentation, at my own pace Tongue 

About features you request: of course, they're possible to implement without much effort. Microsoft .pal format is documented and I've worked with it in the past. And loading palettes from png's is also possible, but how common is this? Using png as a palette container, I mean. Which software are you using for asset editing?

As a tempral workaround, you can load palettes from png this way:

Code:
TLN_Bitmap bitmap = TLN_LoadBitmap("bitmap.png");
TLN_Palette palette = TLN_ClonePalette(TLN_GetBitmapPalette(bitmap));
TLN_DeleteBitmap(bitmap);