How do I use sprite fonts with containers?

0 favourites
  • 4 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • I'm trying to convert from Texts to Sprite Fonts for performance reasons, and I'm a bit stuck on the differences in how they behave.

    I have a card Sprite, which had seven Texts associated with it (name, stats, etc). I had all of these in a container so that I could easily manage them as a unit.

    However, when using a Sprite Font, the entire font texture appears to be loaded for every individual object. So if I have seven different Sprite Fonts in the container, that's seven copies of the font texture taking up resources. Which is no good.

    The seemingly obvious answer would be to use multiple instances of a single Sprite Font object. But I can't figure out how to make that work properly with containers. If I only have the one Sprite Font object in the container, how will it know which seven instances in particular to select/destroy in association with the rest of the container?

    Thanks!

  • You could link them manually, using instance UID, and abandon containers. Although the manageability would suffer a bit, you wouldn't have to worry about that duplicate texture problem.

  • You could link them manually, using instance UID, and abandon containers. Although the manageability would suffer a bit, you wouldn't have to worry about that duplicate texture problem.

    Thanks for the tip! I thought about trying that, but in this case manageability would suffer quite a lot. There's a whole lot of manipulation of these cards, and the container aspect is used heavily throughout them. The total number of sprites is actually pretty low, so I think I'd rather take a hit on redundant textures than lose container functionality.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • OK, after talking with the powers that be, it turns out that C2 is smart enough to automatically detect redundant textures and only load them once.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)