Update rewrite docs and cleanup
This commit is contained in:
9
TASKS.md
9
TASKS.md
@@ -46,6 +46,13 @@
|
||||
- Added tests for network-band rules, reactor-ready rules, inventory rules, removal effects, electricity leak access, and invalid rule targets.
|
||||
- Verified `dotnet test tests/ReactorMaintenance.Simulation.Tests/ReactorMaintenance.Simulation.Tests.csproj` passes after the rule slice: 21 passed.
|
||||
- Ran `jb cleanupcode --build=False ...` and `python D:\Code\crlf.py ...` for touched C# files after the rule slice.
|
||||
- Split serializable simulation records and enums from the monolithic `Models.cs` file into individual files under `Models`.
|
||||
- Moved level creation, grid mutation helpers, surface clamping, grid geometry, and inventory operations out of serializable model records.
|
||||
- Replaced separate T-junction and cross-junction props/tools with one topology-inferred `Junction` prop and one editor tool.
|
||||
- Moved junction ratio presets into balancing data.
|
||||
- Replaced hardcoded `EPairEffect` variants with parameterized surface interaction verbs and balance-owned magnitudes.
|
||||
- Introduced a small public `SimulationEngine` facade over an internal simulation system implementation.
|
||||
- Updated design documentation for generic junctions and parameterized surface interactions.
|
||||
|
||||
## Current Work
|
||||
|
||||
@@ -53,7 +60,7 @@
|
||||
|
||||
## Future Work
|
||||
|
||||
1. Expand simulation fidelity where the first slice is intentionally simplified: complete pair table coverage and stronger forecast proof cases.
|
||||
1. Continue splitting the internal simulation system into smaller action, network, consumer, leak, surface interaction, robot safety, reactor, rule, and forecast systems.
|
||||
2. Add advanced editor workflows for explicit reactor binding selection, explicit door edge selection, electricity wall leak face selection, and rule event authoring.
|
||||
3. Verify and polish the Win2D app on Windows where the XAML compiler can run.
|
||||
4. Update README and any affected docs to reflect the new schema, .NET target, editor controls, and deterministic defaults.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Reactor Maintenance Design
|
||||
# Reactor Maintenance Design
|
||||
|
||||
## Concept
|
||||
|
||||
@@ -114,8 +114,7 @@ Surface prop categories:
|
||||
|
||||
- flow prop
|
||||
- consumer prop
|
||||
- T-junction prop
|
||||
- cross-junction prop
|
||||
- junction prop
|
||||
- door prop
|
||||
- all-seeing-eye terminal prop
|
||||
- remedy supply prop
|
||||
@@ -155,24 +154,9 @@ The level is invalid if any binding is missing, out of bounds, or points to the
|
||||
|
||||
A junction prop must be on a floor cell whose coordinate has exactly one underground carrier. That carrier is the regulated network.
|
||||
|
||||
T-junction modes:
|
||||
The engine infers incoming and outgoing branch directions from valid network topology and enabled source paths. A valid junction has one incoming branch and either two or three outgoing branches. Ambiguous junction flow is invalid. Ratio numbers are balance-defined weights that divide carrier amount and pressure or voltage. A zero-weight branch receives no intentional outflow.
|
||||
|
||||
- `0/4`
|
||||
- `1/3`
|
||||
- `2/2`
|
||||
- `3/1`
|
||||
- `4/0`
|
||||
|
||||
Cross-junction modes:
|
||||
|
||||
- `0/3/3`
|
||||
- `3/0/3`
|
||||
- `3/3/0`
|
||||
- `2/2/2`
|
||||
|
||||
The engine infers incoming and outgoing branch directions from valid network topology and enabled source paths. Ambiguous junction flow is invalid. Ratio numbers are weights that divide carrier amount and pressure or voltage by balance-defined math. A zero-weight branch receives no intentional outflow.
|
||||
|
||||
The gameplay UI exposes ratio modes.
|
||||
The gameplay UI exposes a single junction tool and cycles through balance-defined ratio presets for the inferred outgoing branch count.
|
||||
|
||||
### Doors
|
||||
|
||||
@@ -284,33 +268,28 @@ Balance thresholds project numeric values into safe, caution, and critical bands
|
||||
The pair table maps projected bands to deterministic effects:
|
||||
|
||||
- `Hold`: no direct change.
|
||||
- `FuelFlow`: equalize leaked fuel.
|
||||
- `CoolFlow`: equalize leaked coolant.
|
||||
- `ChargeFlow`: equalize leaked electricity.
|
||||
- `HeatFlow`: transfer heat.
|
||||
- `HeatFlow2`: stronger heat transfer.
|
||||
- `Warm1`: small heat increase from fuel exposure.
|
||||
- `Warm2`: larger heat increase from fuel exposure.
|
||||
- `Quench1`: small heat reduction from coolant exposure.
|
||||
- `Quench2`: larger heat reduction from coolant exposure.
|
||||
- `Short1`: electricity and coolant interaction causing heat and discharge.
|
||||
- `Short2`: stronger short.
|
||||
- `Ignite1`: fuel interaction with electricity or high heat.
|
||||
- `Ignite2`: stronger ignition.
|
||||
The pair table maps projected bands to parameterized verbs:
|
||||
|
||||
- `Hold`: no direct change.
|
||||
- `Flow(amount)`: equalize a surface quantity by a balance-defined transfer amount.
|
||||
- `Warm(amount)`: increase heat by a balance-defined amount.
|
||||
- `Quench(amount)`: reduce heat by a balance-defined amount.
|
||||
- `Short(heat, discharge)`: add heat and discharge electricity by balance-defined amounts.
|
||||
- `Ignite(heat, fuel)`: add heat and consume fuel by balance-defined amounts.
|
||||
|
||||
| Row\Col | FuelSafe | FuelCaution | FuelCritical | CoolantSafe | CoolantCaution | CoolantCritical | ElectricitySafe | ElectricityCaution | ElectricityCritical | HeatSafe | HeatCaution | HeatCritical |
|
||||
| ------- | -------- | ----------- | ------------ | ----------- | -------------- | --------------- | --------------- | ------------------ | ------------------- | -------- | ----------- | ------------ |
|
||||
| FuelSafe | Hold | FuelFlow | FuelFlow | Hold | Hold | Hold | Hold | Warm1 | Warm2 | Hold | Warm1 | Warm2 |
|
||||
| FuelCaution | | Hold | FuelFlow | Hold | Hold | Hold | Warm1 | Ignite1 | Ignite2 | Warm1 | Ignite1 | Ignite2 |
|
||||
| FuelCritical | | | Hold | Hold | Hold | Hold | Warm2 | Ignite2 | Ignite2 | Warm2 | Ignite2 | Ignite2 |
|
||||
| CoolantSafe | | | | Hold | CoolFlow | CoolFlow | Hold | Short1 | Short2 | Hold | Quench1 | Quench1 |
|
||||
| CoolantCaution | | | | | Hold | CoolFlow | Short1 | Short1 | Short2 | Hold | Quench1 | Quench2 |
|
||||
| CoolantCritical | | | | | | Hold | Short2 | Short2 | Short2 | Hold | Quench2 | Quench2 |
|
||||
| ElectricitySafe | | | | | | | Hold | ChargeFlow | ChargeFlow | Hold | Hold | Hold |
|
||||
| ElectricityCaution | | | | | | | | Hold | ChargeFlow | Hold | Hold | Hold |
|
||||
| FuelSafe | Hold | Flow | Flow | Hold | Hold | Hold | Hold | Warm | Ignite | Hold | Warm | Ignite |
|
||||
| FuelCaution | | Hold | Flow | Hold | Hold | Hold | Warm | Ignite | Ignite | Warm | Ignite | Ignite |
|
||||
| FuelCritical | | | Hold | Hold | Hold | Hold | Ignite | Ignite | Ignite | Ignite | Ignite | Ignite |
|
||||
| CoolantSafe | | | | Hold | Flow | Flow | Hold | Short | Short | Hold | Quench | Quench |
|
||||
| CoolantCaution | | | | | Hold | Flow | Short | Short | Short | Hold | Quench | Quench |
|
||||
| CoolantCritical | | | | | | Hold | Short | Short | Short | Hold | Quench | Quench |
|
||||
| ElectricitySafe | | | | | | | Hold | Flow | Flow | Hold | Hold | Hold |
|
||||
| ElectricityCaution | | | | | | | | Hold | Flow | Hold | Hold | Hold |
|
||||
| ElectricityCritical | | | | | | | | | Hold | Hold | Hold | Hold |
|
||||
| HeatSafe | | | | | | | | | | Hold | HeatFlow | HeatFlow2 |
|
||||
| HeatCaution | | | | | | | | | | | Hold | HeatFlow |
|
||||
| HeatSafe | | | | | | | | | | Hold | Flow | Flow |
|
||||
| HeatCaution | | | | | | | | | | | Hold | Flow |
|
||||
| HeatCritical | | | | | | | | | | | | Hold |
|
||||
|
||||
Design rules:
|
||||
@@ -422,7 +401,7 @@ The editor authors:
|
||||
- underground fuel, coolant, and electricity cells
|
||||
- flow props and consumer props
|
||||
- reactor controls and reactor consumer bindings
|
||||
- junction props and ratio modes
|
||||
- junction props and balance-defined ratio mode index
|
||||
- door props and door edges
|
||||
- all-seeing-eye terminals
|
||||
- remedy supplies
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using ReactorMaintenance.Simulation.Difficulties;
|
||||
using ReactorMaintenance.Simulation.Difficulties;
|
||||
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation.Difficulties;
|
||||
namespace ReactorMaintenance.Simulation.Difficulties;
|
||||
|
||||
public class NormalBalancing : Balancing
|
||||
{
|
||||
@@ -30,6 +30,7 @@ public class NormalBalancing : Balancing
|
||||
public override float SourceIntensity => 8;
|
||||
public override float DistanceAmountFalloff => 0.5f;
|
||||
public override float DistanceIntensityFalloff => 0.4f;
|
||||
|
||||
public override IReadOnlyList<JunctionRatioPreset> TwoOutflowJunctionRatios { get; } = [
|
||||
new("0/4", [0, 1]),
|
||||
new("1/3", [0.25f, 0.75f]),
|
||||
@@ -37,12 +38,14 @@ public class NormalBalancing : Balancing
|
||||
new("3/1", [0.75f, 0.25f]),
|
||||
new("4/0", [1, 0])
|
||||
];
|
||||
|
||||
public override IReadOnlyList<JunctionRatioPreset> ThreeOutflowJunctionRatios { get; } = [
|
||||
new("0/3/3", [0, 0.5f, 0.5f]),
|
||||
new("3/0/3", [0.5f, 0, 0.5f]),
|
||||
new("3/3/0", [0.5f, 0.5f, 0]),
|
||||
new("2/2/2", [1f / 3f, 1f / 3f, 1f / 3f])
|
||||
];
|
||||
|
||||
public override float ConsumerRequiredAmount => 2.5f;
|
||||
public override float ConsumerRequiredIntensity => 2.5f;
|
||||
public override float LeakBaseAmount => 0.5f;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class GridPositionExtensions
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record JunctionRatioPreset(string Label, float[] Weights);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EEditorTool
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class LevelStateExtensions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class LevelStateFactory
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record DoorState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EBand
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ECarrierType
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ECellTerrain
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EConsumerServiceState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EDoorState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EForecastKind
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ELevelState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ENetworkValueKind
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EPropSwitchState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EPropType
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERemedyType
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERuleEffectKind
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERuleEventPhase
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ERulePredicateKind
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ESurfaceInteractionVerb
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum ESurfaceQuantity
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public enum EUndergroundState
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record Forecast(EForecastKind Kind, GridPosition? Position, int Turns, string Message);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record GlobalState
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record GridPosition(int X, int Y);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record LeakState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record LevelState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record PropState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ReactorBinding
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RobotState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RuleEffect
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RuleEventState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record RulePredicate
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record SurfaceState
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record UndergroundCell
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ValidationIssue(string Message, GridPosition? Position = null);
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record ValidationReport
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class RobotStateExtensions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed class SimulationEngine
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public sealed record SurfaceInteractionEffect
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
public static class SurfaceStateExtensions
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
namespace ReactorMaintenance.Simulation;
|
||||
|
||||
internal sealed class SimulationCoreSystem
|
||||
{
|
||||
@@ -704,4 +704,3 @@ internal sealed class SimulationCoreSystem
|
||||
|
||||
private readonly LevelValidator m_Validator = new();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
|
||||
Reference in New Issue
Block a user