Fix movement pacing defaults and remove config knobs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Maintainer-controlled web client version.
|
||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||
window.CHGRID_WEB_VERSION = "2026.02.25 R236";
|
||||
window.CHGRID_WEB_VERSION = "2026.02.25 R237";
|
||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||
|
||||
@@ -47,8 +47,6 @@ class WorldConfigSection(BaseModel):
|
||||
"""Authoritative world geometry options."""
|
||||
|
||||
grid_size: int = Field(default=41, ge=1)
|
||||
movement_tick_ms: int = Field(default=100, ge=1)
|
||||
movement_max_steps_per_tick: int = Field(default=2, ge=1)
|
||||
|
||||
|
||||
class AppConfig(BaseModel):
|
||||
|
||||
@@ -76,6 +76,8 @@ CLIENT_PACKET_ADAPTER = TypeAdapter(ClientPacket)
|
||||
MAX_ACTIVE_PIANO_KEYS_PER_CLIENT = 12
|
||||
PIANO_RECORDING_MAX_MS = 30_000
|
||||
PIANO_RECORDING_MAX_EVENTS = 4096
|
||||
MOVEMENT_TICK_MS = 200
|
||||
MOVEMENT_MAX_STEPS_PER_TICK = 1
|
||||
|
||||
|
||||
class SignalingServer:
|
||||
@@ -90,8 +92,6 @@ class SignalingServer:
|
||||
max_message_size: int = 2_000_000,
|
||||
state_file: Path | None = None,
|
||||
grid_size: int = 41,
|
||||
movement_tick_ms: int = 100,
|
||||
movement_max_steps_per_tick: int = 2,
|
||||
state_save_debounce_ms: int = 200,
|
||||
state_save_max_delay_ms: int = 1000,
|
||||
):
|
||||
@@ -108,8 +108,8 @@ class SignalingServer:
|
||||
self.piano_recording_state_by_item: dict[str, dict] = {}
|
||||
self.piano_playback_tasks_by_item: dict[str, asyncio.Task[None]] = {}
|
||||
self.grid_size = max(1, grid_size)
|
||||
self.movement_tick_ms = max(1, int(movement_tick_ms))
|
||||
self.movement_max_steps_per_tick = max(1, int(movement_max_steps_per_tick))
|
||||
self.movement_tick_ms = MOVEMENT_TICK_MS
|
||||
self.movement_max_steps_per_tick = MOVEMENT_MAX_STEPS_PER_TICK
|
||||
self.instance_id = str(uuid.uuid4())
|
||||
self.server_version = self._resolve_server_version()
|
||||
self.state_save_debounce_ms = max(1, int(state_save_debounce_ms))
|
||||
@@ -1454,8 +1454,6 @@ def run() -> None:
|
||||
max_message_size=config.network.max_message_bytes,
|
||||
state_file=state_file,
|
||||
grid_size=config.world.grid_size,
|
||||
movement_tick_ms=config.world.movement_tick_ms,
|
||||
movement_max_steps_per_tick=config.world.movement_max_steps_per_tick,
|
||||
state_save_debounce_ms=config.storage.state_save_debounce_ms,
|
||||
state_save_max_delay_ms=config.storage.state_save_max_delay_ms,
|
||||
)
|
||||
|
||||
@@ -29,7 +29,3 @@ state_save_max_delay_ms = 1000
|
||||
[world]
|
||||
# Grid width/height in cells. Valid coordinates are 0..grid_size-1.
|
||||
grid_size = 41
|
||||
# Server-authoritative movement rate window in milliseconds.
|
||||
movement_tick_ms = 100
|
||||
# Max grid steps allowed per movement tick window.
|
||||
movement_max_steps_per_tick = 2
|
||||
|
||||
@@ -108,7 +108,9 @@ async def test_item_add_rejects_unknown_type(monkeypatch: pytest.MonkeyPatch) ->
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_update_position_enforces_cumulative_budget_per_tick(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
server = SignalingServer("127.0.0.1", 8765, None, None, grid_size=41, movement_tick_ms=100, movement_max_steps_per_tick=2)
|
||||
server = SignalingServer("127.0.0.1", 8765, None, None, grid_size=41)
|
||||
server.movement_tick_ms = 100
|
||||
server.movement_max_steps_per_tick = 2
|
||||
ws = _fake_ws()
|
||||
client = ClientConnection(websocket=ws, id="u1", nickname="tester", x=5, y=5)
|
||||
server.clients[ws] = client
|
||||
|
||||
Reference in New Issue
Block a user