PaulPlay's Recent Forum Activity

  • Hey, I have always struggled with the fps of my game, so I did a lot of research and looked through many forum posts as well as Ashley's guides (that I can really recommend!) for optimizing your game. I have stumbled across a few "magic settings" you can use to get instantly higher fps, will explain them quickly and show you other ways to improve the performance of your (mobile) game. I managed to get my game from 2.5GB of ram to just 250, as well as getting it from crashing instantly to stable > 60 fps on my older galaxy s8.

    ---

    Project Settings:

    Sampling: Does not make a big performance difference at all.

    GPU Preference: High Performance makes a slight difference, use it instead.

    Downscale quality: for my game, this made quite a big difference, but it really depends on your game, so do proper testing. I recommend putting it on low for you mobile game, if the textures are high resolution.

    Max Spritesheet size: A smaller size is worse for cpu performance, however it really decreases ram usage. The switch from 4096 to 2048 saved a lot of memory for me while only very slightly impacting cpu performance - recommended!

    Fullscreen Quality:

    Basically, due to scaling, setting this to low will make the game a bit more pixelated (which you can't see on my 1440p phone display!) but can make quite a difference regarding performance. Setting it to high will render the game at the screens resolution while low will render it at the set viewport resolution and simply scale it to fix the screen. So depending on whether your game has a higher or lower resolution than your target device, either setting can be beneficial.

    Anti-Aliasing: Makes a bit of a difference when it comes to performance, so for mobile games if your game uses very detailed sprites you might want to turn it off.

    ---

    Ram usage:

    Bigger sprites use way more ram than smaller ones. You might think a 4000x4000 image only uses double the amount of ram as a 2000x2000 one, but actually it uses 4 times that. This is due to the amount of pixels in the 4000x4000 image. Make sure to downscale images to the smallest size that still looks pleasing. For pixel art, this is of course not an issue. For buttons, 250x250 is enough in most cases. Try to downscale all images by alot.

    Spritesheets work in a way, that for example a 400x400 image occupies a 512x512 space and a 600x600 image actually uses a 1024x1024 spritesheet space so make sure they are always under these numbers if possible. For example, a button that is 258x258 needs a 512x512 space, so rather go for 256x256. Compressing images to a smaller size ONLY makes your game smaller, not the ram usage as they are converted into a different format in ram so they can isntantly be displayed when needed.

    You can also use SVG images for static sprites - not moving sprites, cause then this will be very cpu intensive. When you downscale an image in the animation editor, try to use smoothing as it makes edges less rough so the image actually looks smoother and higher resolution.

    In the DEBUG Layout you can see, which layers use the highest amount of ram, so use this for detecting large sprites.

    You might wonder, how much ram these new phones can even handle.

    My S8 struggled a bit with 500mb of ram, while new flagship phones can even handle 1.5GB, however it is really bad for gpu performance so try to minimize ram usage as much as possible. If your game has many scenes, it might be worth it to unload certain sprites out of memory, there is an action under "system" for this.

    CPU Usage:

    This is a bit more interesting. Here, you can use the Debug Layout too to find out which groups use a high amount of cpu, however, make sure to put the frame rate mode to unlimited if testing!

    You might have already heard that for example "every tick" uses a lot of cpu power, so rather go for someting like "if variable<7" etc instead. Also, settting a text to something every tick or very often uses a lot of cpu too.

    You might want to use a sprite font for that. Very handy is "trigger once" for certain actions that only need to be triggered once when a certain condition becomes true. For Triggers (the ones with the green arrow) this is done automatically and they only trigger once. For other actions (for example, "if text="0" " you might want to use "trigger once" instead if the action only needs to activate once the condition becomes true (or becomes true again). Another trick is, to turn of certain groups in your code when you don't need them. For example, if my shop menu isn't opened, I can turn off most of it's code.

    GPU Usage:

    This is pretty straightforward. All effects except of simple color changes etc. consume quite a lot of gpu power. For example the water shader, when applied to bigger sprites, uses a lot of gpu performance. When you use particles, you can test if they are still "on screen", and if not, destroy them, as they still use cpu (?) performance if they are outside of the layout. Using small sprites as described under Ram Usage also helps a lot.

    On static layers you can also activate "render cellls", I did that on my background layer. Do NOT do this on layers with particles or moving objects though, it reduces performance significantly. Adding more layers itself does not decrease performance. Objects that are 0% opacity still use some gpu power, so make sure to destroy them or set them to invisible.

    Final words:

    I hope this short guide was able to help you. Of course, this can't fix messy code or gigantic layouts, but can still improve your fps by a lot. So make sure to optimize your code and keep it as short as possible, also you can try using java script in construct as it also has a better performance that the actions but you should be fine with visual scripting (like I use) too. If you have any other tricks or tips to improve performance, make sure to let me know in the comments!

  • Thank you, does this involve changing the opacity too?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, thats true but I was just wondering how this loading screen could only use 500mb ram. People in another forum (stack overflow) told me that brawlstars is constantly unloading unused images at runtime in the menus and downscaling the images in the engine (so the loading image is downscaled). Also, brawlstars is using svg images for some icons.

    Speaking of svg, I have heard mixed things about them in construct. Some say they are great, others say they are bad for performance. Do you guys have an opinion on that?

  • I apologize if any of my assumptions are completely wrong ;)

    In android you can see in the settings how much ram an app is using, and I am assuming that the cpu just uses the same ram for video memory and normal one. I got the metrics from that, and it displays the amount of ram my construct game uses correctly too.

    I used APKEditor to see what kind of images are inside the game and the loading screen is a png with 4K resolution. I cant tell though if it is being downscaled or something before being displayed.

  • I still wonder how a game like brawlstars with a loading screen image that is 4k and

    many other high res assets can only use 4mb of ram.

  • I would call this a 10/10 solution.

  • Thank you for your detailed answer! I have actully found 2 images hidden somewhere in my project that were actully 4000x4000 and they took up soo much memory! Also, I now destroy all other unused versions of my character (you can choose one in game) at runtime. Also, I will have a look at the Extensions you mentioned.

  • Thank you for the information and fix!

    I‘ve now read through these cordova docs and here are a few interesting things I have come across. Can‘t test them right now but here you go.

    -Autohide Splashscreen hides the splash screen after the time specified in SplashScreenDelay (standard 3000)

    -The spinner and the splashscreen can be deeply customized to make it blene with the project nicely (requires programming skills)

    -On ios, yo cannot set hide splashscreen to true - but you can use the function navigator.splashscreen.hide(); when the deviceready event gets triggered

    -LoadUrlTimeoutValue only closes the webview after some time if it didnt work basically so imo useless in your case

    Btw, I dont really know if I am facing the same issue because for me I can see the construct logo shortly and the android top bar for around 1.5 seconds even tho the loader style is set to nothing + use loader layout and then it switches to fullscreen and displays nothing for some time until my loader layout starts.

    Either way, it looks really weird and I hope this will be fixed or there is a good solution.

  • Hey,

    After optimizing my construct game for 2 weeks, I managed to go from 2GB to 1GB of ram usage by downscaling the ~200 images in total significantly (Not all on one layout). They are now around 500x500, some are a bit bigger.

    Recently, I downloaded a bunch of games and monitored their ram/memory usage and was genuinely surprised by the result.

    Huge mobile games like Asphalt 8 or Brawlstars that are 100mb-2GB in size and display hundreds of images in one scene only take up 10-50mb in Ram.

    Do you guys know how this can be achieved and if that is also possible in Construct?

  • I have got the same issue… Also when loading, the top bar of the phone is still being displayed.

  • Thank you for your answer! I dont need to display them all at once. In one scene there are always around 70 images, which is not that much in my opinion but I got to try making them even smaller and lets see how that goes…

    So if I understand correctly, that is totally normal and there is no other way to make the memory usage smaller apart from making the images smaller.

  • Hey guys,

    My game with around 200 png images that are 70mb in total on my disk consumes over a whopping Gigabyte of video memory…

    Is this normal or did I do something wrong? I tried downscaling the images as much as I could but most of them can‘t be smaller than 500-1000px in width. That helped a bit but it is still way too much.

PaulPlay's avatar

PaulPlay

Member since 22 May, 2021

Twitter
PaulPlay has 2 followers

Trophy Case

  • 3-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • x4
    Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

8/44
How to earn trophies