BridgeMod.SDK 0.4.1

dotnet add package BridgeMod.SDK --version 0.4.1
                    
NuGet\Install-Package BridgeMod.SDK -Version 0.4.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BridgeMod.SDK" Version="0.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BridgeMod.SDK" Version="0.4.1" />
                    
Directory.Packages.props
<PackageReference Include="BridgeMod.SDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BridgeMod.SDK --version 0.4.1
                    
#r "nuget: BridgeMod.SDK, 0.4.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BridgeMod.SDK@0.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BridgeMod.SDK&version=0.4.1
                    
Install as a Cake Addin
#tool nuget:?package=BridgeMod.SDK&version=0.4.1
                    
Install as a Cake Tool

BridgeMod.sdk

NuGet Version License: MIT Build Status SDK Version

A security-first SDK for bridging PC modding toolchains with console game engines.


The Problem: The PC-Console Modding Gap

PC game modding has a rich, open ecosystem. Tools like Nexus Mod Manager, custom asset pipelines, and community-built editors allow players to reshape their game worlds freely. Consoles do not.

Console platforms operate in a locked, trusted execution environment. Every asset, script, and data packet that touches a console's game state must be verified and sanitized before it is allowed in. There are two core reasons:

Risk Description
Untrusted Data A mod file authored on a PC has no chain of custody. It may contain malformed data, buffer overflows, or values that exploit unchecked boundaries in the game engine.
Security Boundary Violation Consoles enforce strict memory and process sandboxes. A single unvalidated integer — passed as an array index — can overwrite protected memory, crash the title, or worse.

The gap is not a technology problem. It is a trust problem. PC mods are born in an untrusted environment and must earn their way into a trusted one.


The Solution: A Modding Firewall

BridgeMod.sdk acts as a firewall between the wild west of PC mod files and the locked gate of the console game runtime.

Just as a network firewall inspects every packet against a ruleset before forwarding it, BridgeMod inspects every mod payload against a validation schema before it is allowed to influence game state.

High-Level Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        PC MOD TOOLCHAIN                         │
│  (Nexus, Custom Editor, JSON/XML Payloads, Community Scripts)   │
└──────────────────────────────┬──────────────────────────────────┘
                               │  Raw / Untrusted Payload
                               ▼
┌─────────────────────────────────────────────────────────────────┐
│                      BridgeMod.sdk  v0.2.2                      │
│                                                                 │
│  ┌─────────────┐   ┌──────────────┐   ┌──────────────────────┐ │
│  │  Deserialize│──▶│  Boundary    │──▶│  Audit Logger        │ │
│  │  & Parse    │   │  Guards      │   │  (tamper-evident log)│ │
│  └─────────────┘   └──────┬───────┘   └──────────────────────┘ │
│                           │                                     │
│                    PASS / REJECT                                 │
└─────────────────────────────────────────────────────────────────┘
                               │  Sanitized / Verified Payload
                               ▼
┌─────────────────────────────────────────────────────────────────┐
│                   CONSOLE GAME RUNTIME                          │
│  (DreamCraft: Legacies Simulation Engine — Trusted Boundary)    │
└─────────────────────────────────────────────────────────────────┘

Every payload traverses three gates:

  1. Deserialize & Parse — Structural integrity check. Malformed data is rejected before it touches any game logic.
  2. Boundary Guards — Value-range enforcement. Stat values, item counts, and entity IDs are clamped or rejected against defined schemas.
  3. Audit Logger — Every accepted and rejected payload is recorded with a timestamp and reason code, producing a tamper-evident trail for post-incident analysis.

Verification Summary

The following test cases validate the three critical security layers of BridgeMod.sdk 0.2.2:

# Test Case Payload Type Expected Result Status
1 Standard Mod Load Valid character JSON, all values in-bounds Payload accepted, character state updated PASS
2 Malicious Payload Rejection Injected script tag inside a string field Deserializer strips tag; payload rejected with PARSE_ERR_001 PASS
3 Boundary Guard — Stat Overflow health: 999999 (max allowed: 9999) Value clamped to 9999; audit log entry written with BOUND_CLAMP_003 PASS

