A small (but bad) performance problem

  • Hello everyone.

    I'm working on a game and we have a lot of animations for characters so as you can guess we got some performance problems. As a solution I decided to create more than one sprite for my character and then set one or two animations to each sprite and create each sprite when needed (and destroy others as well). Now the problem is when a sprite is gonna be created - for the first time - there's a little lag, but as I said it happens only on the first time for each sprite.

    Any solution?

  • Put all these sprites on the layout, and destroy them on start of the layout. They will be loaded into memory, and there will be no lag when you create them in runtime. (But there will be a bigger delay when the layout is loaded)

  • Put all these sprites on the layout, and destroy them on start of the layout. They will be loaded into memory, and there will be no lag when you create them in runtime. (But there will be a bigger delay when the layout is loaded)

    Thanks for your answer!

    If I do so, ram usage at the start of the game (in export file) will be about 10 gbs! Out problem mainly is ram usage at the start.

  • You certainly use Construct 3?

    You could make a new layout, call it "assets". Before you load your actual level, you can have it preloaded via Construct 3. I hope you understand roughly what I mean. This would make sure that your sprites are not always created from scratch after you have created them.

  • You certainly use Construct 3?

    You could make a new layout, call it "assets". Before you load your actual level, you can have it preloaded via Construct 3. I hope you understand roughly what I mean. This would make sure that your sprites are not always created from scratch after you have created them.

    Tnx!

    No actually I'm using c2 for this project...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I do so, ram usage at the start of the game (in export file) will be about 10 gbs! Out problem mainly is ram usage at the start.

    This is a sign of extremely inefficient game design. See the (old but still relevant) blog post Remember not to waste your memory.

    FWIW Construct 3 does provide more control over memory management. Also the small lag is because it's having to load images for the object on-the-spot. Construct 3 also does that asynchronously (in parallel with the game) which fixes the lag (although instead the object is momentarily invisible while its images load). The new C3 runtime is also much faster.

  • 10 Gb is insane! I don't think that fiddling with sprites (loading/unloading them) will make much difference.

    You definitely need to rethink how you manage animations in your game - significantly reduce their size, use fewer frames, break into modular sprites (see Spriter), use effects instead etc.

  • 10 Gb is insane! I don't think that fiddling with sprites (loading/unloading them) will make much difference.

    You definitely need to rethink how you manage animations in your game - significantly reduce their size, use fewer frames, break into modular sprites (see Spriter), use effects instead etc.

    I did some tests and it worked fine... And yes the problem mainly is about resolution of frames, I tried reducing them to 50%, it kinda ruined the visual quality. I'm thinking about considering this at the last solution.

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