Bascule.RL 0.1.0-alpha

This is a prerelease version of Bascule.RL.
dotnet add package Bascule.RL --version 0.1.0-alpha
                    
NuGet\Install-Package Bascule.RL -Version 0.1.0-alpha
                    
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="Bascule.RL" Version="0.1.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bascule.RL" Version="0.1.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Bascule.RL" />
                    
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 Bascule.RL --version 0.1.0-alpha
                    
#r "nuget: Bascule.RL, 0.1.0-alpha"
                    
#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 Bascule.RL@0.1.0-alpha
                    
#: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=Bascule.RL&version=0.1.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Bascule.RL&version=0.1.0-alpha&prerelease
                    
Install as a Cake Tool

Bascule.RL

The Godot-free reinforcement-learning core behind Bascule — batched PPO for .NET, built on the Tensotron tensor + autograd engine. No Python, no socket bridge, no native runtime.

What it is

Bascule.RL is the reusable RL layer that Bascule's Godot addon adapts to game nodes — but it knows nothing about Godot, so you can drive it from a console sim, a test, or another engine. It provides:

  • Batched, not threaded, PPO — gather N environments' observations into one [N, obs] batch, run one policy forward pass per step (a single GEMM on GPU / one row-parallel SIMD matmul on CPU), scatter actions back. One matmul, not N.
  • Multi-channel ControlSpec — mixed continuous + discrete action channels described by data, so a gun, a car, and a joint are all "just controls" to the optimizer.
  • Two trainer shapes — Ppo owns its own rollout loop over an IEnvironment factory (console / headless); BatchedPpoTrainer is host-driven (Tick), for a game loop that owns the clock.
  • Stability built in — GAE, clipped surrogate, KL early-stop, and reactive LR backoff.
  • Model save/load — byte-exact serializer round-trip for shipping trained policies.

Quick shape

using Bascule.RL;

// 1. Describe what the agent can do — one channel per action, each normalized to [-1, 1].
var controls = new ControlSpec(new[] { new ControlChannel("thrust", -1f, 1f) });

// 2. Implement IEnvironment for your sim (ObservationSize, Controls, Reset, GetState, Step).
//    Then train:
var net = new ActorCritic(stateSize: 4, controls, hidden: 64);
var ppo = new Ppo(net, () => new MyEnv(), new Random(0)) { NumEnvs = 16, Horizon = 256 };
ppo.Train(iterations: 200, (iter, meanReturn) => Console.WriteLine($"{iter}: {meanReturn:F1}"));

For a game loop that owns the clock, use BatchedPpoTrainer and call Tick(observations, rewards, dones, actions) once per physics tick for all agents at once.

Status

0.1.0-alpha. Continuous / discrete / mixed action heads. Depends on Tensotron (float32-only; CUDA when a GPU is present, otherwise a hand-written SIMD CPU backend — the fast path for shipped, CPU-only inference).

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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. 
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.1.0-alpha 90 7/1/2026