Jump to content

dontHaveName

Members
  • Posts

    4
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

dontHaveName's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, what's an equivalent of stage.disableVisibilityChange in Phaser 3? I don't want to stop all tweens after I switch between tabs.
  2. Hello, is there any way to complete current tween in the timeline and then remove following tweens? I'm inserting tweens like this: tweens.push({ targets: this.sprite, x: { value: 50, duration: 1000 }, y: { value: 50, duration: 1000 } }); this.tweens.timeline({ tweens }); Then after some event I need to finish current tween and clear all following (if any). This seems to stop tweens: this.tweens.killAll(); but I can't find anything to finish current tween at first. Thanks
  3. I'm trying to build a real-time MMO game. I'm using Phaser for FE and Node.js + socket.io for BE. I have read all the tutorials like http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html and so on. Different players might have different FPS, this is how I update position on the client (phaser): const data = { down: this.cursors.down.isDown, timestamp: Date.now() }; var deltaTime = (data.timestamp - this.lastTimestamp) / 1000; if (data.down) { player.position.y += speed * deltaTime; socket.emit('input', data); } This ensures speed is FPS independent (every player is moving with the same speed). The server is running a tick() at 60 FPS. This method is processing saved inputs from players. How should the server correct player positions? It doesn't know their delta times. It also can't use server's delta time since it would be always around 0.016 and it doesn't reflect player's update interval. tick() { var now = Date.now(); var serverDelta = (now - this.prevTimestamp) / 1000; this.prevTimestamp = now; for (var player of players) { player.update(); } } player.update() { for (input in savedInputs) { player.y += input.down * speed; } }
×
×
  • Create New...