Skip to content

outfox/2dog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

420 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

How do you pronounce Godot? ๐Ÿฆด

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 Build Status CI

"Godot, or to dog... is it even a question?"

Bring your existing C# Godot game to the web. Keep your scenes, scripts, and Godot workflow.

2dog packages Godot as a library hosted by your .NET application. That inversion makes browser publishing, ordinary dotnet tooling, and first-class xUnit testing possible without rewriting your game.

Same Game, New Tricks

If you already build games with Godot and C#, most of your world stays exactly where it is:

  • Your Godot project remains a Godot project and still opens in the editor.
  • Your scenes, resources, C# scripts, signals, and exports keep working.
  • You still use the familiar GodotSharp API.
  • Asset import happens automatically during dotnet build.

What changes is who holds the leash: your .NET process starts Godot, drives its main loop, and decides when it stops.

That unlocks a few useful tricks:

  • ๐ŸŒ C# games on the web: publish a static WebAssembly site with dotnet publish.
  • ๐Ÿงช Real test projects: load scenes through xUnit and run headless in CI.
  • ๐Ÿ”„ A .NET-owned lifecycle: embed Godot in an app, server, tool, or custom host.
  • ๐ŸŽฎ The full engine: scenes, physics, rendering, audio, input, and the GodotSharp API.

Choose Your Starting Point

Both routes produce the same strongly recommended layout: the Godot project is the solution root, with desktop, browser, and test hosts nested inside it.

Bring an Existing Project (Recommended)

Convert in place. 2dog preserves your existing game content, and there is no tool installation step. A classic .sln is migrated to .slnx when present:

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

Start a New Project

Register the project template once, then create the same complete layout from scratch:

dotnet new install 2dog
dotnet new 2dog -n MyGame
cd MyGame
dotnet run --project MyGame.2dog

In either case, your original Godot workflow is still there whenever you need it:

godot-mono --editor .

From Godot Project to Browser

The generated web host publishes your C# game as a static site. Install the .NET WebAssembly tools once, then publish and serve the bundle:

dotnet workload install wasm-tools
dotnet tool install --global dotnet-serve
dotnet publish MyGame.web
dotnet serve --directory MyGame.web/AppBundle

See Web / Browser for the development loop, deployment options, and current limitations.

One Project, Three Hosts

MyGame/                       Godot project and solution root
โ”œโ”€โ”€ project.godot             Scenes, scripts, assets, project settings
โ”œโ”€โ”€ MyGame.csproj             Godot C# game assembly
โ”œโ”€โ”€ MyGame.2dog/              Desktop .NET host
โ”œโ”€โ”€ MyGame.web/               Browser WebAssembly host
โ””โ”€โ”€ MyGame.tests/             Headless xUnit host

The nested hosts carry .gdignore, so Godot ignores them. Your game project remains clean and editor-friendly while each host gets its own entry point and dependencies.

Read The Recommended Project Layout for the complete mental model.

Pick Your Next Trick

Full documentation lives at 2dog.dev.

Requirements and Status

  • .NET SDK 10.0 or later
  • Godot .NET editor only when you want to edit scenes visually
  • Supported platforms: win-x64, linux-x64, and osx-arm64
  • Packages are available on NuGet

The 2dog package contains the converter and project template. Applications reference the 2dog.engine library; test projects add 2dog.xunit. Generated and converted projects configure these packages for you.

One Dog at a Time

Only one Godot instance can run in a process at a time. Sequential restart is supported: dispose the current instance before starting another. The supplied xUnit collections already serialize Godot fixtures correctly.

See Known Issues for details and workarounds.

Teach 2dog New Tricks

Want to work on 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 demo with dotnet run --project demo/demo.2dog and the tests with dotnet test twodog.tests.

Questions, ideas, or particularly good sticks? Join the Dog Park:

Discord Invite


No squirrels were harmed in the making of this README.

About

๐Ÿฆด 2dog is Godot in .NET

Topics

Resources

License

Stars

136 stars

Watchers

2 watching

Forks

Contributors

Languages