com.IvanMurzak.Brutal.MCP.Box2D 0.1.0

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

Brutal-MCP Box2D

Brutal-MCP extension for Ahwoo.BRUTAL.Box2D (Box2D v3): lets AI agents read and change a running game's 2D physics through RQL (rql-query / rql-mutate).

dotnet add package com.IvanMurzak.Brutal.MCP.Box2D

The one line the game needs (after Box2D.CreateWorld):

BrutalMcpBox2D.Register(world, "World");

Optional: BrutalMcpBox2D.Register(playerBody, "Player") for bodies agents should always see. Bodies that move in a registered world are remembered automatically at every BrutalMcp.Tick() (the extension's BrutalMcp.Ticked handler reads the world's last-step move events). Call BrutalMcpBox2D.CollectMovedBodies(world) right after each world.Step(...) yourself when the game steps several times per tick or does not register the world. Worlds and bodies held in static fields, or in fields of objects passed to BrutalMcp.Register, are found without registering. Call BrutalMcpBox2D.Unregister(world) before destroying a world. The game must call BrutalMcp.Tick() once per frame (outside Step): every read and write runs there (Box2D is not thread-safe).

RQL

Source Content
worlds2d worlds: Name Id Valid Gravity (settable) AwakeBodyCount BodyCount ShapeCount ContactCount JointCount IslandCount StepMs Profile SleepingEnabled ContinuousEnabled (settable) Bodies; calls Explode(position, radius, impulsePerLength), CastRayClosest(origin, translation)
bodies2d known bodies: Id Name World Valid Type Position Angle LinearVelocity AngularVelocity Mass Awake Enabled GravityScale LinearDamping AngularDamping FixedRotation Bullet ShapeCount (settable where it makes sense); calls ApplyLinearImpulseToCenter(v), ApplyForceToCenter(v), ApplyAngularImpulse(x), SetTransform(position, angle)
worlds2d | select Name Gravity AwakeBodyCount BodyCount StepMs
bodies2d | where Name == "Player" | set Position = "(0, 4)", LinearVelocity = "(0, 0)"
bodies2d | where Name == "Player" | call ApplyLinearImpulseToCenter("(0, 20)")
worlds2d | call Explode("(0, 0)", 5, 10)

Limitations

  • Box2D has no API to enumerate a world's bodies. bodies2d shows registered / field-held bodies plus bodies that moved during the last step (from b2World_GetBodyEvents), plus every body that moved at a tick in a registered world; static bodies that never moved appear only once registered.
  • Every native call first checks b2Body_IsValid / b2World_IsValid (Box2D asserts on stale ids): destroyed bodies read Valid == false and reject writes.
  • Angles are computed in managed code: the package's B2Rot.GetAngle and the other inline math helpers (b2Rot_GetAngle, b2MakeRot, …) are not exported by the shipped native library.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 123 10/17/2026