Zum Inhalt

Vor langer langer Zeit hat sich Bad King Urgrain dazu gemacht, für Garry's Mod einen Spielmodus zu erstellen, welcher sich "Trouble in Terroristtown" nannte. Ich versuche nun das Projekt in Unreal Engine 5 aufzubauen.

Der Gameplayloop

graph TD
subgraph Main
checkMinPlayers[Check for min ammount of players] -- Not enough players --> checkMinPlayers
checkMinPlayers -- Enough Players -----> Spawn
Spawn[Spawn Players] --> getWeapons[Get all Weaponspawn Positions]
getWeapons --> Weapons[Spawn Weapons with respective config]
Weapons -->|Wait for 'RoundStartTime'| getPlayers[Get all players]
getPlayers --> funRoleselector[Role Selection Function]
play{play Round} --> endRound
end

subgraph funRoleSelector
getAllPlayers[Get all PlayerStates] --> getAllRoles[Get all RoleTeams]
getAllRoles --> forEachRole[For each role] -- Complete Role --> fallbackCheck
forEachRole -- For Role --> checkPlayers[Loop all Players and check if has role]
checkPlayers -- complete Players--> forEachRole
checkPlayers -- For Player --> checkHasRole{has Role?} -- No --> checkRolePercentage{Check the \npercentage\nof the role}
checkRolePercentage -- more than Percentage --> addRole --> checkPlayers
checkRolePercentage -- less than Percentage --> checkPlayers
checkHasRole -- yes --> checkPlayers

fallbackCheck -----> play
end



funRoleselector --> getAllPlayers