Merge assembly-from-maker (a899432d), --no-ff
Code from eureka/aetheria-release-assembly-from-maker-r2. The two LFS files are not merged as text or by side; they are the merge's resolution, made as follows. GameData/Aetheria.cc: master's catalog (0f5def17's, sha256 a4ff0eff...ebee9) is unchanged by master since, so the branch's blob was checked against the replay. AetherDb assembly-from-maker apply, built from this merged tree, run on master's catalog twice from fresh copies and once more on its own output: 15 factions written; the second pass said No changes and left the bytes identical. The replayed bytes equal the branch's blob (sha256 2b18ff7f...90e... ) except for the 333 record write timestamps, each of which a fresh write restamps (masked to a constant, both hash alike). The branch's blob, which h5's full suite tested, is taken. Assets/Resources/Settings.asset: master's file (b004d902..., which dropped AsteroidVerticalOffset) with the branch's Rarity cleanup replayed: the five Rarity values (1, 0.5, 0.15, 0.05, 0.01) removed, nothing else touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
430eb307a3
86 changed files with 911 additions and 150 deletions
|
|
@ -23,6 +23,9 @@ public class Agent
|
|||
private VelocityLimit _velocityLimit;
|
||||
|
||||
public AgentTask Task { get; set; }
|
||||
// Zone-scoped, from 1: the ordinal of this pilot's own dice, set by Zone.CreateAgent as it admits the pilot (0 for
|
||||
// an agent built outside a zone's admission).
|
||||
public uint Id { get; set; }
|
||||
public Ship Ship { get; }
|
||||
public ItemManager ItemManager { get; }
|
||||
public GameplaySettings Settings { get; }
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class Flight
|
|||
private class Member
|
||||
{
|
||||
public Agent Agent;
|
||||
public PatrolOrbitsTask Patrol;
|
||||
public AgentTask Baseline;
|
||||
}
|
||||
|
||||
private readonly FactionDoctrine _doctrine;
|
||||
|
|
@ -49,10 +49,11 @@ public class Flight
|
|||
|
||||
public Phase PhaseOf(Entity track) => _tracks.TryGetValue(track, out var t) ? t.Phase : Phase.None;
|
||||
|
||||
public void Join(Agent agent, PatrolOrbitsTask circuit)
|
||||
// The task a member holds when the flight has nothing to follow: its patrol circuit, or the task a scenario stated.
|
||||
public void Join(Agent agent, AgentTask baseline)
|
||||
{
|
||||
_members.Add(new Member { Agent = agent, Patrol = circuit });
|
||||
agent.Task = circuit;
|
||||
_members.Add(new Member { Agent = agent, Baseline = baseline });
|
||||
agent.Task = baseline;
|
||||
}
|
||||
|
||||
public void Leave(Agent agent) => _members.RemoveAll(m => m.Agent == agent);
|
||||
|
|
@ -167,8 +168,8 @@ public class Flight
|
|||
if (!(member.Agent.Task is FollowTask current) || current.Anchor != anchor)
|
||||
member.Agent.Task = new FollowTask { Anchor = anchor, Standoff = Standoff(ship) };
|
||||
}
|
||||
else if (member.Agent.Task != member.Patrol)
|
||||
member.Agent.Task = member.Patrol;
|
||||
else if (member.Agent.Task != member.Baseline)
|
||||
member.Agent.Task = member.Baseline;
|
||||
}
|
||||
|
||||
private static void Aim(Ship ship, Entity target)
|
||||
|
|
|
|||
|
|
@ -173,7 +173,10 @@ public class CombatState : BaseState
|
|||
maxRange = weapon.Range;
|
||||
}
|
||||
|
||||
var offset = _agent.ItemManager.Random.NextFloat((maxRange - minRange) / DPS_SAMPLE_COUNT);
|
||||
// The pilot's own dice, a pure function of the zone seed and its id: the same offset at every resample, and
|
||||
// nothing that mints an item can move it.
|
||||
var offset = SimulationDice.For(_agent.Ship.Zone.CombatSeed, SimulationDice.CombatSampleStream, _agent.Id)
|
||||
.NextFloat((maxRange - minRange) / DPS_SAMPLE_COUNT);
|
||||
var optimumDPS = 0f;
|
||||
for (int i = 0; i < DPS_SAMPLE_COUNT; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,6 +63,13 @@ public class Faction
|
|||
// The faction's rules of engagement; null fights as FactionDoctrine.Default.
|
||||
[Inspectable, JsonProperty("doctrine"), Key(17)]
|
||||
public FactionDoctrine Doctrine;
|
||||
|
||||
// The maker's final assembly: the distribution every lot of theirs draws its own quality from, and the hard ceiling on each
|
||||
// of its roles (quality-lean-assembly-hard-ceiling). Null is not authored: a lot of theirs assembles at AssemblyDistribution's
|
||||
// defaults. assembly-from-maker derives it once at the part mean plus a tolerance margin (quality-min-tolerance-binned-assembly);
|
||||
// tune it in Studio after that. Key 16 is reserved for Relations and 18 for Livery.
|
||||
[Inspectable, JsonProperty("assembly"), Key(19)]
|
||||
public AssemblyDistribution Assembly;
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.namefile", "1"), Inspectable, MessagePackObject]
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ public class FactionProductData
|
|||
|
||||
[Inspectable, JsonProperty("roles"), Key(5)]
|
||||
public List<ProductRole> Roles = new List<ProductRole>();
|
||||
|
||||
// This line's own final test (maker-design-tiers-allowed): a binned or premium line is a better assembly as well as better
|
||||
// parts. Null assembles as its maker does.
|
||||
[Inspectable, JsonProperty("assembly"), Key(6)]
|
||||
public AssemblyDistribution Assembly;
|
||||
}
|
||||
|
||||
// How good this product's part is in one of its design's roles: a pseudo-gaussian distribution whose mean is
|
||||
|
|
@ -46,3 +51,15 @@ public class ProductRole
|
|||
[Inspectable, JsonProperty("standardDeviation"), Key(2)]
|
||||
public float StandardDeviation = .15f;
|
||||
}
|
||||
|
||||
// How well a maker puts the thing together: the technology and quality control of final assembly. A lot's own quality is drawn
|
||||
// from it, and it is the ceiling on every role the lot fills. Defaults are a middling maker.
|
||||
[MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class AssemblyDistribution
|
||||
{
|
||||
[Inspectable, JsonProperty("mean"), Key(0)]
|
||||
public float Mean = .5f;
|
||||
|
||||
[Inspectable, JsonProperty("standardDeviation"), Key(1)]
|
||||
public float StandardDeviation = .15f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,31 +117,25 @@ public class ItemManager
|
|||
return (int) (GameplaySettings.QualityPriceModifier.Evaluate(GetLot(item).Quality) * data.Price);
|
||||
}
|
||||
|
||||
// The tier roll every mint applies, whether or not the lot fills roles.
|
||||
public float RollQuality()
|
||||
{
|
||||
var quality = Random.NextFloat();
|
||||
var tier = GameplaySettings.Tiers[0];
|
||||
foreach (var t in GameplaySettings.Tiers)
|
||||
{
|
||||
if (t.Rarity > quality)
|
||||
tier = t;
|
||||
}
|
||||
// Builds one of a manufacturer's branded products (quality-is-assembly-over-supply-chain): the unit's own quality is its
|
||||
// final assembly, drawn from the product's assembly distribution, else its maker's, else AssemblyDistribution's defaults,
|
||||
// and each of the design's roles is filled with a part whose quality is drawn from the product's distribution for it.
|
||||
public int CreateLot(FactionProductData product) => Mint(product, null);
|
||||
|
||||
return tier.Quality;
|
||||
}
|
||||
// The same lot at a stated quality: the assembly and every role fill are that quality and nothing is drawn, so a staged
|
||||
// fit does not ride the item stream (ScenarioStage.Fit).
|
||||
public int CreateLot(FactionProductData product, float quality) => Mint(product, clamp(quality, .01f, 1));
|
||||
|
||||
// Builds one of a manufacturer's branded products: the unit's own workmanship rolled as before, and each of
|
||||
// the design's roles filled with a part whose quality is drawn from that manufacturer's distribution for it.
|
||||
public int CreateLot(FactionProductData product)
|
||||
private int Mint(FactionProductData product, float? stated)
|
||||
{
|
||||
var design = ItemData.Get(product.Design);
|
||||
var assembly = product.Assembly ?? ItemData.Get(product.Manufacturer)?.Assembly ?? new AssemblyDistribution();
|
||||
var lot = new Lot
|
||||
{
|
||||
Design = ItemData.RefOf<ItemData>(design),
|
||||
Origin = new Attributed { Faction = product.Manufacturer },
|
||||
Product = ItemData.RefOf(product),
|
||||
Quality = RollQuality(),
|
||||
Quality = stated ?? clamp(Random.NextGaussian(assembly.Mean, assembly.StandardDeviation), .01f, 1),
|
||||
Roles = new List<RoleFill>()
|
||||
};
|
||||
if (design.Roles != null)
|
||||
|
|
@ -151,7 +145,7 @@ public class ItemManager
|
|||
lot.Roles.Add(new RoleFill
|
||||
{
|
||||
Role = role.Name,
|
||||
Quality = clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
|
||||
Quality = stated ?? clamp(Random.NextGaussian(build.Mean, build.StandardDeviation), .01f, 1)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,18 +108,19 @@ public static class Loadouts
|
|||
// picks the entity: a ship hull builds a Ship, a turret hull an OrbitalEntity with no orbit, which stays where it is
|
||||
// put; a station hull is refused. The entity always gets exactly WeaponGroupCount groups; a loadout with fewer is
|
||||
// padded with empty groups. A failed materialization leaves any minted lots in the live ledger; they are not roots,
|
||||
// so the next commit drops them.
|
||||
// so the next commit drops them. A stated quality mints every lot of the fit at it, drawing nothing (a scenario states
|
||||
// one for a fit its checks rest on).
|
||||
public static Entity Materialize(ItemManager itemManager, Zone liveZone, Loadout loadout,
|
||||
Func<CraftedItemData, FactionProductData> choose, List<string> failures)
|
||||
Func<CraftedItemData, FactionProductData> choose, List<string> failures, float? quality = null)
|
||||
{
|
||||
var cache = itemManager.ItemData;
|
||||
var reported = failures.Count;
|
||||
|
||||
var hullBuild = Resolve(itemManager, loadout.Hull, loadout.HullProduct, choose, "hull", failures);
|
||||
var hullBuild = Resolve(itemManager, loadout.Hull, loadout.HullProduct, choose, "hull", failures, quality);
|
||||
var hullData = cache.Get(loadout.Hull);
|
||||
if (hullData is { HullType: HullType.Station })
|
||||
failures.Add($"hull: {hullData.Name} is a station hull; a preset builds a ship or a turret");
|
||||
var slotBuilds = loadout.Slots.Select(slot => Resolve(itemManager, slot.Design, slot.Product, choose, Cell(slot), failures)).ToArray();
|
||||
var slotBuilds = loadout.Slots.Select(slot => Resolve(itemManager, slot.Design, slot.Product, choose, Cell(slot), failures, quality)).ToArray();
|
||||
var groups = loadout.WeaponGroups ?? new int[0][];
|
||||
var groupCount = itemManager.GameplaySettings.WeaponGroupCount;
|
||||
if (groups.Length > groupCount) failures.Add($"weapon groups: {groups.Length} groups, at most {groupCount}");
|
||||
|
|
@ -168,11 +169,11 @@ public static class Loadouts
|
|||
// How one design is built, or null with the failure listed; nothing is minted until the returned builder runs. A
|
||||
// pinned product is built as named, whatever choose says; it must be a product of the design. A design with no
|
||||
// product at all is outside the economy (docs/scenarios-cut.md, Q3: generation, stock and sale all go through
|
||||
// products) and is built unbranded, with no maker, at UnbrandedQuality. Otherwise choose names the product, and
|
||||
// products) and is built unbranded, with no maker, at UnbrandedQuality (a stated quality replaces it). Otherwise choose names the product, and
|
||||
// null (nothing available) or a product of another design is a failure.
|
||||
public static Func<CraftedItemInstance> Resolve<T>(ItemManager itemManager, CultRecordRef<T> design,
|
||||
CultRecordRef<FactionProductData> product, Func<CraftedItemData, FactionProductData> choose, string where,
|
||||
List<string> failures) where T : CraftedItemData
|
||||
List<string> failures, float? quality = null) where T : CraftedItemData
|
||||
{
|
||||
var cache = itemManager.ItemData;
|
||||
var data = cache.Get(design);
|
||||
|
|
@ -195,7 +196,7 @@ public static class Loadouts
|
|||
else
|
||||
{
|
||||
if (!cache.GetAll<FactionProductData>().Any(p => p.Design.Key.Equals(design.Key)))
|
||||
return () => itemManager.CreateInstance(itemManager.CreateLot(data, default, UnbrandedQuality));
|
||||
return () => itemManager.CreateInstance(itemManager.CreateLot(data, default, quality ?? UnbrandedQuality));
|
||||
made = choose(data);
|
||||
if (made == null)
|
||||
{
|
||||
|
|
@ -209,7 +210,7 @@ public static class Loadouts
|
|||
failures.Add($"{where}: product {made.Name} is not a product of {data.Name}");
|
||||
return null;
|
||||
}
|
||||
return () => itemManager.CreateInstance(made);
|
||||
return () => itemManager.CreateInstance(quality is { } q ? itemManager.CreateLot(made, q) : itemManager.CreateLot(made));
|
||||
}
|
||||
|
||||
private static string Cell(LoadoutSlot slot) => $"slot {slot.Position.x},{slot.Position.y}";
|
||||
|
|
|
|||
|
|
@ -72,18 +72,20 @@ public class Lot
|
|||
// (console give, presets, extracted), which brand their maker only.
|
||||
[Key(4)] public CultRecordRef<FactionProductData> Product;
|
||||
|
||||
// The quality a stat reads for one of the design's roles. An unnamed role, a design without roles, and a lot
|
||||
// minted before roles existed all fall back to the lot's own workmanship.
|
||||
// The quality a stat reads for one of the design's roles: the part's, capped by the lot's own final assembly
|
||||
// (quality-lean-assembly-hard-ceiling), so a part better than its assembly is worth the assembly. An unnamed role, a
|
||||
// design without roles, and a lot minted before roles existed all fall back to the lot's own workmanship.
|
||||
public float QualityForRole(string role)
|
||||
{
|
||||
if (string.IsNullOrEmpty(role) || Roles == null) return Quality;
|
||||
foreach (var fill in Roles)
|
||||
if (fill.Role == role) return fill.Quality;
|
||||
if (fill.Role == role) return Math.Min(fill.Quality, Quality);
|
||||
return Quality;
|
||||
}
|
||||
}
|
||||
|
||||
// One filled slot: the design's role name and how good the part that went into it turned out to be.
|
||||
// One filled slot: the design's role name and how good the part that went into it turned out to be. Stats read it through
|
||||
// Lot.QualityForRole, capped by the lot's assembly; the raw value is kept for disassembly (named-components-after-demo).
|
||||
[MessagePackObject]
|
||||
public class RoleFill
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public static class RunStart
|
|||
var hostile = placed.Stance == ScenarioStance.Hostile;
|
||||
placed.Entity.SetIff(player, hostile);
|
||||
player.SetIff(placed.Entity, hostile);
|
||||
arena.Admit(placed.Entity, placed.Piloted);
|
||||
arena.Admit(placed.Entity, placed.Piloted, placed.Task);
|
||||
}
|
||||
return new Staged { Player = player, Credits = stage.Credits, Entities = stage.Placed.Select(placed => placed.Entity).ToList() };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CultMath;
|
||||
using GameCult.Caching;
|
||||
using static CultMath.math;
|
||||
using float2 = CultMath.float2;
|
||||
using float3 = CultMath.float3;
|
||||
|
|
@ -48,11 +49,20 @@ public sealed class ScenarioStage
|
|||
public Entity Entity;
|
||||
public ScenarioStance Stance;
|
||||
public bool Piloted;
|
||||
public AgentTask Task;
|
||||
}
|
||||
|
||||
// A hull fitted slot by slot: each slot a design or a product, the hull cell it goes in, and its rotation. A name is
|
||||
// a design (open: the stage chooses its product) or a product (pinned: that brand).
|
||||
public ScenarioFit Fit(string hull, params (string design, int2 cell, ItemRotation rotation)[] slots)
|
||||
public ScenarioFit Fit(string hull, params (string design, int2 cell, ItemRotation rotation)[] slots) =>
|
||||
FitAt(hull, null, slots);
|
||||
|
||||
// The same fit with every lot it mints (hull, slots, unbranded) at the stated quality, drawing nothing. A fit a scenario's
|
||||
// checks rest on states its quality, so the check does not ride the item stream.
|
||||
public ScenarioFit Fit(string hull, float quality, params (string design, int2 cell, ItemRotation rotation)[] slots) =>
|
||||
FitAt(hull, quality, slots);
|
||||
|
||||
private ScenarioFit FitAt(string hull, float? quality, (string design, int2 cell, ItemRotation rotation)[] slots)
|
||||
{
|
||||
var where = $"fit {hull}";
|
||||
var (hullData, hullProduct) = NamedOrProduct<HullData>(hull, where);
|
||||
|
|
@ -69,7 +79,7 @@ public sealed class ScenarioStage
|
|||
Product = product == null ? default : _items.ItemData.RefOf(product)
|
||||
});
|
||||
}
|
||||
return hullData != null && loadout.Slots.Count == slots.Length ? new ScenarioFit(loadout) : null;
|
||||
return hullData != null && loadout.Slots.Count == slots.Length ? new ScenarioFit(loadout, quality) : null;
|
||||
}
|
||||
|
||||
// A hull with nothing fitted.
|
||||
|
|
@ -126,6 +136,18 @@ public sealed class ScenarioStage
|
|||
return entity;
|
||||
}
|
||||
|
||||
// The task a piloted entity starts on: it closes on the target and holds there (the flight's follow task, standoff
|
||||
// nothing), in place of the patrol circuit the zone would draw for it. A check that rests on where a pilot goes states
|
||||
// it here, so the pilot's course is the scenario's and not a draw. An entity that is not placed and piloted, or a
|
||||
// target that is not placed, is a failure.
|
||||
public void Approach(Entity entity, Entity target)
|
||||
{
|
||||
var placement = _placed.FirstOrDefault(p => ReferenceEquals(p.Entity, entity));
|
||||
if (placement == null || !placement.Piloted) { _failures.Add($"approach: {entity?.Name ?? "no entity"} is not a placed, piloted ship"); return; }
|
||||
if (target == null) { _failures.Add("approach: no target to close on"); return; }
|
||||
placement.Task = new FollowTask { Anchor = target, Standoff = 0f };
|
||||
}
|
||||
|
||||
// Items in the entity's first cargo bay, one per name. A name is an equippable or consumable design (open: the stage
|
||||
// chooses its product) or a product of one (pinned); a name that is neither is a failure.
|
||||
public void Cargo(Entity entity, params string[] names)
|
||||
|
|
@ -154,7 +176,7 @@ public sealed class ScenarioStage
|
|||
else
|
||||
{
|
||||
var failures = new List<string>();
|
||||
entity = Loadouts.Materialize(_items, Arena, fit.Loadout, _choose, failures);
|
||||
entity = Loadouts.Materialize(_items, Arena, fit.Loadout, _choose, failures, fit.Quality);
|
||||
_failures.AddRange(failures.Select(failure => $"{where} ({fit.Loadout.Name}): {failure}"));
|
||||
if (entity == null) return null;
|
||||
}
|
||||
|
|
@ -190,7 +212,13 @@ public sealed class ScenarioFit
|
|||
{
|
||||
internal readonly Loadout Loadout;
|
||||
internal readonly EntityPack Pack;
|
||||
internal readonly float? Quality;
|
||||
|
||||
internal ScenarioFit(Loadout loadout, float? quality = null)
|
||||
{
|
||||
Loadout = loadout;
|
||||
Quality = quality;
|
||||
}
|
||||
|
||||
internal ScenarioFit(Loadout loadout) => Loadout = loadout;
|
||||
internal ScenarioFit(EntityPack pack) => Pack = pack;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,14 +22,19 @@ public sealed class Crossing : Scenario
|
|||
// The waiting Djinni sits inside the Lightning Projector's arc at 80% of its Range.
|
||||
public static readonly CultMath.float2 Origin = float2(724, 124);
|
||||
public static readonly CultMath.float2 CrosserAt = Origin + float2(-128, 45), CrosserFacing = float2(1, 0), CrosserVelocity = float2(50, 0);
|
||||
public const float ProjectorRange = 1216f; // the Lightning Projector's Range in metres, 1216.4 as the fit stands settled at rest
|
||||
// The fighter is staged at this quality, so its gear and the range below do not ride the item stream.
|
||||
public const float StagedQuality = .6f;
|
||||
// The Lightning Projector's Range in metres at the staged fit: 996.99 after the three seconds the test settles for
|
||||
// (EvSettle); it falls toward 864 m as the projector heats. The fit as it stood at 0f5def17 (unstaged, its draws on the
|
||||
// item stream) measured 1216.4.
|
||||
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 void Stage(ScenarioStage stage)
|
||||
{
|
||||
var fighter = stage.Fit("Longinus",
|
||||
var fighter = stage.Fit("Longinus", StagedQuality,
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
|
|
|
|||
|
|
@ -22,11 +22,14 @@ public sealed class FusedRounds : Scenario
|
|||
public static readonly CultMath.float2 Mid = float2(-200, 600), Ahead = float2(0, 300), Fragile = float2(80, 240),
|
||||
Close = float2(6.4f, 4f), Stern = float2(0, -400);
|
||||
|
||||
// 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 void Stage(ScenarioStage stage)
|
||||
{
|
||||
var shooter = stage.Fit("Smoke Test Hull",
|
||||
var shooter = stage.Fit("Smoke Test Hull", StagedQuality,
|
||||
("Cockpit 2x2", int2(4, 6), None),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
("Large Drive", int2(5, 0), Reversed),
|
||||
|
|
|
|||
|
|
@ -12,17 +12,33 @@ public sealed class LockOn : Scenario
|
|||
|
||||
// The hostile starts about 4000 m off, ahead and to port of the player, facing the player. At that range its passive
|
||||
// sensors hold no track of the player (the test asks the sim's own PassiveInfo against the detection threshold). The
|
||||
// hostile closes, sees the player some fourteen seconds in and locks. Its flanking approach and the zone's pull carry it
|
||||
// off the staged line (about 5 degrees by the lock on the merged tree), and the warning must point at where the hostile
|
||||
// is at the lock, which the test checks against the live bearing. At Duel's 900 m (and at 600 m) it sees and locks
|
||||
// within a second.
|
||||
// hostile is ordered to close on the player, finds it and locks. The zone's pull carries it off the staged line, so the
|
||||
// warning must point at where the hostile was when the paint was stamped, which the test checks against the poses of
|
||||
// that tick. At Duel's 900 m (and at 600 m) it sees and locks within a second.
|
||||
public static readonly CultMath.float2 HostileAt = float2(-2000, 3450);
|
||||
|
||||
// The fit's lots are minted at this quality, the one Crossing and the other RunStart scenarios stage (the brief states no
|
||||
// other), and the hostile's order is to close on the player, so the lock follows from the staged situation and not
|
||||
// from item draws or the pilot's drawn circuit (ruling scenario-stages-hostile-task).
|
||||
const float StagedQuality = .6f;
|
||||
|
||||
private readonly CultMath.float2 _hostileAt;
|
||||
private readonly float _quality;
|
||||
|
||||
public LockOn() : this(HostileAt, StagedQuality) { }
|
||||
|
||||
// The staged inputs, open to a test that moves each a little and asks that the scenario still hold.
|
||||
internal LockOn(CultMath.float2 hostileAt, float quality)
|
||||
{
|
||||
_hostileAt = hostileAt;
|
||||
_quality = quality;
|
||||
}
|
||||
|
||||
public override Galaxy Generate(GalaxyStage stage) => stage.Prelude(DemoTerminus.Cast);
|
||||
|
||||
public override void Stage(ScenarioStage stage)
|
||||
{
|
||||
var fighter = stage.Fit("Longinus",
|
||||
var fighter = stage.Fit("Longinus", _quality,
|
||||
("Cockpit 2x2", int2(2, 6), None),
|
||||
("Large Drive", int2(1, 0), Reversed),
|
||||
("Large Drive", int2(3, 0), Reversed),
|
||||
|
|
@ -40,7 +56,8 @@ public sealed class LockOn : Scenario
|
|||
("Panopticon Prime", int2(1, 6), Clockwise), // Fire Control Array
|
||||
("Store-All Plus", int2(2, 8), None)); // Cargo Bay
|
||||
|
||||
stage.Player(fighter, float2(0, 0), facing: float2(0, 1));
|
||||
stage.Place(fighter, HostileAt, facing: normalize(-HostileAt), stance: ScenarioStance.Hostile, piloted: true);
|
||||
var player = stage.Player(fighter, float2(0, 0), facing: float2(0, 1));
|
||||
var hostile = stage.Place(fighter, _hostileAt, facing: normalize(-_hostileAt), stance: ScenarioStance.Hostile, piloted: true);
|
||||
stage.Approach(hostile, player);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,5 +305,4 @@ public class RarityTier
|
|||
public string Name;
|
||||
public float Quality;
|
||||
public float3 Color;
|
||||
public float Rarity;
|
||||
}
|
||||
|
|
@ -10,6 +10,10 @@ public static class SimulationDice
|
|||
{
|
||||
public const uint LootStream = 1;
|
||||
public const uint MineStream = 2;
|
||||
// A pilot's own decisions, ordinal Agent.Id: its preferred engagement range and its patrol circuit. AI behaviour
|
||||
// never rides ItemManager.Random, so minting items cannot change how a pilot fights.
|
||||
public const uint CombatSampleStream = 3;
|
||||
public const uint PatrolStream = 4;
|
||||
|
||||
// 9.1 (docs/fire-control-cut.md): fmix32, MurmurHash3's 32-bit finalizer -- xor-shift, multiply,
|
||||
// xor-shift, multiply, xor-shift. Diffuses a structured seed (a zone seed XORed with a small,
|
||||
|
|
|
|||
|
|
@ -133,6 +133,10 @@ public class Zone
|
|||
// The death ordinal of the loot dice: the nth death in this zone rolls on SimulationDice.For(CombatSeed, LootStream, n).
|
||||
private uint _deaths;
|
||||
|
||||
// The zone-scoped agent ordinal, from 1, never reused: the key of a pilot's own dice.
|
||||
private uint _lastAgentId;
|
||||
public uint NextAgentId() => ++_lastAgentId;
|
||||
|
||||
// One death subscription per member entity: Admit creates it together with the membership, Remove disposes it
|
||||
// together with the membership, and nothing else touches either.
|
||||
private readonly Dictionary<Entity, IDisposable> _deathWatches = new Dictionary<Entity, IDisposable>();
|
||||
|
|
@ -275,13 +279,14 @@ public class Zone
|
|||
// turret all join through here. A piloted entity gets the zone's Minion; an unpiloted one gets no agent at all.
|
||||
// Only a ship can be piloted. The death watch is installed here, for every join, whichever caller admits it.
|
||||
// An entity that is already a member is refused: it would hold a second watch and a second agent.
|
||||
public void Admit(Entity entity, bool piloted)
|
||||
// A piloted entity starts on the zone's drawn patrol circuit unless the caller states its task (a scenario's approach).
|
||||
public void Admit(Entity entity, bool piloted, AgentTask task = null)
|
||||
{
|
||||
if (_entities.Contains(entity)) throw new InvalidOperationException("entity: already a member of this zone");
|
||||
_entities.Add(entity);
|
||||
_deathWatches.Add(entity, entity.Death.Subscribe(_ => { DropLoot(entity); Remove(entity); entity.Deactivate(); }));
|
||||
entity.Activate();
|
||||
if (piloted) Agents.Add(CreateAgent((Ship) entity));
|
||||
if (piloted) Agents.Add(CreateAgent((Ship) entity, task));
|
||||
}
|
||||
|
||||
// The one removal from this zone (death, dock, jump): membership and its death watch leave together. False, and
|
||||
|
|
@ -296,18 +301,23 @@ public class Zone
|
|||
return true;
|
||||
}
|
||||
|
||||
private Agent CreateAgent(Ship ship)
|
||||
private Agent CreateAgent(Ship ship, AgentTask stated)
|
||||
{
|
||||
var key = ship.Faction ?? Unaffiliated;
|
||||
if (!_flights.TryGetValue(key, out var flight))
|
||||
_flights[key] = flight = new Flight(ship.Faction?.Doctrine, _itemManager.GameplaySettings);
|
||||
var agent = new Minion(ship, flight.Combatant);
|
||||
var task = new PatrolOrbitsTask();
|
||||
task.Circuit = Orbits.OrderBy(_ => _itemManager.Random.NextFloat()).Take(4).Select(x => x.Key).ToArray();
|
||||
flight.Join(agent, task);
|
||||
var id = NextAgentId();
|
||||
var agent = new Minion(ship, flight.Combatant) { Id = id };
|
||||
flight.Join(agent, stated ?? PatrolCircuit(id));
|
||||
return agent;
|
||||
}
|
||||
|
||||
private PatrolOrbitsTask PatrolCircuit(uint id)
|
||||
{
|
||||
var dice = SimulationDice.For(CombatSeed, SimulationDice.PatrolStream, id);
|
||||
return new PatrolOrbitsTask { Circuit = Orbits.OrderBy(_ => dice.NextFloat()).Take(4).Select(x => x.Key).ToArray() };
|
||||
}
|
||||
|
||||
public ZonePack PackZone()
|
||||
{
|
||||
return new ZonePack
|
||||
|
|
|
|||
Loading…
Reference in a new issue