feat: simplified local-space and celestial, removed bubbles
This commit is contained in:
@@ -13,10 +13,7 @@ public sealed partial class ScenarioLoader
|
||||
private const float MinimumShipyardStock = 0f;
|
||||
private const float MinimumSystemSeparation = 3.2f;
|
||||
private const float StarBubbleRadiusPadding = 40f;
|
||||
private const float PlanetBubbleRadiusPadding = 80f;
|
||||
private const float MoonBubbleRadiusPadding = 40f;
|
||||
private const float LagrangeBubbleRadius = 150f;
|
||||
private const float ResourceBubbleRadius = 120f;
|
||||
private const float LocalSpaceRadius = 10_000f;
|
||||
private static readonly string[] GeneratedSystemNames =
|
||||
[
|
||||
"Aquila Verge",
|
||||
@@ -121,14 +118,12 @@ public sealed partial class ScenarioLoader
|
||||
(system) => BuildSystemSpatialGraph(system),
|
||||
StringComparer.Ordinal);
|
||||
|
||||
var celestials = new List<CelestialRuntime>();
|
||||
var nodes = new List<ResourceNodeRuntime>();
|
||||
var spatialNodes = new List<NodeRuntime>();
|
||||
var localBubbles = new List<LocalBubbleRuntime>();
|
||||
var nodeIdCounter = 0;
|
||||
foreach (var graph in systemGraphs.Values)
|
||||
{
|
||||
spatialNodes.AddRange(graph.Nodes);
|
||||
localBubbles.AddRange(graph.Bubbles);
|
||||
celestials.AddRange(graph.Celestials);
|
||||
}
|
||||
|
||||
foreach (var system in systemRuntimes)
|
||||
@@ -136,15 +131,15 @@ public sealed partial class ScenarioLoader
|
||||
var systemGraph = systemGraphs[system.Definition.Id];
|
||||
foreach (var node in system.Definition.ResourceNodes)
|
||||
{
|
||||
var anchorNode = ResolveResourceNodeAnchor(systemGraph, node);
|
||||
var anchorCelestial = ResolveResourceNodeAnchor(systemGraph, node);
|
||||
var resourceNode = new ResourceNodeRuntime
|
||||
{
|
||||
Id = $"node-{++nodeIdCounter}",
|
||||
SystemId = system.Definition.Id,
|
||||
Position = ComputeResourceNodePosition(anchorNode, node, balance.YPlane),
|
||||
Position = ComputeResourceNodePosition(anchorCelestial, node, balance.YPlane),
|
||||
SourceKind = node.SourceKind,
|
||||
ItemId = node.ItemId,
|
||||
AnchorNodeId = anchorNode?.Id,
|
||||
CelestialId = anchorCelestial?.Id,
|
||||
OrbitRadius = node.RadiusOffset,
|
||||
OrbitPhase = node.Angle,
|
||||
OrbitInclination = DegreesToRadians(node.InclinationDegrees),
|
||||
@@ -153,23 +148,6 @@ public sealed partial class ScenarioLoader
|
||||
};
|
||||
|
||||
nodes.Add(resourceNode);
|
||||
var bubbleId = $"bubble-{resourceNode.Id}";
|
||||
spatialNodes.Add(new NodeRuntime
|
||||
{
|
||||
Id = resourceNode.Id,
|
||||
SystemId = resourceNode.SystemId,
|
||||
Kind = SpatialNodeKind.ResourceSite,
|
||||
Position = resourceNode.Position,
|
||||
BubbleId = bubbleId,
|
||||
ParentNodeId = anchorNode?.Id,
|
||||
});
|
||||
localBubbles.Add(new LocalBubbleRuntime
|
||||
{
|
||||
Id = bubbleId,
|
||||
NodeId = resourceNode.Id,
|
||||
SystemId = resourceNode.SystemId,
|
||||
Radius = ResourceBubbleRadius,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +160,7 @@ public sealed partial class ScenarioLoader
|
||||
continue;
|
||||
}
|
||||
|
||||
var placement = ResolveStationPlacement(plan, system, systemGraphs[system.Definition.Id], spatialNodes);
|
||||
var placement = ResolveStationPlacement(plan, system, systemGraphs[system.Definition.Id], celestials);
|
||||
var station = new StationRuntime
|
||||
{
|
||||
Id = $"station-{++stationIdCounter}",
|
||||
@@ -193,31 +171,9 @@ public sealed partial class ScenarioLoader
|
||||
FactionId = plan.FactionId ?? DefaultFactionId,
|
||||
};
|
||||
|
||||
var stationNodeId = $"node-{station.Id}";
|
||||
var stationBubbleId = $"bubble-{station.Id}";
|
||||
station.NodeId = stationNodeId;
|
||||
station.BubbleId = stationBubbleId;
|
||||
station.AnchorNodeId = placement.AnchorNode.Id;
|
||||
station.CelestialId = placement.AnchorCelestial.Id;
|
||||
stations.Add(station);
|
||||
spatialNodes.Add(new NodeRuntime
|
||||
{
|
||||
Id = stationNodeId,
|
||||
SystemId = station.SystemId,
|
||||
Kind = SpatialNodeKind.Station,
|
||||
Position = station.Position,
|
||||
BubbleId = stationBubbleId,
|
||||
ParentNodeId = placement.AnchorNode.Id,
|
||||
OccupyingStructureId = station.Id,
|
||||
});
|
||||
localBubbles.Add(new LocalBubbleRuntime
|
||||
{
|
||||
Id = stationBubbleId,
|
||||
NodeId = stationNodeId,
|
||||
SystemId = station.SystemId,
|
||||
Radius = MathF.Max(160f, GetStationRadius(moduleDefinitions, station) + 60f),
|
||||
});
|
||||
localBubbles[^1].OccupantStationIds.Add(station.Id);
|
||||
placement.AnchorNode.OccupyingStructureId = station.Id;
|
||||
placement.AnchorCelestial.OccupyingStructureId = station.Id;
|
||||
|
||||
var startingModules = plan.StartingModules.Count > 0
|
||||
? plan.StartingModules
|
||||
@@ -274,7 +230,7 @@ public sealed partial class ScenarioLoader
|
||||
FactionId = formation.FactionId ?? DefaultFactionId,
|
||||
Position = position,
|
||||
TargetPosition = position,
|
||||
SpatialState = CreateInitialShipSpatialState(formation.SystemId, position, spatialNodes),
|
||||
SpatialState = CreateInitialShipSpatialState(formation.SystemId, position, celestials),
|
||||
DefaultBehavior = CreateBehavior(definition, formation.SystemId, scenario, patrolRoutes, refinery),
|
||||
ControllerTask = new ControllerTaskRuntime { Kind = ControllerTaskKind.Idle, Threshold = balance.ArrivalThreshold, Status = WorkStatus.Pending },
|
||||
Health = definition.MaxHealth,
|
||||
@@ -287,8 +243,8 @@ public sealed partial class ScenarioLoader
|
||||
var policies = CreatePolicies(factions);
|
||||
var commanders = CreateCommanders(factions, stations, shipsRuntime);
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
var claims = CreateClaims(stations, spatialNodes, now);
|
||||
var (constructionSites, marketOrders) = CreateConstructionSites(stations, claims, spatialNodes, moduleRecipeDefinitions);
|
||||
var claims = CreateClaims(stations, celestials, now);
|
||||
var (constructionSites, marketOrders) = CreateConstructionSites(stations, claims, moduleRecipeDefinitions);
|
||||
|
||||
return new SimulationWorld
|
||||
{
|
||||
@@ -296,9 +252,8 @@ public sealed partial class ScenarioLoader
|
||||
Seed = WorldSeed,
|
||||
Balance = balance,
|
||||
Systems = systemRuntimes,
|
||||
Celestials = celestials,
|
||||
Nodes = nodes,
|
||||
SpatialNodes = spatialNodes,
|
||||
LocalBubbles = localBubbles,
|
||||
Stations = stations,
|
||||
Ships = shipsRuntime,
|
||||
Factions = factions,
|
||||
|
||||
Reference in New Issue
Block a user