Jump to content

Make game unplayable on low HW devices


Recommended Posts

Hello, I've got a problem with my game. On very old devices it's playable with low fps. The player with this device is in advantage, because the game figure's moves are much slower and he can react very quickly. Even if the game is in the hardest mode, this "low fps player" can play the game very easy... So, how can I make the game unplayable on this low HW devices? I think, the main problem is that I've got a game logic/figure moves in game loop...so if the player has 4fps, then he has got only 4 chances to figuremoves instead of 60 (60fps). 

function gameLoop() {    requestAnimationFrame(gameLoop);    play();    renderer.render(stage);}function play() {    if(startGame) {        if(startGame && !started) {            game.startGame(Date.now());            started = true;        }        if(end) {            modals();            renderer.plugins.interaction.destroy();            dragon.rotate = dragon.prevRotate;        } else {               time.text = Math.floor(game.getElapsedTime() / 1000) + 's';            dragon.prevRotate = dragon.rotate;            dragon.rotate += game.evalWindStrength();            dragon.rotation += dragon.rotate;            dragon.position.x += (dragon.rotation * MOVEMENT_FACTOR);            arrow.rotation += dragon.rotate;            Math.abs(arrow.rotation) > Math.PI / 4 ? arrow.tint = 0xB31634 : arrow.tint = 0x22205B;            // end game            if(dragon.position.x < 600 || dragon.position.x > 1320) {                end = true;                started = false;            }         }    } }
Link to comment
Share on other sites

You have to make sure you evaluate how much time has passed between each run of play(). And scale you movement accordingly.


Say you rotate 1000 degrees per second. which is insanely fast, but makes explanation easier :)


At 60 fps that means you should rotate +-16 degrees per play() call

at 6 fps that means you should rotate +-160 degrees per play() call.


But in your current implementation you rotate by a fixed amount. To counter that you have to scale your rotation by the time passed.

For instance:


addRotation = 1000 * ( millisecondsElapsed / 1000 );

dragon.rotate += addRotation;


Now if you run at slower FPS you will get stuttery graphics, but your rotation will be scaled by the time elapsed and those with slower framrates will rotate the proper amount regardless of fps.

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.

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.


  • Recently Browsing   0 members

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