Files
BT411/game/glass/btl4fe.hpp
T
CydandClaude Fable 5 f703bb1d56 Steam: the lobby + IDENTITY-TOKEN roster -- internet MP code-complete (step 4c)
NEW gated (BT_STEAM) game/glass/btl4lobby: an ISteamMatchmaking room replacing
the arcade Site-Management screen -- host creates (lobby data btl4=1), members
join by filter, pilots publish name/mech/color, the host ENTER mints the
roster and signals GO.

THE FAKEIP LESSON (live-verified, prior-art assumption DISPROVEN): a fresh
process gets a DIFFERENT FakeIP, so menu-time fake addresses go stale by
mission time -- the first cycle timed out connecting to its own stale address.
Redesign: roster addresses are opaque ipv4-shaped TOKENS (169.254.77.N with
ports 1501/1502) minted by the host at GO, mapped to Steam IDENTITIES;
connections ride ConnectP2P(identity, channel) with console=0/game=1 virtual
ports; the map reaches mission processes via env (BT_FE_MYFAKE +
BT_FE_STEAMMAP); the GetMyAddress seam feeds the pod its own token for roster
self-match; CheckSocket reports peers by token.  L4STEAMNET reworked (no
FakeIP allocation at all); the marshal gained the Steam-wire branch.

Verified single-machine (ON/ON, live Steam): menu -> HOST STEAM LOBBY ->
room -> GO -> token map minted -> egg roster carries the token -> mission
process up with 1 roster token incl. self -> pod self-matches -> stock
console ladder -> mission RUNS (46 ticks).  Remaining: the live 2-account
cross-machine session (docs/STEAM_TEST.md).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 00:03:17 -05:00

78 lines
2.4 KiB
C++

#pragma once
//###########################################################################
//
// btl4fe -- the miniconsole front end (BT_GLASS only): a developer-grade
// green-on-black GDI menu that composes a mission and self-launches it,
// replacing the (absent) operator console for desktop testing.
//
// Runs BEFORE any engine init (the zero-arg path in WinMain): presents the
// catalog menu, writes the console-shape mission egg (frontend.egg), and
// returns a launch spec; WinMain then RELAUNCHES this exe with the real
// arguments (the per-mission process-relaunch pattern -- reconstructed
// gBT* globals do not survive in-process re-init).
//
// The egg writer emits the FULL console egg shape validated against
// content/MP.EGG: [mission], [ordinals] + the 4 static rank bitmaps,
// [pilots] roster, per-pilot pages, GDI-rendered [largebitmap]/
// [smallbitmap] pilot-name plasma bitmaps, and the role model pages.
//
//###########################################################################
struct BTFePilot
{
char name[32];
char vehicle[16];
char color[16];
char address[64]; // ip:gamePort for the roster
};
struct BTFeMission
{
char map[16];
char time[16];
char weather[16];
int temperature;
int lengthSeconds;
int pilotCount;
BTFePilot pilots[8];
};
//
// Launch modes the menu can resolve to.
//
enum BTFeLaunchMode
{
BTFeLaunchNone = 0, // quit / window closed
BTFeLaunchSolo, // networked 1-pod mission (console marshal + self)
BTFeLaunchRawSolo, // plain -egg endless solo (renderer work)
BTFeLaunchHostLan, // marshal feeds self + remote pods
BTFeLaunchJoinLan, // plain -net pod; a remote host's marshal feeds us
BTFeLaunchHostSteam, // (BT_STEAM) lobby host: marshal over the Steam wire
BTFeLaunchJoinSteam // (BT_STEAM) lobby member: -net pod on the Steam wire
};
struct BTFeLaunchSpec
{
BTFeLaunchMode mode;
char eggPath[64]; // the written frontend.egg
int consolePort; // this instance's -net port
char podList[256]; // marshal targets (host modes)
int missionSeconds;
char steamMyToken[48]; // (BT_STEAM) my roster token ip
char steamMap[512]; // (BT_STEAM) ip=steamid64;...
};
//
// Write the console-shape egg for a mission. Returns 0 on success.
//
int
BTFeMission_WriteEgg(const BTFeMission *mission, const char *path);
//
// Run the menu (blocking, own message loop). Fills the spec; returns 0
// when a launch was chosen, nonzero for quit.
//
int
BTFrontEnd_Run(BTFeLaunchSpec *spec);