How do I make my game run faster after adding 3000 objects?

0 favourites
  • 8 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I add way too many objects to my game and it runs very slow in fullscreen was wondering is there a way to make it run faster and make it easier to handle the reason why it has this many objects is because the player moves so fast that they made to end of the level in 1 min so I had to make a bigger level so there more enemies more art and longer level design with more platforming ideas but now my game can't handle it very well what should I do?

  • There are many things that could be causing performance issues. Having 3000 objects is probably not one of them. Test yourself - downloads.scirra.com/labs/piggyperf

    Are your sprite resolutions reasonable for your target resolution? Try turning fullscreen quality to low and seeing if that makes a difference.

  • There are many things you can try:

    1- Do not create all 3000 objects at once. Only create the objects you need and are visible on screen.

    2- If you can disable off-screen objects, that would reduce performance usage.

    3- Reduce the resolution of the sprite images of these objects.

    4- Avoid using Loops and Every Tick events. It is a good practice to run the code only when needed, instead of Every Tick (whenever possible).

    5- Use object pooling techniques (i.e. instead of creating a new object, you can reuse existing old objects).

    6- Reduce repetitive and redundant tasks. For example, if a variable is common for the 3000 objects, then you can calculate it once, instead of 3000 times.

    I hope this gives you a useful insight about optimizing your game. If you could share some screenshots of your game layout/code, we might be able to help you better.

    Good luck!

  • There are many things you can try:

    1- Do not create all 3000 objects at once. Only create the objects you need and are visible on screen.

    2- If you can disable off-screen objects, that would reduce performance usage.

    3- Reduce the resolution of the sprite images of these objects.

    4- Avoid using Loops and Every Tick events. It is a good practice to run the code only when needed, instead of Every Tick (whenever possible).

    5- Use object pooling techniques (i.e. instead of creating a new object, you can reuse existing old objects).

    6- Reduce repetitive and redundant tasks. For example, if a variable is common for the 3000 objects, then you can calculate it once, instead of 3000 times.

    I hope this gives you a useful insight about optimizing your game. If you could share some screenshots of your game layout/code, we might be able to help you better.

    Good luck!

    I have 31 every tick events and turning them off did not do anything i did change the fullscreen mode from high to low it works but it's something i don't want to use because you can't see the character and background art and objects you can interact with i am now going to try the other tips you are giving and trying to figure out on how to do them

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • found the problem it was the effects on the main character that was slowing it down too bad I can't use the effect made it look really cool

  • found the problem it was the effects on the main character that was slowing it down too bad I can't use the effect made it look really cool

    C3 added a new effect engine that was supposed to be much faster.

    Do you mind sharing what type of effects you had to cause such performance drop?

  • sure this is what I was using i had 2 of the same type of object to spawn different colors of this object i made it spawn these every time the player move for every 0.010 seconds to give it a retrowave mix with neon style when you move witch made it look like this i had a brightness at 150% glowhorizontal 100% glow vertical 100% and a tint and they were in a family effect

  • sure this is what I was using i had 2 of the same type of object to spawn different colors of this object i made it spawn these every time the player move for every 0.010 seconds to give it a retrowave mix with neon style when you move witch made it look like this i had a brightness at 150% glowhorizontal 100% glow vertical 100% and a tint and they were in a family effect

    It is a cool effect indeed!

    spawning 2 objects every 0.010 is very demanding I would say. It is almost similar to Every Tick. That's equal to 200 objects per second!!

    If you want to use the same effect, you will have to reduce the number of objects by increasing the time. So instead of 0.01, try using 0.1 or more.

    You can also use object pooling:

    1- during game loading, generate 1000 objects.

    2- when you need to run the effect, instead of "creating" objects, you can reuse the already created objects from step 1.

    3- every 0.01 second, pick a random object from step 1, and place it behind the player and enable the effect.

    4- when the effect is over, hide the objects (e.g. move them away to -1000,-1000 or something).

    Notice that this solution creates objects only once (when loading), instead of every 0.01 second.

    The reason why this is faster is because "Creating" an object is much more performance demanding than "Moving" and object. So moving 200 objects every 0.01 second is much faster than creating 200 objects every 0.01.

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