Harden auto-reconnect handshake and smooth local footsteps
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.22 R175";
|
window.CHGRID_WEB_VERSION = "2026.02.22 R176";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ function handleMovement(): void {
|
|||||||
persistPlayerPosition();
|
persistPlayerPosition();
|
||||||
state.player.lastMoveTime = now;
|
state.player.lastMoveTime = now;
|
||||||
void refreshAudioSubscriptions(true);
|
void refreshAudioSubscriptions(true);
|
||||||
void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN, 40);
|
void audio.playSample(randomFootstepUrl(), FOOTSTEP_GAIN, 100);
|
||||||
signaling.send({ type: 'update_position', x: nextX, y: nextY });
|
signaling.send({ type: 'update_position', x: nextX, y: nextY });
|
||||||
|
|
||||||
const namesOnTile = getPeerNamesAtPosition(nextX, nextY);
|
const namesOnTile = getPeerNamesAtPosition(nextX, nextY);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import type { GameState } from '../state/gameState';
|
import type { GameState } from '../state/gameState';
|
||||||
|
|
||||||
|
const WELCOME_TIMEOUT_MS = 8_000;
|
||||||
|
|
||||||
type DomRefs = {
|
type DomRefs = {
|
||||||
preconnectNickname: HTMLInputElement;
|
preconnectNickname: HTMLInputElement;
|
||||||
nicknameContainer: HTMLDivElement;
|
nicknameContainer: HTMLDivElement;
|
||||||
@@ -103,6 +105,16 @@ export async function runConnectFlow(deps: ConnectFlowDeps): Promise<void> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await deps.signalingConnect(deps.onMessage);
|
await deps.signalingConnect(deps.onMessage);
|
||||||
|
window.setTimeout(() => {
|
||||||
|
if (deps.state.running || !deps.mediaIsConnecting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
deps.mediaStopLocalMedia();
|
||||||
|
deps.signalingDisconnect();
|
||||||
|
deps.mediaSetConnecting(false);
|
||||||
|
deps.updateConnectAvailability();
|
||||||
|
deps.updateStatus('Connect failed. Timed out waiting for server welcome.');
|
||||||
|
}, WELCOME_TIMEOUT_MS);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
deps.mediaStopLocalMedia();
|
deps.mediaStopLocalMedia();
|
||||||
|
|||||||
Reference in New Issue
Block a user