Frontend menu + settings + saves foundation

Netcode frontend pattern: UITK main menu / pause / settings (MenuUi + controllers), on-demand world lifecycle (WorldLauncher/SessionRunner), GameBootstrap menu branch; Graphics/Audio settings (SettingsService/GameVolume); single-slot save foundation (SaveData/SaveService, born-correct load at director spawn, autosave on Siege->Calm + quit); RuntimePanelSettings + theme; BuildTool menu; 10 EditMode tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-06 15:05:36 -07:00
parent f3f65bccbf
commit f31ffe910b
56 changed files with 1744 additions and 8 deletions
@@ -10,7 +10,7 @@ namespace ProjectM.Simulation
/// <para>
/// M4 (LAN co-op): auto-connect is DISABLED (<see cref="ClientServerBootstrap.AutoConnectPort"/> = 0).
/// Listening/connecting is driven explicitly via the <see cref="ConnectionConfig"/> singleton and the
/// per-world ConnectionControlSystems — from <c>ConnectionUI</c> (Host / Join + IP) in player builds,
/// per-world ConnectionControlSystems — from the UITK frontend menu (<c>MainMenuController</c> → <c>WorldLauncher</c>, Host / Join + IP) in player builds,
/// or from the editor-only <c>EditorAutoHostSystem</c>, which auto-hosts on loopback and connects the
/// in-proc client plus any Multiplayer-PlayMode-Tools thin clients. Direct IP/LAN only for now; Unity
/// Relay is deferred to a later pass.
@@ -21,10 +21,34 @@ namespace ProjectM.Simulation
{
public override bool Initialize(string defaultWorldName)
{
// No auto-connect: ConnectionConfig + the ConnectionControlSystems own listen/connect (M4).
// No auto-connect: the menu (or, in the editor, the auto-host system) owns listen/connect.
AutoConnectPort = 0;
CreateDefaultClientServerWorlds();
return true;
#if UNITY_EDITOR
// Editor: keep today's instant-into-game + MPPM loop by DEFAULT. Only the MAIN editor
// (ClientAndServer) with the "Boot Into Menu (Editor)" toggle ON takes the frontend path, so MPPM
// virtual players (Client) never boot to the menu. Open MainMenu.unity + Play to test the menu.
bool bootMenu = UnityEditor.EditorPrefs.GetBool("ProjectM.BootIntoMenu", false)
&& RequestedPlayType == PlayType.ClientAndServer;
if (!bootMenu)
{
CreateDefaultClientServerWorlds();
return true;
}
return false; // Frontend: Entities makes a single default "menu" world; MainMenuController drives sessions.
#else
// Player build: a dedicated/headless server auto-hosts; everyone else boots the front-end menu.
if (RequestedPlayType == PlayType.Server)
{
var server = CreateServerWorld("ServerWorld");
World.DefaultGameObjectInjectionWorld = server;
var em = server.EntityManager;
var e = em.CreateEntity();
em.AddComponentData(e, new ConnectionConfig { Mode = ConnectionMode.Host, Address = "0.0.0.0", Port = 7979, Requested = true });
return true;
}
return false; // Frontend menu (MainMenu.unity is build index 0).
#endif
}
}
}