@@ -19,12 +19,13 @@ import (
1919// The server resolves Preset against lobby.Config.LobbyPresets and
2020// rejects unknown or empty preset labels. Clients cannot supply
2121// arbitrary team configuration; the server is the source of truth.
22+ //
23+ // The target game shard is not specified here: it is assigned later by
24+ // an external orchestrator via AssignShardCommand when the session starts.
2225type CreateLobbyCommand struct {
2326 RequestID string `json:"request_id"` // For matching request/response
2427 // Preset is the label of a server-registered team configuration.
2528 Preset string `json:"preset"`
26- // GameWorld is the target game shard address for this lobby.
27- GameWorld cardinal.OtherWorld `json:"game_world"`
2829 // PlayerPassthroughData is custom data for the creating player, forwarded to game shard.
2930 PlayerPassthroughData map [string ]any `json:"player_passthrough_data,omitempty"`
3031 // SessionPassthroughData is custom data for the lobby session, forwarded to game shard.
@@ -490,8 +491,9 @@ func (r GetLobbyResult) Name() string {
490491
491492// NotifySessionStartCommand is sent to game shard when a session starts.
492493type NotifySessionStartCommand struct {
493- Lobby component.LobbyComponent `json:"lobby"`
494- LobbyWorld cardinal.OtherWorld `json:"lobby_world"`
494+ Lobby component.LobbyComponent `json:"lobby"`
495+ LobbyWorld cardinal.OtherWorld `json:"lobby_world"`
496+ Players []component.PlayerComponent `json:"players"`
495497}
496498
497499// Name returns the command name.
@@ -1122,7 +1124,6 @@ func processCreateLobbyCommands(
11221124 ID : lobbyID ,
11231125 LeaderID : playerID ,
11241126 InviteCode : "" , // Will be set after generation
1125- GameWorld : payload .GameWorld ,
11261127 Session : component.Session {
11271128 State : component .SessionStateIdle ,
11281129 PassthroughData : payload .SessionPassthroughData ,
@@ -1868,15 +1869,18 @@ func abortAwaitingAllocation(
18681869// configured on the lobby. No-op if no game shard is configured.
18691870func dispatchSessionStart (
18701871 state * LobbySystemState ,
1872+ lobbyIndex * component.LobbyIndexComponent ,
18711873 config * component.ConfigComponent ,
18721874 lobby * component.LobbyComponent ,
18731875 lobbyID string ,
18741876) {
18751877 gameWorld := lobby .GameWorld
18761878 lobbyWorld := config .LobbyWorld
1879+ players := gatherLobbyPlayers (state , lobbyIndex , lobby )
18771880 gameWorld .SendCommand (& state .BaseSystemState , NotifySessionStartCommand {
18781881 Lobby : * lobby ,
18791882 LobbyWorld : lobbyWorld ,
1883+ Players : players ,
18801884 })
18811885 state .Logger ().Info ().
18821886 Str ("lobby_id" , lobbyID ).
@@ -1963,7 +1967,7 @@ func processAssignShardCommands(
19631967 GameWorld : lobby .GameWorld ,
19641968 })
19651969
1966- dispatchSessionStart (state , config , & lobby , payload .LobbyID )
1970+ dispatchSessionStart (state , lobbyIndex , config , & lobby , payload .LobbyID )
19671971
19681972 state .StartSessionResults .Emit (StartSessionResult {
19691973 RequestID : requestID ,
@@ -2031,6 +2035,11 @@ func processNotifySessionEndCommands(state *LobbySystemState, lobbyIndex *compon
20312035 playerComp := playerEntity .Player .Get ()
20322036 playerComp .IsReady = false
20332037 playerEntity .Player .Set (playerComp )
2038+
2039+ state .PlayerReadyEvents .Emit (PlayerReadyEvent {
2040+ LobbyID : payload .LobbyID ,
2041+ Player : playerComp ,
2042+ })
20342043 }
20352044
20362045 state .Logger ().Info ().
0 commit comments