Full test source: tests/test_pulse_engine.py | Legacies_Bridge_Test/pulse_test.py


Quick Start

Requirements

  • .NET 6.0+ (for C# bridge layer)
  • Python 3.10+ (for simulation engine)
  • Docker (optional, recommended for full stack)

Installation

# Install the SDK via NuGet
dotnet add package BridgeMod.sdk --version 0.2.2

# Clone the repository and run the sample
git clone https://github.com/dreamcraft/bridgemod-sdk.git
cd bridgemod-sdk
docker compose up --build -d

Run the Bridge Test Sample

# Python simulation engine (the trusted side)
python Legacies_Bridge_Test/pulse_test.py

# C# bridge layer (the mod intake side)
dotnet run --project Legacies_Bridge_Test

See Legacies_Bridge_Test/Sample_Walkthrough.md for a step-by-step developer tutorial.


Project Structure

dreamcraft_v2/
├── api/                        # FastAPI REST + WebSocket layer
├── data/                       # Schema, seed data, DB setup
├── llm/                        # Ollama-compatible LLM client
├── simulation/                 # Core 4-stage pulse engine
├── Legacies_Bridge_Test/       # Sample: C# Bridge + Python Engine
│   ├── Program.cs              # C# SDK entry point (annotated)
│   ├── pulse_test.py           # Python bridge validation tests
│   └── Sample_Walkthrough.md  # Developer tutorial
├── scripts/                    # Deployment and sync utilities
├── tests/                      # Pytest test suite
├── CHANGELOG.md                # Version history
└── README.md                   # This file

Contributing & Using in Unity

BridgeMod.sdk is designed to be embedded in any C# game engine environment — including Unity.

For full integration guidance, roadmap, and console platform targets, see: console_modding_execution_plan.md

How to Contribute

  1. Fork this repository and create a feature branch from main.
  2. All new validation rules must include a corresponding test in tests/ and an entry in CHANGELOG.md.
  3. For security-sensitive changes (boundary guard logic, audit logger), request review from a maintainer before merging.
  4. Open a pull request with a clear description of the problem solved and the verification approach used.

Unity Integration (Quick Reference)

// 1. Add BridgeMod.sdk to your Unity project via NuGet for Unity or manual DLL reference.
// 2. Initialize the bridge in your GameManager Awake() method.

using BridgeMod.Bridge;

var bridge = new ModBridge(new BridgeConfig
{
    MaxStatValue   = 9999,
    EnableAuditLog = true,
    AuditLogPath   = Application.persistentDataPath + "/bridgemod_audit.log"
});

// 3. Pass any incoming mod payload through the bridge before applying it to game state.
var result = bridge.Validate(incomingModPayload);
if (result.IsValid)
{
    ApplyToGameState(result.SanitizedPayload);
}

License

MIT License — see LICENSE for details.

Built for DreamCraft: Legacies — a Cloud-Sovereign medieval simulation platform. Oracle Cloud ARM · Raspberry Pi 5 · Offline-first · Player-owned data.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.1 34 2/27/2026
0.4.0 84 2/21/2026
0.3.0 87 2/19/2026
0.2.4 88 2/17/2026
0.2.3 86 2/17/2026
0.2.2 89 2/14/2026
0.2.1 90 2/14/2026
0.2.0 94 2/11/2026
0.1.0 91 2/6/2026

v0.4.1 — Observability Update

     New Features:
     • AuditLogger.FlushToDisk(path) — Thread-safe JSON file persistence for audit logs with no-throw guarantee
     • Stuck State Detector — BehaviorGraphExecutor now logs WARN_STUCK_001 when no transitions match an event
     • Premium Studio Tools Announcement — SchemaValidator CLI and ModPackager in development

     Improvements:
     • Thread-safe audit logging via lock pattern
     • Phase 3 API documentation fixes (Validate, Initialize, Dispatch accuracy)
     • Backward compatible: all 80 pre-existing tests pass unmodified

     Quality:
     • 85/85 tests passing (80 existing + 5 new observability tests)
     • 0 compiler warnings in Release configuration
     • Full determinism guarantee maintained