F3: client Godot minimo, replay dei comandi e collaudi automatici

- Client Godot 4.7 .NET (Godot.NET.Sdk 4.7.2): menu, collegamento, partita
  locale con server figlio; mappa con terreno (fasce, ombreggiatura, rive
  curve con shader, curve di livello), opere, entità, alberi, treni
  interpolati con fumo; strumenti binari con profilo, stazione, deposito,
  segnali, demolizione; pannelli treni, linee, mercato, finanze, schede;
  barra superiore, minimappa, notiziario; italiano e inglese.
- Pilota automatico del client e scripts/client-autopilot.sh: partita locale,
  linea con ponte, treni in moto e schermate (docs/screenshots).
- Registro dei comandi del server (--record) e viaferrea-tools replay.
- PROTOCOL.md normativo, ADR 0009, ARCHITECTURE, STATE e README aggiornati.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
Claude committed 2026-10-02 00:47:42 +00:00
1 parent 5a318e6528
commit 9a4ada6d9d
97 files changed
+5151 -96

No files matched your search

@@ -281,3 +281,36 @@ public static class ProtocolTests
Assert.Equal(1 + 1 + 2 + 10 + 1 + 6, w.Length);
}
}
public static class CommandLogTests
{
[Test(Description = "Registro dei comandi: salvataggio di partenza + comandi riapplicati ai loro tick = stesso hash")]
public static void RecordedCommandsReplayToTheSameState()
{
var f = ViaFerrea.Tests.Rail.RailFixture.Valdoria();
var w = f.W;
byte[] start = ViaFerrea.Core.Persistence.SaveFile.Save(w, "test");
w.CommandLog = [];
var (mine, mill, depot) = f.BuildFreightNetwork(waitForConstruction: false);
f.Ok(new TakeLoanCommand(Money.FromLire(10_000)));
w.RunDays(3);
var file = new MemoryStream();
CommandLogFile.WriteHeader(file);
foreach (var (tick, command) in w.CommandLog) CommandLogFile.Append(file, tick, command);
long endTick = w.Clock.Tick;
ulong expected = ViaFerrea.Core.Persistence.StateHasher.Compute(w);
var commands = CommandLogFile.ReadAll(file.ToArray());
Assert.Equal(w.CommandLog.Count, commands.Count);
var replay = ViaFerrea.Core.Persistence.SaveFile.Load(TestData.Data, start);
int next = 0;
while (replay.Clock.Tick < endTick)
{
while (next < commands.Count && commands[next].Tick == replay.Clock.Tick) replay.Enqueue(commands[next++].Command);
replay.Tick();
}
Assert.Equal(commands.Count, next);
Assert.Equal(expected, ViaFerrea.Core.Persistence.StateHasher.Compute(replay));
Assert.True(mine >= 0 && mill >= 0 && depot >= 0);
}
}