refactor: timestamp precision
This commit is contained in:
parent
e15e94777f
commit
77dcb7c5a1
|
@ -29,7 +29,7 @@ export default class Engine {
|
|||
frame = 0;
|
||||
handle;
|
||||
incomingActions = new Map();
|
||||
last = Date.now();
|
||||
last;
|
||||
server;
|
||||
|
||||
constructor(Server) {
|
||||
|
@ -398,10 +398,12 @@ export default class Engine {
|
|||
}
|
||||
|
||||
start() {
|
||||
this.last = performance.now() / 1000;
|
||||
const loop = async () => {
|
||||
const now = performance.now() / 1000;
|
||||
const elapsed = now - this.last;
|
||||
this.last = now;
|
||||
this.acceptActions();
|
||||
const elapsed = (Date.now() - this.last) / 1000;
|
||||
this.last = Date.now();
|
||||
this.tick(elapsed);
|
||||
this.update(elapsed);
|
||||
this.setClean();
|
||||
|
|
Loading…
Reference in New Issue
Block a user