Regarding Graphics and Performance?

0 favourites
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hello ^^

    Just some questions.

    1)Does adding more objects to a layout reduce the performance of a game?

    2)Does the speed you get during the runtime of your game in a browser, reflect how fast it's going to be when it's exported?

    3)Are there any factors that might be causing my game to slow down?

  • Hopefully this covers all your questions: https://www.scirra.com/manual/134/performance-tips

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My brief experience with C2 has led me to deduce that the biggest resource hog are often the collisions. I've found you can drastically improve performance by:

    Playing with the collision boundaries in the image editor until they are as small as you can get away with to function correctly.

    A 32px square with collisions set to bounding box causes much more stress on the fps rate than the same square with the collision boundary set to (1,1),(31,1),(1,31)(31,31).

    Try rotating a square 45 degrees if it doesn't affect the objects interaction it can reduce collisions.

    Turn off collisions on objects that don't need them.

    Make sure all objects that can collide are on the same layer.

    In layout view check the View tab/show collision polys option to see how the objects interact and overlap at rest. Look especially for overlaps and ways of minimizing them

    Don't use complex collision polys if a pinned rectangle will suffice.

    Check your code for extraneous collision checks.

    Use your debugger all the time and the built in profile tab which tells you pretty well where your resources are being used because we've assumed the code isn't leaky, it might well be and the debugger/profile tab will help you nail it.

  • Ashley

    Thank you very much, It answers most of my queries ^^. Thank you,

  • bertie Booster

    Yes, I have somewhat noticed that happening. That and my computer isn't what you call an exactly high performance one ^^. I might need to go ahead and try optimizing my project, thank you very much for the note.

  • bertie Booster

    Thanks for all of those! Curious about a couple:

    A 32px square with collisions set to bounding box causes much more stress on the fps rate than the same square with the collision boundary set to (1,1),(31,1),(1,31)(31,31).

    ???

    Try rotating a square 45 degrees if it doesn't affect the objects interaction it can reduce collisions.

    Why would this be? Maybe because there are generally more vert/horz surfaces than diagonal, and rotating the square means you touch most objects with just the tip of your col poly?

    Collisions really do eat up a lot of cpu. Col cells really help, but if you have a lot of moving objects in a small space, it can still get very laggy, very quick. However, with some thought, there are usually optimizations that can be done (many involving checking cols less often).

  • Remember to delete objects who left the layout, otherwise you have a growing number of collision checkers!

  • iceFlashEX1

    To answer your second question:

    Debug is always a little slower than normal preview. Generally, it's a small difference though. Your finished project will be a little faster still, if the java minifier is working.

    Much depends on whether your cpu usage is going towards graphics or event logic. Event logic will run a bit faster, but you won't notice if it's only a small percentage of your cpu usage.

  • Hopefully this covers all your questions: https://www.scirra.com/manual/134/performance-tips

    I think the claim on that page that layers have little effect on performance is wrong. I had nearly 20 layers doing pretty much nothing except hold static sprites. The game at this point had no ticks whatsoever. I was getting 35-40fps. I moved all my images onto 2 layers and the FPS went up to 60fps. This was the only change I made. There were no moving sprites and no ticks. The game at that point was just sitting waiting for keyboard input.

  • Also, be aware that laptops can present a problem if you're using WebGL in any way on those layers. I had a game I made in C2 where the game ran really slowly at random points and I couldn't work out why.

    Turns out that when the game was running slowly my laptop was running off the battery. When that happens, many laptops disable the 'higher level' graphics chips to save power. This is worth keeping in mind both for debugging and for when considering distribution.

    Is there a way to get round that, now that I think about it?

  • bertie Booster

    Thanks for all of those! Curious about a couple:

    > A 32px square with collisions set to bounding box causes much more stress on the fps rate than the same square with the collision boundary set to (1,1),(31,1),(1,31)(31,31).

    ???

    > Try rotating a square 45 degrees if it doesn't affect the objects interaction it can reduce collisions.

    Why would this be? Maybe because there are generally more vert/horz surfaces than diagonal, and rotating the square means you touch most objects with just the tip of your col poly?

    Collisions really do eat up a lot of cpu. Col cells really help, but if you have a lot of moving objects in a small space, it can still get very laggy, very quick. However, with some thought, there are usually optimizations that can be done (many involving checking cols less often).

    Ah this wont always be the case, but in certain types of games such as grid based games, bringing the coll polys in from the edge has the effect of stopping them from colliding with adjacent cells.

    Again rotating 45 deg wont always work but it can reduce the contact points/area of contact on a face which can help reduce collision count.

    I'm advocating being creative and spending time playing with the coll polys to see if you can optimise, the results can be dramatic.

  • Also, be aware that laptops can present a problem if you're using WebGL in any way on those layers. I had a game I made in C2 where the game ran really slowly at random points and I couldn't work out why.

    Turns out that when the game was running slowly my laptop was running off the battery. When that happens, many laptops disable the 'higher level' graphics chips to save power. This is worth keeping in mind both for debugging and for when considering distribution.

    Is there a way to get round that, now that I think about it?

    yes, in your energy power savings / performance, set it to maximum performance.

    It will cause your laptop to runn full power regardless of batteries or net power.

  • bertie Booster

    Sorry but how can i do this:

    "Turn off collisions on objects that don't need them"

  • Click on a sprite and in properties there's an attribute "Collision". Set it to disabled.

  • Thank's Rabenmutter

    Ashley

    Is this true :

    "Turn off collisions on objects that don't need them"

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