I am completely new in game developing and even more new in the use of Libgdx. So far I have successfully done great thing on my game project thanks to all the advices I could have gathered on this forum. I would need your brilliant help once again.
I have several TiledMaps and on each one of them, there is an object layer named “trigger”. This layer contains objects with name corresponding to an animation in my code. All the animations of this layer are loaded thanks to TextureRegion.split.
When I load a new map or for instance a new floor in a house, the time spent to preload the animations of this new floor is too high. Here are the tests of the time spent to load 3 animations of 4 frames each and dimension 64x64 pixels (corresponding to 16 tiles):
- 0.7 sec on a Samsung Galaxy S6 (this is far too much for a powerful device and only 3 animations).
- 1.1 secs on a 4 years old Samsung Galaxy Note2.
- 2.2 secs on a 4 years old Sony Xperia M (pretty old and powerless though).
- Possible solutions:
1) Preload all the animations of the game in the OnCreate and loading screen:
Far from being a good idea with my current game architecture. I expect having 300+ animations (with the fighting ones, cutscenes…). With above tests, it would take 3+ minutes on a powerful device as the Samsung Galaxy S6 for instance.
2) Preload new map animations in another Thread when the user is approaching a teleport trigger:
It will be a good idea on device with good double core CPU but I am afraid of a big FPS drop on single core device or not good double core CPU (like double 600Mhz ones).
3) Label a group of animations with a level-flag and preload them only if level flag changes:
For instance: Level1 flag for 2 exteriors which contains 10 interiors (houses for example)
Level2 flag for 1 exterior and 6 interiors.
On that example, it will just require to preload and having a loading screen when we change of level but with the current architecture of my game code, it will still be a lot of time consuming.
If there is 20 animations and 20 fights animation per level it will be still 40 animations which represent about 7-9 sec on Samsung Galaxy S6 without including sounds loading…
4) Refactor all my code and include logic I was not aware of.
I think it is the best option here. I heard of AsseManager for instance but I have no idea how it is working with Animation object.
Thank you all for your help in advance!