Jump to content

Reducing graphics quality based on performance


Paul-Andre
 Share

Recommended Posts

Hello.

 

I am making a game and I want it to adapt to the performance of the device/browser used. By this I mean reducing the particle number, reducing the screen size, etc... 

What I'm not sure about is how do I measure the performance of a device. I thought about using fps, but it seems that my game lags at times when there are lots of objects moving, so I'm not sure how to measure it reliantly. Any ideas?

Link to comment
Share on other sites

I think I wasn't clear enough. I have a system for switching screen resolution to smaller sizes. What I don't have is a system that will automatically switch to a lower resolution if the game lags for too long.

If a game lags, it means that the time between frame calls is extremely long. If you use a function like requestAnimationFrame() to call your function, you could calculate the deltatime, the difference in time between this and the last frame.

 

To check for lag, you could make a counter that checks for many consecutive frames if the deltatime is unreasonable high.

 

To then remove the lag:

-Reduce graphical systems like particles or other shiny stuff your game uses that is only aesthetic and doesn't change the gameplay when removed.

-Use lower quality art. Especially on mobile phones, high quality art might quickly fill much of the RAM, making the phone performance stutter.

-Indeed. possibly lower the resolution.

Link to comment
Share on other sites

I think it's a bit harder than it sounds though... if your game keeps running in the background (in a background tab of the browser for example), your timing will be all over the place. You'd have to make sure that you only measure FPS when the user is actively playing, when input events are being triggered, or something like that.

Link to comment
Share on other sites

Thank you all.

After some consideration, I think I would rather have the user change the resolution setting themselves.

The issue with old mobile devices is ram? I didn't know that. So generating different resolutions of my assets like I did at loading isn't the best idea. Do you know if there is a definitive way to "unloading" an image? I am procedurally generating my assets and storing them in canvases.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...