Idea regarding Small things through which I can boost performance?

0 favourites
  • 7 posts
From the Asset Store
Retro Game
$49 USD
Music Loops will turn your old school 80’s vintage production or idea to life!
  • Hi everyone,

    I am working on a project where I am dealing with 40000 sprites (each approx 20kb in size). Obviously all sprites are not present on screen (zoomed on a particular section hence only approx 100 sprites visible at a time)

    Can you please help me with tips to boost up the performance

    For example :- I have switched off collision for all sprites hence increase in performance is seen

  • There are plenty of tutorials and forum posts about optimizing performance, but with 40k sprites you're going to have to do a lot to keep the game running smooth. Disable any behaviours on objects which don't need them all the time. Creating/destroying puts a fair bit of strain on the CPU, too, so look into object pooling if you're doing that often. Use render cells where possible.

    It's also worth looking into alternative ways of rendering the sprites, like with tiled backgrounds or tilemaps instead of sprites.

    More than anything, make sure that you're testing everything that you do. Set up a benchmark with a target FPS, and make adjustments based on evidence. Every project is unique, so there's no real one-size-fits-all solution.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Honestly, my main goal when optimising a game with 40000 sprites would be trying to think of clever ways to not have 40000 sprites.

    I'm not saying you should delete stuff from your game, but there might be a smarter way to do this. For example, if you've got a giant map with 5000 tree objects on it - do you really need to have all those trees in memory given that you can only see a few of them at once? Maybe you could just have an array that remembers where the trees are, keep a stock of say 100 trees, and then just teleport them into position when necessary. Looks the same to the player, but waaay less stuff sitting around in memory.

    Or: are there any sprites that you don't really need to have in memory? Eg. maybe you have a bunch of invisible spawner objects that populate the map with enemies or whatever. Well, once the spawners have done their job they can be deleted, right? No need for them to be taking up memory any more.

    You can also put objects that don't move a lot (eg scenery items) onto a layer together and enable render cells for that layer. This might improve your performance, but it doesn't always - you should test.

    If you let us know more details about your game, how it looks and how it works, we can make more detailed suggestions for ways you can optimise it :)

  • You can also put objects that don't move a lot (eg scenery items) onto a layer together and enable render cells for that layer. This might improve your performance, but it doesn't always - you should test.

    Ashley will this have any effect on performance?

  • Honestly, my main goal when optimising a game with 40000 sprites would be trying to think of clever ways to not have 40000 sprites.

    I'm not saying you should delete stuff from your game, but there might be a smarter way to do this. For example, if you've got a giant map with 5000 tree objects on it - do you really need to have all those trees in memory given that you can only see a few of them at once? Maybe you could just have an array that remembers where the trees are, keep a stock of say 100 trees, and then just teleport them into position when necessary. Looks the same to the player, but waaay less stuff sitting around in memory.

    Or: are there any sprites that you don't really need to have in memory? Eg. maybe you have a bunch of invisible spawner objects that populate the map with enemies or whatever. Well, once the spawners have done their job they can be deleted, right? No need for them to be taking up memory any more.

    You can also put objects that don't move a lot (eg scenery items) onto a layer together and enable render cells for that layer. This might improve your performance, but it doesn't always - you should test.

    If you let us know more details about your game, how it looks and how it works, we can make more detailed suggestions for ways you can optimise it :)

    Thanks for the advise. All sprites are stationary. When touched they get deleted (that's it)

  • There are plenty of tutorials and forum posts about optimizing performance, but with 40k sprites you're going to have to do a lot to keep the game running smooth. Disable any behaviours on objects which don't need them all the time. Creating/destroying puts a fair bit of strain on the CPU, too, so look into object pooling if you're doing that often. Use render cells where possible.

    It's also worth looking into alternative ways of rendering the sprites, like with tiled backgrounds or tilemaps instead of sprites.

    More than anything, make sure that you're testing everything that you do. Set up a benchmark with a target FPS, and make adjustments based on evidence. Every project is unique, so there's no real one-size-fits-all solution.

    Thanks for the reply. Actually all sprites are distinct hence can only use sprites

  • Ashley will this have any effect on performance?

    Answer your own performance questions with measurements

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