Paul-Andre Posted September 2, 2013 Share Posted September 2, 2013 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? Quote Link to comment Share on other sites More sharing options...
joannesalfa Posted September 2, 2013 Share Posted September 2, 2013 It's about render performance for graphics size. Graphic files have small size, would render faster than bigger high resolution graphic files. Having a lot of objects are up to logic performance, not rendering. I recommend you to use less than 50 objects for mobile devices (iPod 4 touch). Quote Link to comment Share on other sites More sharing options...
Paul-Andre Posted September 2, 2013 Author Share Posted September 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
Qqwy Posted September 3, 2013 Share Posted September 3, 2013 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. Quote Link to comment Share on other sites More sharing options...
Ezelia Posted September 3, 2013 Share Posted September 3, 2013 you can calculate an average FPS or a cumulative FPS that'll tell you if the game is becoming slow at a certain time. Quote Link to comment Share on other sites More sharing options...
Gio Posted September 4, 2013 Share Posted September 4, 2013 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. Quote Link to comment Share on other sites More sharing options...
Paul-Andre Posted September 6, 2013 Author Share Posted September 6, 2013 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.