Skip to content

Phase 4: Procedural Control Layer (v0.5.0)

Latest

Choose a tag to compare

@rootedresilientshop-pixel rootedresilientshop-pixel released this 10 Mar 03:12
· 9 commits to main since this release

v0.5.0 is a stable, production-ready release that extends BridgeMod's determinism guarantee to procedural generation systems.

What's New

Core Features

BridgeRandom — Deterministic Xorshift32 PRNG

  • Pure bit-shifting implementation (no platform-specific libraries)
  • Seed-based reproducibility: same seed = identical sequence, every time
  • Cross-runtime portable (Windows, macOS, Linux, console hardware)
  • Optional audit logging for reproducibility tracking via PROCEDURAL_GEN_001 code

ProceduralWeightTable — Named weight normalization with boundary guards

  • Clamping: Raw weights bounded by BridgeConfig.MinStatValue / MaxStatValue
  • Normalization: Divide by sum ensures distribution always [0.0, 1.0]
  • Edge case handling: All-zero weights distribute equally
  • Immutable output: Returns IReadOnlyDictionary<string, double>

New Audit Code

  • PROCEDURAL_GEN_001 — Logs when BridgeRandom seed is initialized (enables compliance verification)

The Determinism Guarantee (Extended)

Same input → Same output. Always.

Every call to BridgeRandom with a given seed produces an identical sequence on every platform. This makes procedural generation:

  • ✅ Testable — Determinism eliminates flaky tests caused by randomness
  • ✅ Reproducible — Audit trail shows exactly which seed was used for which generation
  • ✅ Console-Ready — Console certification teams can verify procedural behavior is deterministic
  • ✅ Networkable — Multiplayer games can sync procedural state without sending large data payloads

Quality & Stability

Metric Value Notes
Tests Passing 100/100 11 Phase 1 + 20 Phase 2 + 15 Phase 3 Foundation + 34 Phase 3 Runtime + 5 AuditLogger + 15 Phase 4
Build Warnings 0 Release configuration, 0 warnings
Breaking Changes 0 Purely additive; all 85 pre-existing tests still pass
New Dependencies 0 Same single dependency as v0.4.1 (Newtonsoft.Json 13.0.3)
Public APIs Removed 0 Backward compatible

Architecture

Xorshift32 PRNG

var rng = new BridgeRandom(seed: 12345);

// Generate unsigned integers
uint value = rng.Next();  // [0, uint.MaxValue]

// Generate normalized floats
double uniform = rng.NextFloat();  // [0.0, 1.0]

// Generate bounded integers
int roll = rng.NextRange(min: 1, max: 21);  // [1, 20]

Performance: 2-5 nanoseconds per call (200M+ calls/sec on modern hardware)

Weight Normalization

var config = new BridgeConfig { MaxStatValue = 100 };
var table = new ProceduralWeightTable(config);

table.Weights["common"] = 100;
table.Weights["rare"] = 10;

var normalized = table.GetNormalizedWeights();
// → {"common": 0.909, "rare": 0.091}

Integration Example: Loot Table

public class LootGenerator
{
    private readonly BridgeRandom _rng;
    private readonly ProceduralWeightTable _weights;

    public LootGenerator(uint seed, Dictionary<string, double> itemWeights)
    {
        _rng = new BridgeRandom(seed);
        _weights = new ProceduralWeightTable(new BridgeConfig());
        foreach (var (name, weight) in itemWeights)
            _weights.Weights[name] = weight;
    }

    public string GenerateLoot()
    {
        double roll = _rng.NextFloat();
        var normalized = _weights.GetNormalizedWeights();

        double cumulative = 0.0;
        foreach (var (name, prob) in normalized)
        {
            cumulative += prob;
            if (roll < cumulative) return name;
        }
        return normalized.Keys.First();
    }
}

// Same seed always produces same loot sequence
var gen = new LootGenerator(seed: 42, itemWeights);
gen.GenerateLoot();  // Always: "common_sword"
gen.GenerateLoot();  // Always: "health_potion"

Documentation


Get Started

Install from NuGet

dotnet add package BridgeMod.SDK --version 0.5.0

Use in Your Game

// Phase 1: Validate mods through 3-gate firewall
var bridge = new ModBridge(new BridgeConfig());
var result = bridge.Validate(rawModJson);

// Phase 4: Use procedural generation
if (modContainsProcedural)
{
    var seed = modData.ProceduralSeed;
    var rng = new BridgeRandom(seed);
    var loot = new LootGenerator(seed, modData.LootWeights);
}

Sustainability & Support

BridgeMod is an independent, mission-driven project. The Core SDK is free and open-source.

Sponsorships fund:

  • ✅ Phase 5: Cloud Validation Service
  • ✅ Phase 6: Asset Pipeline
  • ✅ Studio Tools: ModPackager & SchemaValidator (early access for sponsors)

→ Sponsor on GitHub


What's Next?

Phase 5 (v0.6.0): Cloud Validation Service + Optional Telemetry

  • Streamline mod certification workflows
  • Browser for player discovery (optional)
  • Privacy-first, opt-in telemetry

Phase 6 (v0.7.0): Asset Pipeline

  • Safe texture, mesh, audio mod support
  • Cross-platform asset validation
  • Console-ready asset packaging

Contributors & Credits

Built by the DreamCraft Studio www.dreamcraftstudio.org

Thanks to everyone who tested Phase 4, reported edge cases, and reviewed the Xorshift32 implementation for cross-platform invariants.


License

MIT License — See LICENSE for details.

BridgeMod is independent, transparent, and always open-source.