remove guid, reduce latency (gets stuck sometimes tho)
This commit is contained in:
parent
6bc6a039bd
commit
7044ffda79
19 changed files with 291 additions and 251 deletions
|
@ -6,20 +6,16 @@ namespace TanksServer.Interactivity;
|
|||
|
||||
internal sealed class ClientScreenServer(
|
||||
ILogger<ClientScreenServer> logger,
|
||||
ILoggerFactory loggerFactory,
|
||||
IOptions<HostConfiguration> hostConfig
|
||||
ILoggerFactory loggerFactory
|
||||
) : WebsocketServer<ClientScreenServerConnection>(logger), IFrameConsumer
|
||||
{
|
||||
private readonly TimeSpan _minFrameTime = TimeSpan.FromMilliseconds(hostConfig.Value.ClientDisplayMinFrameTimeMs);
|
||||
|
||||
public Task HandleClientAsync(WebSocket socket, Guid? playerGuid)
|
||||
public Task HandleClientAsync(WebSocket socket, string? player)
|
||||
=> base.HandleClientAsync(new(
|
||||
socket,
|
||||
loggerFactory.CreateLogger<ClientScreenServerConnection>(),
|
||||
_minFrameTime,
|
||||
playerGuid
|
||||
player
|
||||
));
|
||||
|
||||
public Task OnFrameDoneAsync(GamePixelGrid gamePixelGrid, PixelGrid observerPixels)
|
||||
=> ParallelForEachConnectionAsync(c => c.SendAsync(observerPixels, gamePixelGrid));
|
||||
=> ParallelForEachConnectionAsync(c => c.OnGameTickAsync(observerPixels, gamePixelGrid).AsTask());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue