Files
Project-M/Assets/_Project/Scripts/Simulation/GameBootstrap.cs
T
Luis Gonzalez e851d5f8e9 Co-Op Layer
2026-06-01 10:48:18 -07:00

31 lines
1.3 KiB
C#

using Unity.Entities;
using Unity.NetCode;
using UnityEngine.Scripting;
namespace ProjectM.Simulation
{
/// <summary>
/// Custom Netcode for Entities bootstrap. Subclassing <see cref="ClientServerBootstrap"/> gives an
/// explicit hook to customize world creation, tick rate, and connection.
/// <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,
/// 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.
/// </para>
/// </summary>
[Preserve]
public class GameBootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
// No auto-connect: ConnectionConfig + the ConnectionControlSystems own listen/connect (M4).
AutoConnectPort = 0;
CreateDefaultClientServerWorlds();
return true;
}
}
}