Commit Graph
7 Commits
Author SHA1 Message Date
adminandClaude Opus 4.8 0834419a56 Make the number of hunters configurable in MatchManager
StartMatch rolled exactly one random Hunter. Add a serialized hunterCount
field (default 1, [Min(0)], inspector-tunable) and roll N distinct random
Hunters via a partial Fisher-Yates on the client-id list, clamped to the
player count: 0 = all Hiders, >= player count = all Hunters. The match
sequence now carries a HashSet of hunter ids instead of a single id.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 21:39:30 +02:00
adminandClaude Opus 4.8 cdfec364b2 Toggle session panel with Escape as in-game pause overlay
- Panel shows in Main while disconnected, auto-hides once a connection is
  established, and toggles open/closed with Escape in the Lobby or on a Map.
- Escape now pauses gameplay (active mode exits, cursor freed, paint and
  movement disabled) instead of ending the match directly; closing restores
  the prior mode via SwitchTo.
- Disconnect button is context-aware: leaves the session in the Lobby, acts
  as "Back to Lobby" (EndMatch) for the match authority on a Map, and stays a
  plain disconnect for non-authority clients on a Map.
- Removed the Escape->EndMatch handler from MatchManager; match end now routes
  through RequestEndMatch with the same authority routing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 11:34:13 +02:00
adminandClaude Opus 4.8 f706cdb5a7 Grant match-start/end authority to first client on dedicated server
Host keeps authority as before; a dedicated server (no host player) hands
start/end authority to the first connecting client and reassigns it if that
client leaves. The Start Match trigger now polls a server-side physics overlap
instead of relying on OnTriggerEnter, so it fires for the authority client's
remote avatar (moved by NetworkTransform, no CharacterController.Move on the
server) as well as the host's owned avatar. Esc-to-end routes a named message
from the authority client to the server when that client is not the host.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 09:34:18 +02:00
adminandClaude Opus 4.8 9d6570f7fe Carry painting across lobby/map respawns with isolated snapshot transfers
Persist each owner's paint snapshot on the MatchManager across the
despawn/respawn that happens on a lobby<->map scene switch, then reload
and rebroadcast it onto the freshly spawned avatar so painted meshes
survive the transition. Cleared on disconnect/shutdown to avoid stale
carry across sessions.

Isolate concurrent snapshot transfers by id so a respawning replica's
late-join request and the carry broadcast no longer share one reassembly
buffer (which decoded a mixed deflate blob -> "Corrupted data"), and drop
transfers with an older cutoff so a blank late-join cannot overwrite the
carried image.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 01:21:39 +02:00
adminandClaude Opus 4.8 91ce8ff329 Replace stripped-player spectator with a minimal dedicated prefab
Mid-match joiners now spawn a dedicated empty Spectator prefab (NetworkObject
+ SpectatorSetup only) instead of a fully stripped Player prefab. The FreeCam
rig is a standalone scene object in Main, so the spectator needs no avatar body,
renderer, collider, or CharacterController -- eliminating the leftover-body
artifact and the fragile per-peer strip path entirely.

- SpectatorSetup.cs (new): owner binds GameModeManager.BindSpectator (FreeCam-only)
- Spectator.prefab (new): empty avatar (Transform + NetworkObject + SpectatorSetup),
  registered in DefaultNetworkPrefabs, wired on MatchManager in Main
- GameModeManager: add BindSpectator/BuildSpectatorModes; drop the spectator
  branch from BindLocalPlayer; ReleaseToNoPlayer frees the cursor on teardown
- MatchManager: independent entropy-seeded RNG for fair hunter pick (was sharing
  the global engine RNG and always landing on the same client); spawn the
  spectator prefab for mid-match joiners; cursor-safe return-to-Main teardown
- FreeCamController: guard IgnorePlayerCollision against a disabled capsule

Also bundled (unrelated user asset/UI edits): PaintHudPanel layout tuning,
font atlas (arialroundedmtprocyr_bold SDF), forestpack_foliage material.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 00:31:49 +02:00
adminandClaude Opus 4.8 be6db5b0a9 Add match-end, spectator-hold join, and shutdown scene teardown
- Host presses Esc to end a running match: swap Test Map back to Lobby and
  respawn everyone as the neutral Player (server-gated, host-only).
- A client joining mid-match is spectator-held (no avatar) and spawns into
  the lobby when the match ends.
- On shutdown/disconnect, unload every gameplay scene so only Main is left
  loaded & active (NGO's Dispose does not unload additively-synced scenes).
- Generalize RespawnAll to a prefab selector + position so match-start
  (role variants) and match-end (neutral Player) share one path.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 23:29:28 +02:00
adminandClaude Opus 4.8 bd70f3b8b9 Add lobby/match-start matchmaking flow with additive scene management
Replace the connection-approval role selection with a server-authoritative
match flow built on NGO additive scene management:

- Scenes: Main is the persistent foundation (NetworkManager, GameModeManager,
  cameras, HUD); Lobby and Test Map load/unload additively. Add Lobby + Test Map
  to the build settings; remove the obsolete SampleScene.
- MatchManager (plain MonoBehaviour singleton): loads Lobby on server start,
  StartMatchTrigger lets the host start the match, rolls one random Hunter (rest
  Hider), swaps Lobby -> Test Map (strictly serialized per NGO), respawns each
  player as its role variant. Forces additive client sync mode so clients keep
  Main instead of single-loading it (fixes "Destination scene is not valid").
- Server-driven spawning: null out NetworkConfig.PlayerPrefab at runtime to
  disable auto-spawn, then spawn players after the lobby floor exists (fixes
  falling through the floor) with double-spawn and transition guards.
- StartMatchTrigger: server-gated OnTriggerEnter, only the host's own player
  starts the match.
- NetworkBootstrap: drop role selection / connection approval; everyone spawns
  as the neutral Player prefab. Host/Client/Server/Shutdown buttons stay.
- NetworkPlayerSetup.ScopedModes flag (baked on Hunter/Hider prefabs): lobby
  avatar gets the full mode set, match variants get the role-scoped set.
- GameModeManager.BindLocalPlayer reads ScopedModes and rebinds the painter
  unconditionally (fixes stale painter binding on respawn -> brush painting in
  every mode).
- MeshPainter.PaintingEnabled defaults to false (unbound/pre-spawn/remote never
  paints); PaintHud visibility now also gates on a bound painter (fixes the HUD
  showing at startup before any avatar exists).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 22:44:18 +02:00