Engine bump brings MrGameEng.Net (WebSocket transport, RFC 6455 server, delta component replication) — this commit is its showcase. LittleSim.Server --listen runs the world online: 24 pawns wander, tire and rest on the engine's fixed-tick HeadlessHost (the same Wander/ Needs/Decision systems the windowed world uses), a WebSocketServer accepts clients and a ReplicationServer ships Transform2D + PawnNeeds deltas at 10 snapshots/s per the shared NetSchema. --probe is the CLI check: it connects, listens for a second and prints replicated pawns with positions sampled twice to show the world is alive. The game gains MultiplayerScene (dotnet run --project src/LittleSim -- --connect [ws://host:port]): simulation stays on the server, the client applies snapshots into its scene store, decorates spawned entities with sprites and reuses PawnAppearanceSystem so replicated fatigue darkens pawns locally. HUD strings go through ru/en localization; the `net` console command reports connection state and entity count. Esc returns to the main menu. Verified end to end: probe sees 24 pawns moving between samples; the windowed client connects and runs against a live local server. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
36 lines
781 B
C#
36 lines
781 B
C#
using System;
|
|
using Microsoft.JSInterop;
|
|
using Microsoft.Xna.Framework;
|
|
|
|
namespace KniWebSpike.Pages
|
|
{
|
|
public partial class Index
|
|
{
|
|
Game _game;
|
|
|
|
protected override void OnAfterRender(bool firstRender)
|
|
{
|
|
base.OnAfterRender(firstRender);
|
|
|
|
if (firstRender)
|
|
{
|
|
JsRuntime.InvokeAsync<object>("initRenderJS", DotNetObjectReference.Create(this));
|
|
}
|
|
}
|
|
|
|
[JSInvokable]
|
|
public void TickDotNet()
|
|
{
|
|
// init game
|
|
if (_game == null)
|
|
{
|
|
_game = new KniWebSpikeGame();
|
|
_game.Run();
|
|
}
|
|
|
|
// run gameloop
|
|
_game.Tick();
|
|
}
|
|
}
|
|
}
|