Files
BT412/game/reconstructed/btl4lobby.hpp
T
CydandClaude Opus 4.8 a2949166ea Net: Steam lobby (btl4lobby) + launch-mode wiring (Workstream C.2)
Port RP412's RPL4LOBBY to BT: an ISteamMatchmaking room stands in for the
arcade Site-Management screen. Compiled both gates -- stubs without
BT412_STEAM, the full room under it (both configs build + link clean).

Lobby (game/reconstructed/btl4lobby.*):
- Room screen (green-on-black, like the menu), owner = console.
- Member data: FakeIP + fake console/game ports + persona + mech/color/badge
  (ip/cp/gp/nm/vh/cl/bd keys).
- Nonced "go" launch roster -> SteamNetTransport_RegisterPeer for every peer.
- Push/PullRaceResults over lobby data rebuild the shared score sheet.

Front end (btl4fe.*): HOST/JOIN buttons when BTLobby_Available() (Steam
transport up); the menu loop exits on a steam action and BTFrontEnd_Run
routes the lobby outcome -- host builds the egg with every member as a
[pilots] mesh entry (BTFrontEnd_SetHostedPilots), member returns launch
mode 2. Results screen prefers the marshal's collated result names.

Marshal (btl4console.*): add GetResultName / ClearResults / InjectResult so
the lobby owner can refill the sheet from the collated wire scores; Result
gains a name field.

WinMain (btl4main.cpp): install the Steam transport on BT412STEAM env
(before the front end, so the lobby is offered); branch on
BTFrontEnd_LastLaunchMode() -- host owns the marshal clock + joins the mesh,
member enters as a network pod on :1501 (SetNetworkCommonFlatAddress +
gConsoleLossEndsMission); Push (host) / Pull (member) results, then relaunch.

CMake: btl4lobby.cpp joins bt410_l4; that lib gets BT412_STEAM + the
Steamworks include under the gate. build-steam/ gitignored.

Deferred (untestable here -- needs Steam + multiple machines): the
host->member wire egg-feed marshal (InstallNetworkRace); a member currently
waits for a console connection nothing supplies, so a live host+member race
is blocked on it. The lobby object does not survive the per-mission
relaunch. docs/STEAM-3-MACHINE-TEST.md for BT not yet authored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-16 23:18:36 -05:00

46 lines
2.0 KiB
C++

//===========================================================================//
// btl4lobby.hpp -- BT412 Steam lobby (the internet-multiplayer front door).
//
// An ISteamMatchmaking lobby stands in for the arcade's Site Management screen
// (see context/steamification.md). Every member publishes its FakeIP + fake
// console/game ports + persona + loadout (mech/color/badge) as lobby member
// data; the lobby OWNER is the console. Launching writes a "go" roster into
// lobby data -- each pod registers every peer with the Steam transport and
// enters the race: the owner through the hosted-race marshal (it builds the
// egg and marshals the members over the wire), the members as network pods
// waiting for the owner's console connection. The lobby OBJECT outlives races
// (the single-binary payoff -- after a race everyone lands back in the room).
//
// Compiled to stubs without BT412_STEAM (single-player + LAN -net unaffected).
//===========================================================================//
#ifndef BTL4LOBBY_HPP
#define BTL4LOBBY_HPP
enum BTLobbyOutcome
{
LobbyRoomLeft = 0, // player left the lobby -> back to the menu
LobbyRoomClosed, // window went away -> quit
LobbyLaunchHost, // owner launched: hosted-race path is primed
LobbyLaunchMember // owner launched: enter the race as a network pod
};
// True when the Steam transport is up (the lobby UI is offered in the menu).
int BTLobby_Available();
// True while we sit in a lobby (races return to the room).
int BTLobby_InRoom();
// Create a lobby / find-and-join one, then run the room screen.
int BTLobby_Host(void *instance, void *main_window);
int BTLobby_Join(void *instance, void *main_window);
// Re-enter the room of the lobby we are already in (post-race).
int BTLobby_Room(void *instance, void *main_window);
// Post-race score sheet: the owner publishes its console's results into lobby
// data; members pull them so the same results screen shows everywhere.
void BTLobby_PushRaceResults();
void BTLobby_PullRaceResults();
#endif // BTL4LOBBY_HPP