Animations: events or more images?

0 favourites
  • 7 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Wondering what's better for performance.

    I'm starting to work on my animations for my game and since I could not find any info in manual or the forum I thought I ask.

    Currently I have a sprite with event:

    -lerp size,

    -lerp opacity,

    -if size = something -> lerp to different size and opacity

    • and so on..

    It's all good but I start to think, what if there's 100 objects like that. Lerping different values at same time.

    Does using an animations instead of that would be more efficient at runtime?

    In example, rather than

    +Mouse: On left button Clicked on "Sprite"

    • Sprite: Set width to lerp(self.Width,100,5*dt)
    • Sprite: Set opacity to lerp(self.Opacity,0,5*dt)
    • and so on...

    do:

    +Mouse: On left button Clicked on "Sprite"

    • Sprite: Set animation to "On Click"

    I'm aware that changing lerp to animations will increase significantly files size in the project due to adding more images to sprite required for animation. But let's not take memory into account and focus on performace only.

  • Use lerp. Doesn't matter the number of objects. Simulating the effects of lerp in animations would be big and meaningless work, makes no sense at all. If JS can't handle some hundreds of lerp calculations in realtime than we're doomed.

  • Always, always animate objects by moving/rotating/resizing rather than making a sequence of animation frames. Doing it by animation frames will waste tonnes of memory unnecessarily! It's much better to do it by events, and it usually looks smoother too.

  • Thanks guys. Ashley is there a way to check how much memory current game is using?

  • shinkan, there is indeed.

    A helpful 'approx. N mb' is always displayed on the bottom bar.

  • sqiddster yes heh, was thinking more of a video memory at run time :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, whoops :)

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