make the snapshot interval settable to test the model theory

two results this round, both negative and both useful.

the account ids are right end to end, so isOwnedByBottomPlayer picks the
branch it should. and every character row carries the export names it
needs - knight, goblin and barbarian all have a filename, a blue and a
red prefix and UseAnimator set - so neither "empty prefix" nor "wrong
row" survives. Debugger::error is __noreturn, and the client does not
abort, so Character::Character is not failing to build animations
either: reached, it works.

with the checksum agreeing byte for byte, the objects in the client are
identical to ours. that leaves only the sprite never being made, or
being made and torn down again - and every push re-runs decode, which
destroys whatever it cannot match. five times a second nothing would
ever be seen. SCROLL_SNAPSHOT_INTERVAL_TICKS widens the gap so one run
can tell.
This commit is contained in:
WiseDev 2026-08-23 16:34:07 +03:00
parent 73de62794a
commit f072c16244

View file

@ -1,6 +1,13 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc; use std::sync::Arc;
pub const SNAPSHOT_INTERVAL_TICKS: i32 = 4; pub const SNAPSHOT_INTERVAL_TICKS: i32 = 4;
pub fn snapshot_interval_ticks() -> i32 {
std::env::var("SCROLL_SNAPSHOT_INTERVAL_TICKS")
.ok()
.and_then(|value| value.parse::<i32>().ok())
.filter(|ticks| *ticks > 0)
.unwrap_or(SNAPSHOT_INTERVAL_TICKS)
}
pub const MAX_CATCH_UP_TICKS: i32 = 40; pub const MAX_CATCH_UP_TICKS: i32 = 40;
use std::time::Instant; use std::time::Instant;
use logic::battle::{ use logic::battle::{
@ -51,7 +58,7 @@ impl BattleSession {
random, random,
taunts, taunts,
next_bot_emote, next_bot_emote,
next_snapshot: SNAPSHOT_INTERVAL_TICKS, next_snapshot: snapshot_interval_ticks(),
next_bot_play: crate::bot::BOT_OPENING_DELAY_SECONDS * BATTLE_TICKS_PER_SECOND, next_bot_play: crate::bot::BOT_OPENING_DELAY_SECONDS * BATTLE_TICKS_PER_SECOND,
pushed_snapshots: 0, pushed_snapshots: 0,
next_instance: first_instance, next_instance: first_instance,
@ -256,7 +263,7 @@ impl BattleSession {
self.release_queued(self.tick); self.release_queued(self.tick);
self.mode.battle.tick(self.tick); self.mode.battle.tick(self.tick);
if self.pushes_snapshots() && self.tick >= self.next_snapshot { if self.pushes_snapshots() && self.tick >= self.next_snapshot {
self.next_snapshot = self.tick + SNAPSHOT_INTERVAL_TICKS; self.next_snapshot = self.tick + snapshot_interval_ticks();
if let Some(message) = self.snapshot_message() { if let Some(message) = self.snapshot_message() {
self.pushed_snapshots += 1; self.pushed_snapshots += 1;
self.outbound.push(message); self.outbound.push(message);