mirror of
https://github.com/logsol/chuck.js.git
synced 2026-06-25 16:42:34 +00:00
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>
49 lines
No EOL
1.3 KiB
JavaScript
Executable file
49 lines
No EOL
1.3 KiB
JavaScript
Executable file
define([
|
|
"Game/Core/Control/PlayerController",
|
|
"Lib/Utilities/NotificationCenter",
|
|
"Lib/Utilities/Protocol/Parser"
|
|
],
|
|
|
|
function(Parent, nc, Parser) {
|
|
|
|
"use strict";
|
|
|
|
function PlayerController(player) {
|
|
|
|
Parent.call(this, player);
|
|
}
|
|
|
|
PlayerController.prototype = Object.create(Parent.prototype);
|
|
|
|
/*
|
|
* retrieves move (and other) commands from client and executes them at the server
|
|
*/
|
|
PlayerController.prototype.applyCommand = function(options) {
|
|
// FIXME: remove this function and use ProtocolHelper.applyCommand() instead
|
|
// Don't forget to change the function names to on...
|
|
var message;
|
|
if (typeof options == "string") {
|
|
message = Parser.decode(options);
|
|
} else {
|
|
message = options;
|
|
}
|
|
|
|
for (var command in message) {
|
|
this[command].call(this, message[command]);
|
|
}
|
|
};
|
|
|
|
PlayerController.prototype.handActionRequest = function(options) {
|
|
options.x = parseFloat(options.x) || 0.0;
|
|
options.y = parseFloat(options.y) || 0.0;
|
|
options.av = parseFloat(options.av) || 0.0;
|
|
if (options) this.player.handActionRequest(options);
|
|
};
|
|
|
|
PlayerController.prototype.suicide = function() {
|
|
this.player.suicide();
|
|
};
|
|
|
|
return PlayerController;
|
|
|
|
}); |