Is it possible to load spine scenes dynamically in gui?

Current layout
I have gui with animals avatars. Right now there are static. So all images are in one atlas file. With more animals it will be several atlas files, but they number will be still limited, maybe 4 atlas files.

Problem
I want to animate avatars and use spine for that. But the problem is that I have so many animals and therefore avatars. It is 110 now and will be more later. And each animal animation is in separate spine scene. Of course I can manually add 110 spines scenes to the gui. But I think that is bad and it will load unnecessary resources, cause on the same time maybe up to 20 avatars are visible. And in some cases only one avatar will be drawn. Also these guis should load “instantly”.

So are they any options to load spine scenes dynamically? Or maybe some approach to limit memory usage.

Hmm, that’s an interesting challenge. If you add all 110 spine scenes to the gui I believe their textures will all be loaded as well, and with 110 of them you’ll probably run out of memory. How big is the atlas for one spine animal?

This is probably easier to solve with game objects and 110 dynamically loaded factories, one per animal (you probably want to write a script to generate these).

Can someone think of another solution?

It really depend on animal itself. With “good” quality it can be up to 1024x1024. With “normal” quality I think it can be up to 512x512.

So the main problem is the texture loading, I presume. Approach with game object for me is not the great idea, because the main gui is pretty much done with all logic.

From the all specs, i think i can drop “instant” load. So it can be placeholder and then replaced with the actual scene, as it loads.

On the side note, can you give me Defold Game Released badge?) :wink:

Yeah, I don’t have a clear idea on how to solve this at the moment. Using multiple GUI components perhaps?

You got it!

1 Like

Thanks.

Another problem that i want to use animate avatars in many different place and guis. So in some places it will very easy to split into several guis, but in other place not so much. I think i will try to experiment a little bit, with how much animals i can show\load at one time. Maybe I will find some solution or restriction to images sizes.

Can you tell me, if using one atlas, let’s say for 2-3 spine scenes will be better than one atlas per animal?

1 Like

I think you will be able to pack more sprites in the atlas this way. I do it all the time.

2 Likes