We develop the game (c++/cocos2d-x) where the character appearance can be customized.
For example when the user makes some changes in hero's inventory the following parts will be changed in real time: helmet, gloves, boots, armour, weapon, cloak. We have huge amount (hundreds) of assets for each part.
Moreover the player can see several characters of another players at the same time. So we expect that in a certain moment there are multiple fully customized characters at the scene.
How we do that.
1. We have character animated in Spine. The default equipment (armour, weapon etc.) is used in project. No skins are used.
2. We have a lot of assets of every equipment part. The assets for equipment of the same type have equal frame sizes. For example all hats are stored in a separate .png with the equal sizes.
3. We export the project and get atlas file (.atlas) and texture (.png). We DO NOT use this texture because it contains default equipment.
4. In runtime we use the atlas from the previous step as layout source to generate personal texture for each character depending on it's current equipment.
5. In runtime we create a custom skin that contains attachments pointing to the texture created dynamically in a previous step. And we assign this skin to the skeleton.
The problem is that we can not use single instance of
SkeletonDatathat is shared for all skeletons.
DeformTimelinesthat keep pointers to the attachments that they must be applied to. These pointers are assigned during the loading of the skeleton data from binary (or json) and there is not way to change them in runtime.
As I know the official solution is to create custom attachment loader. But this will not solve the problem. We will still have to create multiple skeleton data instances - one instance for each character.
Is there any way to solve this problem without runtime to be patched?