Files
RP412/RP_L4/RPL4CONSOLE.h
T
CydandClaude Fable 5 c66cb00a7e Network races: the local console marshals remote pods over the wire
The lobby-owner-as-console architecture, in-engine. RPL4CONSOLE gains
RPL4LocalConsole_InstallNetworkRace: the owner pod switches to network
mode and meshes like any pod (egg fed locally via FeedLocalEgg, which
now opens the ConsoleOnly state gate), while the console tick also
marshals REMOTE pods over NetTransport speaking the exact arcade
protocol - egg chunks with 5s-retry-until-ACK, 1Hz state polling,
RunMission once every pod stages at WaitingForLaunch, StopMission at
expiry (remotes first, local pod holds until their EndMission scores
land), score intake labeled with [pilots]-order names on the results
screen.

The front end builds the multi-pilot egg: RP412HOSTPODS lists member
console channels (lobby stand-in; the Steam lobby feeds the same
path), RP412HOSTPORT/RP412HOSTADDR set the owner side.

Winsock Connect now redials with a fresh socket per attempt (a refused
TCP socket is dead; the old loop reused it) bounded at 120s - needed
whenever a peer boots after the caller, which is the normal Steam
lobby launch order.

Verified on loopback: member pod in -net, owner hosting from its menu;
mesh completed both sides, 30s race, remote score collected over the
wire (host 3), local stop after the drain, results screen shows both
pilots by name in one process that returns to the menu.

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

58 lines
2.3 KiB
C

#pragma once
#include "..\munga\style.h"
//########################################################################
//########################## RPL4 Local Console ##########################
//########################################################################
//
// The single-player marshal. Hand-fed eggs are a developer shortcut: a
// mission only ends on a console command, so without one the timer hits
// 00:00 and just counts up forever. This is the in-process console for
// front-end-launched games - it watches the mission, dispatches the
// same StopMissionMessage TeslaConsole sent when the selected length
// expires, and when the pod returns to WaitingForEgg it brings the race
// setup back up and feeds the next egg (or quits if the player closes
// the menu).
//
// Installs itself as the application manager's per-frame hook.
//
void
RPL4LocalConsole_Install(int mission_seconds);
// True when the last mission ended under the console's control (timer
// stop or pilot exit). WinMain's single-binary race loop then cycles
// back to the setup screen for the next race in the same process.
Logical
RPL4LocalConsole_MissionCompleted();
// Network race: the owner pod meshes like any pod (network mode, egg
// fed locally) while this console marshals the REMOTE pods over the
// NetTransport wire with the arcade protocol - egg chunks + ACK,
// state polling, RunMission when everyone stages, StopMission at
// expiry, EndMission score intake. remote_pod_list is a comma list of
// console channels ("ip[:port]", default CONSOLE_NET_PORT);
// pilot_names is a comma list in [pilots] order for the results
// screen. Connects synchronously (retry, like the arcade console
// redialing a booting pod); False when a pod cannot be reached.
Logical
RPL4LocalConsole_InstallNetworkRace(
int mission_seconds,
const char *egg_path,
const char *remote_pod_list,
const char *pilot_names
);
// The last completed mission's final scores (what each pod reported at
// mission end). Valid until the next mission starts running.
int
RPL4LocalConsole_ResultCount();
Logical
RPL4LocalConsole_GetResult(int index, int *host_ID, int *score);
// Pilot name for a host ID ([pilots] order; host 2 = first pilot).
// NULL when unknown - the results screen falls back to pod numbers.
const char *
RPL4LocalConsole_GetResultName(int host_ID);