Implements the StartupMessage protocol: client generates world_seed in SessionManager.new_game(), sends it after handshake, server uses it to seed SimRng and sample EntanglementConfig. EntanglementConfig samples flat ∈ [25,35]%, intrigue ∈ [15,25]%, mundane as remainder (D-029). Same seed produces identical config (D-010 determinism). Different seeds produce distinct configs in ≥90% of pairs. Protocol flow: HandshakeMessage (server→client) → StartupMessage with world_seed (client→server) → SimRng initialization → tick loop. 10 Rust tests (determinism, variation, bounds, sum invariant). 9 GDScript test stubs + 2 encode tests for client-side pipeline. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -40,6 +40,11 @@ pub trait SimBridge: Send + Sync {
|
||||
/// any ObserverSnapshot is sent.
|
||||
fn send_handshake(&self) -> Result<(), BridgeError>;
|
||||
|
||||
/// Receive the client's startup message containing the world seed (#175).
|
||||
/// Called exactly once, after send_handshake(), before entering the tick loop.
|
||||
/// Blocks until the client sends the message.
|
||||
fn receive_startup(&self) -> Result<StartupMessage, BridgeError>;
|
||||
|
||||
/// Send an observer snapshot to the client
|
||||
fn send_snapshot(&self, snapshot: &ObserverSnapshot) -> Result<(), BridgeError>;
|
||||
|
||||
@@ -64,6 +69,10 @@ impl BridgeResource {
|
||||
self.inner.send_handshake()
|
||||
}
|
||||
|
||||
pub fn receive_startup(&self) -> Result<StartupMessage, BridgeError> {
|
||||
self.inner.receive_startup()
|
||||
}
|
||||
|
||||
pub fn send_snapshot(&self, snapshot: &ObserverSnapshot) -> Result<(), BridgeError> {
|
||||
self.inner.send_snapshot(snapshot)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user