feat : 맵 바운딩 박스 처리 / echo 패킷 구조 재 구성 / 더미 클라이언트 랜덤 이동 작업

This commit is contained in:
qornwh1
2026-03-04 14:51:43 +09:00
parent 241820846d
commit 053c5d23b9
16 changed files with 262 additions and 121 deletions

View File

@@ -11,10 +11,18 @@ public class DummyClientService
// 모든거 강종
public event Action? OnAllDisconnected;
public DummyClientService(int count, string ip, int port, string key, int sendIntervalMs = 1000)
public DummyClientService(int count, string ip, int port, string key, int sendIntervalMs = 1000, MapBounds? mapBounds = null)
{
sendInterval = sendIntervalMs;
clients = Enumerable.Range(1, count + 1).Select(i => new DummyClients(i, ip, port, key)).ToList();
clients = Enumerable.Range(1, count).Select(i =>
{
DummyClients client = new DummyClients(i, ip, port, key);
if (mapBounds != null)
{
client.Map = mapBounds;
}
return client;
}).ToList();
Log.Information("[SERVICE] {Count}개 클라이언트 생성 → {Ip}:{Port}", count, ip, port);
}
@@ -30,30 +38,23 @@ public class DummyClientService
{
foreach (DummyClients c in clients)
{
c.PollEvents();
try
{
c.PollEvents();
}
catch (Exception ex)
{
Log.Error("[Client {ClientId}] PollEvents 예외: {Ex}", c.clientId, ex.Message);
}
}
try
{
await Task.Delay(10, ct);
}
catch (OperationCanceledException)
{
break;
}
await Task.Delay(10);
}
}
private async Task SendLoopAsync(CancellationToken ct)
{
try
{
await Task.Delay(500, ct);
}
catch (OperationCanceledException)
{
return;
}
await Task.Delay(500);
int tick = 0;
@@ -85,14 +86,7 @@ public class DummyClientService
Log.Debug("[TICK {Tick:000}] {Sent}/{Total} 전송", tick, sent, total);
tick++;
try
{
await Task.Delay(sendInterval, ct);
}
catch (OperationCanceledException)
{
break;
}
await Task.Delay(sendInterval);
}
}