Retire the prelude and the tutorial: the cast, the scenario and the save own what they bundled
Galaxy.IsPrelude, SavedGame.IsTutorial (key 11 retired), TutorialGalaxy, TutorialGenerationSettings, its Settings.asset block and the
dead GalaxyStage/Galaxy constructor parameters (PlayerSettings, narrative directory) are gone. The rules they bundled move to their
owners: GalaxyCast.InfluenceScale (demo and test cast .5, main 1) carried by Galaxy and saved as SavedGame key 17, so a pre-cut run is
refused at Continue with a message; Scenario.EntranceStation (MainGalaxy false) decides the forced entrance station instead of the
galaxy; GalaxyStage.Cast(cast) replaces Prelude. The six arenas that read the authored cast generate DemoTerminus.Cast; Development
lists only Main Galaxy. TutorialBackgroundSettings is renamed CastBackgroundSettings in the asset YAML. Tests build their galaxy from
TestCasts.Wide and Background, the retired block's values, so every test galaxy is unchanged.
Suite at 8b2d1f544: 4 red (font credits, chunk info, trojan swarm, two-ai digest, Windows). After: the same 4, digest unchanged.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b2d1f5442
commit
40a5457c9e
54 changed files with 334 additions and 321 deletions
|
|
@ -26,7 +26,10 @@ public class Galaxy
|
|||
public GalaxyZone Exit { get; private set; }
|
||||
public Dictionary<Faction, FactionRelationship> FactionRelationships { get; } = new Dictionary<Faction, FactionRelationship>();
|
||||
private Action<string> Log { get; }
|
||||
public bool IsPrelude { get; }
|
||||
|
||||
// How far each faction's authored InfluenceDistance reaches in this galaxy (InfluenceOf): the cast's InfluenceScale,
|
||||
// 1 for a main galaxy. Carried by the save because every zone generated after Continue reads it.
|
||||
public float InfluenceScale { get; }
|
||||
|
||||
// The run's seed, minted once by GalaxyStage.SeedFrom and carried by the save (SavedGame.Seed). It seeds
|
||||
// generation, the run's item draws (RunStart) and the zone's drop dice (Zone.DropSeed).
|
||||
|
|
@ -51,7 +54,9 @@ public class Galaxy
|
|||
|
||||
public Galaxy(CultCache cultCache, SavedGame savedGame, Action<string> log)
|
||||
{
|
||||
IsPrelude = savedGame.IsTutorial;
|
||||
InfluenceScale = savedGame.InfluenceScale > 0
|
||||
? savedGame.InfluenceScale
|
||||
: throw new InvalidOperationException($"the save has no {nameof(InfluenceScale)} ({savedGame.InfluenceScale}); a run saved before InfluenceScale existed cannot be continued");
|
||||
_cache = cultCache;
|
||||
Log = log;
|
||||
Background = savedGame.Background;
|
||||
|
|
@ -112,7 +117,7 @@ public class Galaxy
|
|||
uint seed)
|
||||
{
|
||||
_cache = cache;
|
||||
IsPrelude = false;
|
||||
InfluenceScale = 1;
|
||||
Background = background;
|
||||
Log = log;
|
||||
var factions = cache.GetAll<Faction>();
|
||||
|
|
@ -186,11 +191,11 @@ public class Galaxy
|
|||
return _cache.GetAll<Faction>().FirstOrDefault(f => f.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
}
|
||||
|
||||
// A cast member of a prelude galaxy, by name. A name the catalog does not hold refuses the galaxy, naming the field.
|
||||
// A cast member of a cast galaxy, by name. A name the catalog does not hold refuses the galaxy, naming the field.
|
||||
private Faction ResolveCast(string field, string name) =>
|
||||
ResolveFaction(name) ?? throw new InvalidOperationException($"cast faction {name} ({field}) is not in the catalog");
|
||||
|
||||
// Gives a prelude galaxy its gate: the antagonist's home is the boss zone and the exit. The only writer of Exit
|
||||
// Gives a cast galaxy its gate: the antagonist's home is the boss zone and the exit. The only writer of Exit
|
||||
// besides the constructors.
|
||||
public void PlaceGate(Faction antagonist)
|
||||
{
|
||||
|
|
@ -198,23 +203,24 @@ public class Galaxy
|
|||
Exit = HomeZones[antagonist];
|
||||
}
|
||||
|
||||
// How many jumps a faction's influence reaches in this galaxy: its authored distance, halved (rounding up) in a
|
||||
// prelude. Derived, never written back to the catalog's Faction, so one galaxy's generation cannot change the next.
|
||||
// How many jumps a faction's influence reaches in this galaxy: its authored distance scaled by the galaxy's
|
||||
// InfluenceScale (the cast decides the scale), rounding up. Derived, never written back to the catalog's Faction,
|
||||
// so one galaxy's generation cannot change the next.
|
||||
public int InfluenceOf(Faction faction) =>
|
||||
IsPrelude ? (faction.InfluenceDistance + 1) / 2 : faction.InfluenceDistance;
|
||||
(int) MathF.Ceiling(faction.InfluenceDistance * InfluenceScale);
|
||||
|
||||
public Galaxy(
|
||||
TutorialGenerationSettings settings,
|
||||
GalaxyCast cast,
|
||||
SectorBackgroundSettings background,
|
||||
CultCache cache,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
Action<string> log,
|
||||
Action<string> progressCallback,
|
||||
uint seed)
|
||||
{
|
||||
_cache = cache;
|
||||
IsPrelude = true;
|
||||
InfluenceScale = cast.InfluenceScale > 0
|
||||
? cast.InfluenceScale
|
||||
: throw new InvalidOperationException($"the cast's {nameof(cast.InfluenceScale)} must be positive, got {cast.InfluenceScale}");
|
||||
|
||||
Background = background;
|
||||
Log = log;
|
||||
|
|
@ -223,32 +229,32 @@ public class Galaxy
|
|||
|
||||
var factions = new List<Faction>();
|
||||
|
||||
var protagonistFaction = ResolveCast(nameof(settings.ProtagonistFaction), settings.ProtagonistFaction);
|
||||
var protagonistFaction = ResolveCast(nameof(cast.ProtagonistFaction), cast.ProtagonistFaction);
|
||||
factions.Add(protagonistFaction);
|
||||
|
||||
var antagonistFaction = ResolveCast(nameof(settings.AntagonistFaction), settings.AntagonistFaction);
|
||||
var antagonistFaction = ResolveCast(nameof(cast.AntagonistFaction), cast.AntagonistFaction);
|
||||
factions.Add(antagonistFaction);
|
||||
|
||||
var bufferFaction = ResolveCast(nameof(settings.BufferFaction), settings.BufferFaction);
|
||||
var bufferFaction = ResolveCast(nameof(cast.BufferFaction), cast.BufferFaction);
|
||||
factions.Add(bufferFaction);
|
||||
|
||||
// A cast without a quest faction places no quest zone.
|
||||
var questFaction = string.IsNullOrEmpty(settings.QuestFaction)
|
||||
var questFaction = string.IsNullOrEmpty(cast.QuestFaction)
|
||||
? null
|
||||
: ResolveCast(nameof(settings.QuestFaction), settings.QuestFaction);
|
||||
: ResolveCast(nameof(cast.QuestFaction), cast.QuestFaction);
|
||||
if (questFaction != null) factions.Add(questFaction);
|
||||
|
||||
var neutralFactions = settings.NeutralFactions
|
||||
.Select(name => ResolveCast(nameof(settings.NeutralFactions), name))
|
||||
var neutralFactions = cast.NeutralFactions
|
||||
.Select(name => ResolveCast(nameof(cast.NeutralFactions), name))
|
||||
.ToArray();
|
||||
factions.AddRange(neutralFactions);
|
||||
|
||||
Factions = factions.ToArray();
|
||||
foreach (var faction in Factions) FactionRelationships[faction] = FactionRelationship.Neutral;
|
||||
|
||||
Zones = GenerateZones(settings.ZoneCount, ref random, progressCallback);
|
||||
Zones = GenerateZones(cast.ZoneCount, ref random, progressCallback);
|
||||
|
||||
GenerateLinks(settings.LinkDensity, progressCallback);
|
||||
GenerateLinks(cast.LinkDensity, progressCallback);
|
||||
|
||||
CalculateDistanceMatrix(progressCallback);
|
||||
|
||||
|
|
@ -302,15 +308,11 @@ public class Galaxy
|
|||
|
||||
CalculateFactionInfluence(progressCallback);
|
||||
|
||||
// No boss zone and no Exit yet (PlaceGate comes after): the prelude is one region.
|
||||
BuildProvinces(settings.ProvinceZones);
|
||||
// No boss zone and no Exit yet (PlaceGate comes after): a cast galaxy is one region.
|
||||
BuildProvinces(cast.ProvinceZones);
|
||||
|
||||
NamePlaces(ref random, progressCallback);
|
||||
|
||||
// progressCallback?.Invoke("Weaving Narrative");
|
||||
// var processor = new StoryProcessor(playerSettings, narrativeDirectory, this, ref random, Log);
|
||||
// processor.ProcessStories();
|
||||
|
||||
progressCallback?.Invoke("Done!");
|
||||
if(progressCallback!=null) Thread.Sleep(500); // Inserting Delay to make it seem like it's doing more work lmao
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
using static CultMath.math;
|
||||
|
|
@ -13,11 +12,8 @@ public sealed class GalaxyStage
|
|||
{
|
||||
private readonly SectorGenerationSettings _sector;
|
||||
private readonly SectorBackgroundSettings _sectorBackground;
|
||||
private readonly TutorialGenerationSettings _prelude;
|
||||
private readonly SectorBackgroundSettings _preludeBackground;
|
||||
private readonly SectorBackgroundSettings _castBackground;
|
||||
private readonly CultCache _cache;
|
||||
private readonly PlayerSettings _playerSettings;
|
||||
private readonly DirectoryInfo _narrativeDirectory;
|
||||
private readonly Action<string> _log;
|
||||
private readonly Action<string> _progress;
|
||||
private readonly Func<uint> _clock;
|
||||
|
|
@ -25,22 +21,16 @@ public sealed class GalaxyStage
|
|||
public GalaxyStage(
|
||||
SectorGenerationSettings sector,
|
||||
SectorBackgroundSettings sectorBackground,
|
||||
TutorialGenerationSettings prelude,
|
||||
SectorBackgroundSettings preludeBackground,
|
||||
SectorBackgroundSettings castBackground,
|
||||
CultCache cache,
|
||||
PlayerSettings playerSettings,
|
||||
DirectoryInfo narrativeDirectory,
|
||||
Action<string> log,
|
||||
Action<string> progress = null,
|
||||
Func<uint> clock = null)
|
||||
{
|
||||
_sector = sector;
|
||||
_sectorBackground = sectorBackground;
|
||||
_prelude = prelude;
|
||||
_preludeBackground = preludeBackground;
|
||||
_castBackground = castBackground;
|
||||
_cache = cache;
|
||||
_playerSettings = playerSettings;
|
||||
_narrativeDirectory = narrativeDirectory;
|
||||
_log = log;
|
||||
_progress = progress;
|
||||
_clock = clock ?? (() => (uint) (DateTime.Now.Ticks % uint.MaxValue));
|
||||
|
|
@ -65,13 +55,10 @@ public sealed class GalaxyStage
|
|||
return new Galaxy(_sector, background, _cache, _log, _progress, Seed);
|
||||
}
|
||||
|
||||
// A prelude galaxy: the tutorial settings and their fixed factions, centred in dense cloud.
|
||||
public Galaxy Prelude() => Prelude(_prelude);
|
||||
|
||||
// A prelude galaxy of the given fixed cast, centred in dense cloud.
|
||||
public Galaxy Prelude(TutorialGenerationSettings cast)
|
||||
// A galaxy of the given fixed cast, centred in dense cloud.
|
||||
public Galaxy Cast(GalaxyCast cast)
|
||||
{
|
||||
var background = Copy(_preludeBackground);
|
||||
var background = Copy(_castBackground);
|
||||
var random = new Random(Seed);
|
||||
var iteration = 1;
|
||||
do
|
||||
|
|
@ -79,7 +66,7 @@ public sealed class GalaxyStage
|
|||
background.NoisePosition = random.NextFloat() * 1000;
|
||||
_progress?.Invoke($"Finding Galaxy Position: iteration {iteration++}");
|
||||
} while (background.CloudDensity(float2(.5f)) < .5f);
|
||||
return new Galaxy(cast, background, _cache, _playerSettings, _narrativeDirectory, _log, _progress, Seed);
|
||||
return new Galaxy(cast, background, _cache, _log, _progress, Seed);
|
||||
}
|
||||
|
||||
private static SectorBackgroundSettings Copy(SectorBackgroundSettings settings) =>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public static class RunStart
|
|||
{
|
||||
SeedItems(itemManager, galaxy, ArenaStep);
|
||||
return galaxy.Entrance.PackedContents = ZoneGenerator.GenerateZone(
|
||||
itemManager, zoneSettings, planetSettings, galaxy, galaxy.Entrance, galaxy.IsPrelude, scenario.Ambient);
|
||||
itemManager, zoneSettings, planetSettings, galaxy, galaxy.Entrance, scenario.EntranceStation, scenario.Ambient);
|
||||
}
|
||||
|
||||
// Runs a start and answers whether it produced a run: null, with the reason in `failures`, when `start` throws or
|
||||
|
|
@ -49,10 +49,10 @@ public static class RunStart
|
|||
// with the player, a pilot for each piloted one. Returns null, with every failure listed and the arena unchanged,
|
||||
// unless the whole scenario staged.
|
||||
public static Staged Stage(ItemManager itemManager, Zone arena, Scenario scenario, string startingHull,
|
||||
TutorialGenerationSettings tutorialGenerationSettings, List<string> failures)
|
||||
List<string> failures)
|
||||
{
|
||||
SeedItems(itemManager, arena.Galaxy, StageStep);
|
||||
var stage = new ScenarioStage(itemManager, arena, startingHull, tutorialGenerationSettings);
|
||||
var stage = new ScenarioStage(itemManager, arena, startingHull);
|
||||
scenario.Stage(stage);
|
||||
var reported = failures.Count;
|
||||
failures.AddRange(stage.Failures);
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ public class SavedGame
|
|||
[Key(10)]
|
||||
public SavedActionBarBinding[] ActionBarBindings;
|
||||
|
||||
[Key(11)]
|
||||
public bool IsTutorial;
|
||||
// Key(11): retired, do not reuse (a retired run-mode flag)
|
||||
|
||||
// Read only by a save written before Standings: its entries follow galaxy.Factions order, not Factions order, so
|
||||
// Galaxy trusts it only when the two orders cannot differ (see Galaxy's save constructor).
|
||||
|
|
@ -68,6 +67,11 @@ public class SavedGame
|
|||
// null in a save written before it, which then reads Relationships.
|
||||
[Key(16)]
|
||||
public List<SavedStanding> Standings;
|
||||
|
||||
// Galaxy.InfluenceScale: every zone generated after Continue reads it (ZoneGenerator's factionPresence). Written only
|
||||
// by RunSave.Capture and read only by Galaxy's save constructor, which refuses a save without one (0).
|
||||
[Key(17)]
|
||||
public float InfluenceScale;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
|
|
@ -122,7 +126,7 @@ public static class RunSave
|
|||
CurrentZoneEntity = currentZone.Entities.IndexOf(currentEntity),
|
||||
Entrance = Array.IndexOf(galaxy.Zones, galaxy.Entrance),
|
||||
Exit = Array.IndexOf(galaxy.Zones, galaxy.Exit),
|
||||
IsTutorial = galaxy.IsPrelude,
|
||||
InfluenceScale = galaxy.InfluenceScale,
|
||||
ActionBarBindings = actionBar,
|
||||
Credits = credits,
|
||||
Seed = galaxy.Seed
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@ public abstract class Scenario
|
|||
// the scenario's conditions.
|
||||
public virtual bool Ambient => true;
|
||||
|
||||
// Which galaxy the run is in: stage.Main() or stage.Prelude().
|
||||
// True: the arena's zone always gets a generated faction station with a docking bay, whatever its seed rolls
|
||||
// (ZoneGenerator). False: its stations are rolled like any other zone's.
|
||||
public virtual bool EntranceStation => true;
|
||||
|
||||
// Which galaxy the run is in: stage.Main() or stage.Cast(cast).
|
||||
public abstract Galaxy Generate(GalaxyStage stage);
|
||||
|
||||
// What the run starts with: exactly one stage.Player, and anything else the scenario places.
|
||||
|
|
|
|||
|
|
@ -23,12 +23,11 @@ public sealed class ScenarioStage
|
|||
private readonly HashSet<Entity> _fitted = new HashSet<Entity>();
|
||||
private readonly HashSet<Entity> _cargoAuthored = new HashSet<Entity>();
|
||||
|
||||
internal ScenarioStage(ItemManager items, Zone arena, string startingHull, TutorialGenerationSettings tutorialGenerationSettings)
|
||||
internal ScenarioStage(ItemManager items, Zone arena, string startingHull)
|
||||
{
|
||||
_items = items;
|
||||
Arena = arena;
|
||||
StartingHull = startingHull;
|
||||
TutorialGenerationSettings = tutorialGenerationSettings;
|
||||
Credits = items.GameplaySettings.StartingCredits;
|
||||
// A design named without a product is chosen by the generator's ChooseProduct. The stage outfits with no faction,
|
||||
// so every maker is reachable and the run's seed draws.
|
||||
|
|
@ -38,7 +37,6 @@ public sealed class ScenarioStage
|
|||
public Galaxy Galaxy => Arena.Galaxy;
|
||||
public Zone Arena { get; }
|
||||
public string StartingHull { get; }
|
||||
public TutorialGenerationSettings TutorialGenerationSettings { get; }
|
||||
|
||||
// What the run starts with: the gameplay settings' starting credits unless the scenario sets another amount.
|
||||
public int Credits { get; set; }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public sealed class AiFusedDiscipline : Scenario
|
|||
|
||||
public static readonly CultMath.float2 Hostile = float2(0, 700), Neutral = float2(500, 300);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public sealed class Arcs : Scenario
|
|||
// holding every gun down. The guided launchers fire only on a lock, which that run cannot give them, so they carry the default three crates.
|
||||
public const int TurretAmmoCrates = 22, PlayerAmmoCrates = 42, PlayerMissileCrates = 3;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public sealed class Belt : Scenario
|
|||
public override uint Seed => 86;
|
||||
public override bool Ambient => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public sealed class Crossing : Scenario
|
|||
public const float ProjectorRange = 997f;
|
||||
public static readonly CultMath.float2 Waiting = Origin + float2(0, ProjectorRange * .8f);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ using float2 = CultMath.float2;
|
|||
|
||||
// The demo: one gate, one region and one boss, with a fixed cast. The Pirates are the protagonist's ostensible
|
||||
// employer, Zhestokost the antagonist whose home is the boss zone and the exit, Lucent Media and Aeronautics Unlimited
|
||||
// the neutrals. A prelude galaxy of that cast; the player, who is not a Pirate, flies the base Longinus.
|
||||
// the neutrals. A galaxy of that cast at half influence; the player, who is not a Pirate, flies the base Longinus.
|
||||
public sealed class DemoTerminus : Scenario
|
||||
{
|
||||
public static readonly TutorialGenerationSettings Cast = new TutorialGenerationSettings
|
||||
public static readonly GalaxyCast Cast = new GalaxyCast
|
||||
{
|
||||
ProtagonistFaction = "Pirates",
|
||||
AntagonistFaction = "Zhe",
|
||||
|
|
@ -13,7 +13,8 @@ public sealed class DemoTerminus : Scenario
|
|||
NeutralFactions = new[] { "Aero" },
|
||||
QuestFaction = null,
|
||||
ZoneCount = 64,
|
||||
LinkDensity = .5f
|
||||
LinkDensity = .5f,
|
||||
InfluenceScale = .5f
|
||||
};
|
||||
|
||||
public override string Name => "Terminus (Demo)";
|
||||
|
|
@ -23,7 +24,7 @@ public sealed class DemoTerminus : Scenario
|
|||
|
||||
public override Galaxy Generate(GalaxyStage stage)
|
||||
{
|
||||
var galaxy = stage.Prelude(Cast);
|
||||
var galaxy = stage.Cast(Cast);
|
||||
galaxy.PlaceGate(galaxy.ResolveFaction(Cast.AntagonistFaction));
|
||||
return galaxy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public sealed class DjinniShakedown : Scenario
|
|||
// Where the targets sit: the ballistic mount faces +z, so Ahead is inside its arc and Abeam outside it.
|
||||
public static readonly float2 Ahead = new float2(0, 400), Abeam = new float2(400, 0);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed class Duel : Scenario
|
|||
public override uint Seed => 104;
|
||||
public override bool Ambient => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public sealed class FusedRounds : Scenario
|
|||
// The shooter is staged at this quality, so the damage its Cluster Cannon deals does not ride the item stream.
|
||||
public const float StagedQuality = .6f;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed class LauncherAngles : Scenario
|
|||
public override uint Seed => 105;
|
||||
public override bool Ambient => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public sealed class LockOn : Scenario
|
|||
_quality = quality;
|
||||
}
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public sealed class LongHaul : Scenario
|
|||
"warp, quit and Continue keep items, tier and brand; death disables Continue.";
|
||||
public override uint Seed => 106;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage) =>
|
||||
stage.Player(stage.Generated(stage.StartingHull), float2.zero);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ public sealed class MainGalaxy : Scenario
|
|||
public override string Id => "main-galaxy";
|
||||
public override string Brief => "The full galaxy: factions drawn at random, bosses guarding the road to the exit.";
|
||||
|
||||
public override bool EntranceStation => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Main();
|
||||
|
||||
public override void Stage(ScenarioStage stage) =>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public sealed class Pursuit : Scenario
|
|||
public override uint Seed => 111;
|
||||
public override bool Ambient => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public sealed class RefusedRounds : Scenario
|
|||
// The one target, ahead of the nose: inside every forward mount's arc.
|
||||
public static readonly CultMath.float2 Target = float2(0, 300);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ public static class Scenarios
|
|||
{
|
||||
public static readonly Scenario[] Modes = { new DemoTerminus() };
|
||||
|
||||
public static readonly Scenario[] Development = { new TutorialGalaxy(), new MainGalaxy() };
|
||||
public static readonly Scenario[] Development = { new MainGalaxy() };
|
||||
|
||||
public static readonly Scenario[] Tests =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ public sealed class StarvedReactor : Scenario
|
|||
public override uint Seed => 102;
|
||||
public override bool Ambient => false;
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
using float2 = CultMath.float2;
|
||||
|
||||
// New Game as it has always been: a prelude galaxy, entered in the starting hull of the protagonist faction.
|
||||
public sealed class TutorialGalaxy : Scenario
|
||||
{
|
||||
public override string Name => "Tutorial Galaxy";
|
||||
public override string Id => "tutorial-galaxy";
|
||||
public override string Brief => "A small galaxy of fixed factions, entered in a ship of the protagonist faction.";
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude();
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var protagonist = stage.Galaxy.ResolveFaction(stage.TutorialGenerationSettings.ProtagonistFaction);
|
||||
stage.Player(stage.Generated(stage.StartingHull, protagonist), float2.zero);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94d688b37c5044dd9b67865c706d8918
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -14,7 +14,7 @@ public sealed class WeaponFeel : Scenario
|
|||
// The one target, ahead of the nose: inside every forward mount's arc.
|
||||
public static readonly CultMath.float2 Target = float2(0, 400);
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Cast(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -94,8 +94,10 @@ public class SectorGenerationSettings
|
|||
public int BossCount;
|
||||
}
|
||||
|
||||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
public class TutorialGenerationSettings
|
||||
// The fixed cast of a galaxy a scenario generates through GalaxyStage.Cast: who plays which part, how big the galaxy is,
|
||||
// and how far the factions' authored influence reaches (Galaxy.InfluenceOf). Held by the scenario that casts it; no
|
||||
// asset or store holds one.
|
||||
public class GalaxyCast
|
||||
{
|
||||
public string ProtagonistFaction;
|
||||
public string AntagonistFaction;
|
||||
|
|
@ -106,6 +108,8 @@ public class TutorialGenerationSettings
|
|||
public int ZoneCount = 32;
|
||||
// Zones per resource province (Provinces.Partition): calibration, not a gate.
|
||||
public int ProvinceZones = Provinces.DefaultZonesPerProvince;
|
||||
// Multiplies every faction's authored InfluenceDistance in this galaxy (rounding up); 1 leaves them as authored.
|
||||
public float InfluenceScale = 1;
|
||||
}
|
||||
|
||||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public static class ZoneGenerator
|
|||
PlanetSettings planetSettings,
|
||||
Galaxy galaxy,
|
||||
GalaxyZone galaxyZone,
|
||||
bool isTutorial = false,
|
||||
bool entranceStation = false,
|
||||
bool ambient = true)
|
||||
{
|
||||
var pack = new ZonePack();
|
||||
|
|
@ -294,15 +294,15 @@ public static class ZoneGenerator
|
|||
|
||||
var storyStations = galaxyZone.Locations.Where(story => story.Type == LocationType.Station).ToArray();
|
||||
var stationCount = (int)(random.NextFloat() * (factionPresence + 1)) + storyStations.Length;
|
||||
// Enemy count below is based on this pre-override value, so the tutorial entrance doesn't gain an enemy
|
||||
// Enemy count below is based on this pre-override value, so the entrance station zone doesn't gain an enemy
|
||||
// just because its station got forced.
|
||||
var baseStationCount = stationCount;
|
||||
// Operator ruling, 2026-09-25 (docs/locomotion-cut.md, "Tutorial station"): the entrance zone always
|
||||
// gets a generated faction station with a docking bay, deterministically. Galaxy.cs halves influence and
|
||||
// picks the lowest-influence unowned zone for Entrance, which otherwise rolls stationCount 0 on every
|
||||
// seed. galaxy.Entrance is reference-identity, not a name comparison.
|
||||
var isTutorialEntrance = isTutorial && galaxyZone == galaxy.Entrance;
|
||||
if (isTutorialEntrance && stationCount < 1) stationCount = 1;
|
||||
// Operator ruling, 2026-09-25 (docs/locomotion-cut.md): a scenario that declares an entrance station
|
||||
// (Scenario.EntranceStation) gets a generated faction station with a docking bay in its entrance zone,
|
||||
// deterministically. A cast galaxy's halved influence and its lowest-influence unowned Entrance otherwise roll
|
||||
// stationCount 0 on every seed. galaxy.Entrance is reference-identity, not a name comparison.
|
||||
var isEntranceStation = entranceStation && galaxyZone == galaxy.Entrance;
|
||||
if (isEntranceStation && stationCount < 1) stationCount = 1;
|
||||
// A station's source is a well-bearing body alone on its ring whose rail clears every massive sibling's extent (the
|
||||
// sibling's support, or its Roche margin if more) and the largest reach of any station or turret hull: whatever hull
|
||||
// is built there, its Lagrange orbit then sits clear of any other body.
|
||||
|
|
@ -318,7 +318,7 @@ public static class ZoneGenerator
|
|||
// (the rail, how far a body on it keeps others out, whether it is a station's own orbit rather than a base's)
|
||||
var sources = candidates.Skip(candidates.Length / 2).Take(stationCount)
|
||||
.Select(p => (orbit: orbitMap[p], extent: Extent(p), direct: false)).ToArray();
|
||||
if (isTutorialEntrance && candidates.Length == 0)
|
||||
if (isEntranceStation && candidates.Length == 0)
|
||||
{
|
||||
// The entrance gets a station whatever its bodies: it orbits a root node beyond its ring group (or, for a body, its
|
||||
// whole family), never at a ring member's distance, and sits there, not at a Lagrange point.
|
||||
|
|
@ -326,7 +326,7 @@ public static class ZoneGenerator
|
|||
var rootNode = roots.FirstOrDefault(p => p.Children.Count > 0) ?? (roots.Count > 1 ? roots.OrderByDescending(p => p.Mass).First() : null);
|
||||
if (rootNode == null)
|
||||
throw new InvalidOperationException(
|
||||
"The tutorial entrance zone must always get a station, but it has no candidate orbit at all -- every planet in the zone is a parentless root.");
|
||||
"The entrance station zone must always get a station, but it has no candidate orbit at all -- every planet in the zone is a parentless root.");
|
||||
var distance = rootNode.Empty
|
||||
? (1 + GravityField.RingReach) * GravityField.Beta * rootNode.Children.Where(Massive).Min(c => c.Distance)
|
||||
: Extent(rootNode);
|
||||
|
|
@ -445,9 +445,9 @@ public static class ZoneGenerator
|
|||
StationKinds.Choose(cache, nearestFaction, $"{seed}:station:{i}", itemManager.Log));
|
||||
if (station == null)
|
||||
{
|
||||
if (isTutorialEntrance)
|
||||
if (isEntranceStation)
|
||||
throw new InvalidOperationException(
|
||||
$"The tutorial entrance zone must always get a station, but {nearestFaction?.Name} has no station loadout to generate.");
|
||||
$"The entrance station zone must always get a station, but {nearestFaction?.Name} has no station loadout to generate.");
|
||||
continue;
|
||||
}
|
||||
station.Orbit = cache.RefOf(lagrangeOrbit);
|
||||
|
|
|
|||
Loading…
Reference in a new issue