mirror of
https://github.com/logsol/chuck.js.git
synced 2026-06-25 16:42:34 +00:00
Remove server reconciliation in favor of pure client prediction
The reconciliation system caused visible teleportation at high latency (e.g. 250ms Germany→Korea): position corrections snapped the local player and thrown items back to stale server states. - Drop the inputAck/seq tracking, InputBuffer, and applyReconciliation. The client predicts locally and the server stays authoritative via the existing worldUpdate broadcast; own-doll updates remain ignored. - Override Item.setUpdateData on the client so in-flight items run free on local Box2D physics (client and server share the same throw impulse) and only sync when stationary or far out of sync. This keeps grab-sensor contact accurate while eliminating mid-flight snapping. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a0481ed867
commit
d39a55e20e
8 changed files with 31 additions and 152 deletions
|
|
@ -4,10 +4,9 @@ define([
|
|||
"Lib/Utilities/NotificationCenter",
|
||||
"Lib/Utilities/Assert",
|
||||
"Game/Client/Control/PlayerController",
|
||||
"Game/Client/InputBuffer",
|
||||
],
|
||||
|
||||
function (Parent, Settings, nc, Assert, PlayerController, InputBuffer) {
|
||||
function (Parent, Settings, nc, Assert, PlayerController) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
|
@ -20,8 +19,6 @@ function (Parent, Settings, nc, Assert, PlayerController, InputBuffer) {
|
|||
y: 0
|
||||
};
|
||||
|
||||
this.inputBuffer = new InputBuffer();
|
||||
|
||||
this.arrowMesh = null;
|
||||
this.createAndAddArrow();
|
||||
this.playerController = new PlayerController(this);
|
||||
|
|
@ -45,27 +42,6 @@ function (Parent, Settings, nc, Assert, PlayerController, InputBuffer) {
|
|||
};
|
||||
};
|
||||
|
||||
Me.prototype.applyReconciliation = function(x, y, vx, vy) {
|
||||
var currentPos = this.doll.body.GetPosition();
|
||||
var diffX = x - currentPos.x;
|
||||
var diffY = y - currentPos.y;
|
||||
var distance = Math.sqrt(diffX * diffX + diffY * diffY);
|
||||
|
||||
if (distance > Settings.RECONCILIATION_SNAP_THRESHOLD) {
|
||||
// Large error — snap immediately (server-side teleport, respawn, etc.)
|
||||
this.doll.body.SetPosition({x: x, y: y});
|
||||
} else {
|
||||
// Small error — blend toward reconciled position
|
||||
var factor = Settings.RECONCILIATION_BLEND_FACTOR;
|
||||
this.doll.body.SetPosition({
|
||||
x: currentPos.x + diffX * factor,
|
||||
y: currentPos.y + diffY * factor
|
||||
});
|
||||
}
|
||||
|
||||
this.doll.body.SetLinearVelocity({x: vx, y: vy});
|
||||
};
|
||||
|
||||
Me.prototype.createAndAddArrow = function() {
|
||||
var self = this;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue