Skip to content
outfoxPublic

Latest commit

Β 

History

1,100 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

2dog logotype, a white stylized dog with the negative space around its leg forming the number 2, and a playful font spelling the word dog

Discord Invite NuGet CI

🦴 2dog is Godot... just backward!

Godot normally loads .NET, now .NET loads Godot.

2dog is available fully precompiled from NuGet.org and as GitHub Releases. (no need to compile this repo)

2dog packages Godot as a library (a slightly modified libgodot) that your .NET application hosts. Keep your Godot project exactly as it is, and run it on the desktop, in the browser, inside a .NET UI, or under xUnit and NUnit with a real Godot engine, all with dotnet and your IDE.

πŸ“– Full documentation: 2dog.dev

Features

  • Your Godot project stays yours. Scenes, scripts and assets stay where they are; keep editing them in the official Godot .NET editor.
  • Godot C# on the web. dotnet publish your C# game to WebAssembly, with optional WebXR and experimental multithreading. More
  • Real-engine tests. xUnit and NUnit fixtures run headless in CI, with Godot-aware assertions for signals, frames and deferred deletion; Godot errors fail tests. GDScript tests run through gdUnit. More
  • Godot inside .NET UIs. Embed the engine in Avalonia, Blazor, WinForms, WinUI 3 or MAUI, with native controls over the game.
  • A C# REPL in your running game. Inspect and change live nodes from a terminal or a coding agent.
  • One tool for setup and upkeep. 2dog new, add, doctor and update scaffold hosts, diagnose build problems and keep package versions in step. More
  • No engine compile. Prebuilt natives for Windows, Linux, macOS, WebAssembly and Android come from NuGet.
  • Automatic import. Changed resources are imported during the build; no godot --import step.
  • Plain .NET projects. Each host is a normal project in your solution: build, debug and publish it like any other, including self-contained and NativeAOT desktop builds.

Hosts

The tool adds each host as a small nested project with its own .NET entry point:

Host What it does 2dog add flag
Desktop Run Godot from your own Main on Windows, Linux and macOS. --generic
Web Publish your Godot C# game to the browser. --web
WebXR Take your game into browser VR and AR. --webxr
Avalonia Embed Godot in a cross-platform desktop UI. --avalonia
Blazor Put Godot in a Blazor page and drive it from Razor components. --blazor
WinForms Embed Godot in a Windows Forms application. --winforms
WinUI 3 Embed Godot in a Windows App SDK application. --winui
MAUI Embed Godot in a MAUI page on Windows or Android. --maui
Android Β· experimental Build an APK with dotnet publish. --android
xUnit Test your game with xUnit. --xunit
NUnit Test your game with NUnit. --nunit
gdUnit Run GDScript gdUnit tests with dotnet test. --gdunit
C# REPL Explore and change your running game from a prompt. --repl

The showcase runs one Godot project across desktop, web, UI and Android hosts.

Getting started

You need the .NET 10 SDK. The Godot editor is optional and only needed to edit scenes visually.

Existing Godot project: from the folder with project.godot, pick hosts and run the desktop one.

cd path/to/MyGame
dnx 2dog add
dotnet run --project MyGame.2dog

New project:

dnx 2dog new MyGame
cd MyGame
dotnet run --project MyGame.2dog

MyGame stands for your project's name. Run dnx 2dog add again at any time to add another host, for example:

dnx 2dog add --web --xunit
dotnet publish MyGame.web     # game and index.html land in MyGame.web/AppBundle/
dotnet test MyGame.xunit

Each host is a nested folder that Godot ignores, so your project looks like this:

MyGame/
β”œβ”€β”€ project.godot      your scenes, scripts and assets, unchanged
β”œβ”€β”€ MyGame.csproj      your Godot C# game
β”œβ”€β”€ MyGame.slnx
β”œβ”€β”€ MyGame.2dog/       desktop host
β”œβ”€β”€ MyGame.web/        browser host
└── MyGame.xunit/      tests

Continue with the getting started guide, then the page for each host you added. Later, dnx 2dog update moves the project to new 2dog releases and dnx 2dog doctor finds and fixes problems.

Requirements and status

  • .NET SDK 10.0 or later on win-x64, linux-x64 or osx-arm64
  • Godot 4.7, with the official .NET editor for visual editing
  • Published builds: win-x64, linux-x64, osx-arm64 and browser-wasm; Android arm64/x64 is experimental
  • Web, WebXR and Blazor hosts need the wasm-tools workload; Android needs the android workload, the Android SDK and JDK 17. 2dog offers to install the workloads, and desktop and test builds need neither.

Packages are on NuGet and GitHub. The main ones are 2dog (the tool), 2dog.templates (the dotnet new templates) and 2dog.engine (the library); the tool adds the rest to your hosts.

Dogs and robots are nice

🦴β™₯οΈπŸ‘Ύ 2dog is proudly made by human maintainers and contributors. We permit extensive use of LLMs:

  • Forked libgodot features/fixes consist of similar amounts of human-written and machine-written code
  • Commits/PRs are reviewed & gated by both humans and machines (over 90%/90%) and signed by humans
  • .NET Host applications are mostly human-written, while boilerplate assets (e.g. XAML) are mostly machine-written
  • Configurations, tools, smoke tests, CSS, MSBuild XML, and CI workflows are overwhelmingly LLM-maintained
  • Documentation aims to be human-authored, but new feature docs are generated and later gradually rewritten
  • Releases on NuGet use Trusted Publishing and may only be invoked via direct human interaction

Compile your own: Teach 2dog new tricks (Contributors)

Want to contribute, modify, or add to 2dog itself? Clone with submodules, then build the native and .NET packages:

git clone --recursive https://github.com/outfox/2dog
cd 2dog
uv run poe build-all

Run the showcase with dotnet run --project demos/showcase/showcase.2dog and the tests with dotnet test twodog.tests.

The repository contains symlinks. On Windows, enable Developer Mode and run git config --global core.symlinks true before cloning. To repair an existing clone, run git config core.symlinks true, then git checkout -- demos/showcase/fps_counter.tscn.

Acknowledgements

Continuous Integration compute graciously supported by RunsOn.

Join us at the dog park

We have a dedicated channel for 2dog. Come say hello!

Discord Invite


No squirrels were harmed in the making of this README.