feat(battle-node): add BattleType, BattleFinishReason, BattlePlayer

Phase 1 foundation types for the v2 broker architecture. Nothing uses
them yet; they land alongside the existing v1.2 code so subsequent
tasks can extract the participant interface and impls.
This commit is contained in:
gamer147
2026-06-01 19:53:31 -04:00
parent 479548fa56
commit ae7ff25af0
3 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
namespace SVSim.BattleNode.Bridge;
/// <summary>One player slot for a pending battle. Carries the viewer's identity and
/// the per-battle MatchContext snapshot built at do_matching time.</summary>
public sealed record BattlePlayer(long ViewerId, MatchContext Context);

View File

@@ -0,0 +1,13 @@
namespace SVSim.BattleNode.Sessions;
/// <summary>Reason a participant was terminated. Carried to
/// <see cref="IBattleParticipant.TerminateAsync"/> so impls can log/clean differently
/// per cause. Cleanup itself is the same regardless of reason.</summary>
public enum BattleFinishReason
{
NormalFinish,
Retire,
OpponentDisconnect,
Timeout,
ServerAbort,
}

View File

@@ -0,0 +1,22 @@
namespace SVSim.BattleNode.Sessions;
/// <summary>
/// Discriminator for a pending battle and the session it produces. See
/// docs/superpowers/specs/2026-06-01-battle-node-v2-architecture-design.md.
/// </summary>
public enum BattleType
{
/// <summary>Two real players. Server brokers between two WebSockets.
/// Both <c>BattlePlayer</c> slots required.</summary>
Pvp,
/// <summary>One real player; opponent runs in the client (prod's IsAINetwork
/// path; matched only in rank rotation / rank unlimited per prod). Server is
/// ack-only. <c>p2</c> must be null.</summary>
Bot,
/// <summary>One real player; server scripts the opponent (today's v1.2
/// behaviour, preserved as a solo testing harness). <c>p2</c> currently null;
/// future server-driven bot config can ride on <c>p2</c>.</summary>
Scripted,
}