简体   繁体   中英

setInterval or requestAnimationFrame for Esports games in Browser?

I want my game to run at 999 FPS with my 60Hz monitor.LOL Enlight me pls. Is there another solution?

    !DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

</body>
</html>

You can use setInterval to change how many times something updates per second. See setInterval() - w3schools . However, there is no way to make you monitor run at 999 FPS, as it is a 60 Hz monitor. I would recommend setting the games update time equivalent to the monitor refresh rate for the best performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM