MaskedPixel Posted April 9, 2017 Share Posted April 9, 2017 The situation: I have an update loop where I "fixed the timestep". Physics is running at ta fixed 30fps and my render loop is completely independent. However, on a mobile device with a framerate that jumps around between 20-35 fps, there seems to be stuttering with the camera. Now, I know how to approach the issue, I'm just trying to figure out how to do it off the mobile device. What I want to do: I would like to simulate the irregular fps within the browser on desktop. Is there a way to do that via debug tools or with an extension on any browser? Does anyone know of a solution here? Fix your timestep: http://gafferongames.com/game-physics/fix-your-timestep/ Quote Link to comment Share on other sites More sharing options...
scheffgames Posted April 9, 2017 Share Posted April 9, 2017 It can be as simple as creating a random expensive operation that occurs at certain intervals of time. Depends on what framework you're using but generaly rendering lots of sprites on the screen or performing heavy computations involving for loops might work. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted April 10, 2017 Share Posted April 10, 2017 You could be a bit more specific about chewing up cycles by timing it: function work (frames) { let start = performance.now(); let flag = true let time = 1000 / frames while (flag) { if (performance.now() - start > time) { flag = false } } } There might be a few edge-cases with this, for example, make sure you test that current execution time is greater than the time you want because something could cause a couple of cycles to run longer than a frame and you don't want this function to hang your code, at least by checking greater than it should do very little work if you're already over. You might need to pass in the start time to coincide with the actual start of your update/render, rather than when this function gets called. Slightly more reliable/usable than something like counting down from 1e8 though or rendering loads of sprites in one go. spinnerbox and b10b 2 Quote Link to comment Share on other sites More sharing options...
Nesh108 Posted May 5, 2017 Share Posted May 5, 2017 So, @mattstyles your goal is to reproduce the unstable framerate of a mobile device on your desktop computer. Why don't you spin up a small Virtual Machine and then adjust the memory/CPU to get the desired behaviour? At the end, your goal is to fix the problem on lower-end systems (regardless of it being mobile or desktop) and modifying your code just to reproduce this might actually introduce other problems and not solve your first issue. What do you think? Quote Link to comment Share on other sites More sharing options...
themoonrat Posted May 17, 2017 Share Posted May 17, 2017 In Chrome (i use Canary to dev with Dev experiments enabled) you can set cpu throttling, which may help you. http://deanhume.com/home/blogpost/cpu-throttling-using-chrome-developer-tools/10144 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.