How mvolfik/roborally works
Main Components
a) Client-Side Components:
• Frontend SPA (Svelte-based)
• WebAssembly Module (roborally-frontend-wasm)
• Shared Structures (roborally-structs with 'client' feature)
b) Server-Side Components:
• Game Server (roborally-server)
• Shared Structures (roborally-structs with 'server' feature)
• Storage
• Game State Management
• Card Script Engine (Rhai)
[Frontend Layer] <-> [Communication Layer] <-> [Backend Layer]
Key Relationships to Highlight
a) Frontend Layer:
• Svelte components hierarchy
• WebAssembly bridge
• Demonstrate shared structure usage
b) Communication Layer:
• WebSocket connection
• MessagePack serialization
• Enum-based message types (ServerMessage/ClientMessage)
c) Backend Layer:
• Game state management
• Card script execution
• Handling
• Player management
Specific Implementation Details
• WebSocket communication paths
• State updates
• Game command flow
• Animation state propagation
b) Component Interactions:
• How WebAssembly interfaces with JavaScript
• Game state locking mechanism
• Card script execution flow
Detailed Component Breakdown
Frontend:
[Svelte Components]
• App.svelte (Main container)
• Game.svelte (Game state manager)
• Supporting Components
• Map.svelte
• Programmer.svelte
• Others
[WebAssembly Bridge]
• State Deserialization
• Type Conversions
• CSS Transformations
Backend:
[Game Server]
• Game State Manager
• Player Connections
• Card Script Engine
• Map Handler
[Shared Structures]
• Game State
• Messages
• Types
Implementation Notes
Callouts for:
• Rust's type system usage
• WebAssembly limitations and workarounds
• State management approach
• Real-time game synchronization
Remember to emphasize the unique aspects of this implementation:
• The shared structure approach between client and server
• The WebAssembly bridge for efficient state handling
• The separation of game logic and presentation
• The real-time nature of the game state updates
This system design should clearly communicate how the application maintains type safety across boundaries while delivering a complex board game experience in a web browser.