Hello,
I’m working on a multiplayer game in Unreal Engine 5 using Blueprints, and I’m aiming to implement a round-based system similar to CS:GO. Here’s what I’m trying to achieve:
System Overview:
- Rounds:
- The game consists of a 3-round cycle. Players stay on the same team for all 3 rounds.
- At the end of the 3-round cycle, the game resets, and all players can select their teams again.
- Team Selection:
- When a player joins the game:
- If the game is in the “Waiting to Start” phase, the player selects a team and spawns immediately.
- If the game is in progress, the player selects a team but doesn’t spawn. Instead, they remain in spectator mode until the next round starts.
- Round Transition:
- At the end of each round:
- All players (including new ones) spawn at their team-specific spawn points.
- The round state and game logic reset for the next round.
- At the end of the 3rd round:
- The game resets completely (scores, team IDs, etc.), and all players can re-select their teams for a new cycle.
Challenges:
- Respawning Players:
- How can I cleanly reset and respawn all players at the end of each round without using
ServerTravel
? - How should I manage the transition logic between rounds while ensuring proper cleanup of actors and resetting the game environment?
- Team Selection for New Players:
- How can I prevent new players from spawning mid-round while still allowing them to select a team and spawn at the start of the next round?
- Resetting Team IDs:
- What is the best way to reset the team IDs and associated logic at the end of the 3-round cycle?
Current Setup:
- Team System:
- Each player has a
TeamID
variable stored in theirPlayerState
. - Team selection is handled by a widget in the
PlayerController
, which triggers a spawn function in theGameMode
.
- Each player has a
- GameState and Round Management:
- The
GameState
has an enumRoundState
(WaitingToStart
,InProgress
,RoundEnd
,GameEnd
). - A replicated function (
SetRoundState
) updates the round state and triggers appropriate logic.
- The
- Spawn System:
- The
GameMode
has aSpawnPlayer
function that spawns players at team-specific spawn points based on theirTeamID
.
- The
Questions:
- How should I structure the Blueprint logic to manage round transitions (e.g., resetting states, respawning players, etc.)?
- What’s the best way to allow new players to select a team and integrate them into the game at the start of the next round?
- How can I reset the game properly at the end of the 3-round cycle (team IDs, scores, etc.)?
Any guidance, tips, or examples would be greatly appreciated. Thanks in advance!