I’ve been playing around with Godot a bit recently, a promising 2D/3D game engine that is completely open source. What most impressed me is that the entire engine is distributed as a 50MB binary. Compared to the 1GB+ installation size for Unity, this is pretty amazing.

Here are some quick instructions for debugging the Godot engine itself (i.e. rather than a game created in Godot) using VS Code:

  1. Make sure you have all the build requirements. Refer to the build documentation available here.

    • I ran into an issue with the scons command which would throw this error:

      Fatal Python error: Py_Initialize: unable to load the file system codec
      ModuleNotFoundError: No module named 'encodings'

      To fix, open scons.bat (mine was in C:\Python36\Scripts) and remove/comment the following line: set path=%dp0;%dp0..;%path%

  2. Clone/download the Godot engine source code from GitHub here.

  3. Open a terminal at the root directory of the source code and build using the following command: scons platform=windows target=debug

  4. In VS Code, open the source code root directory as the project folder.

  5. Go to Debug → Open Configurations and enter the following:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(Windows) Attach",
                "type": "cppvsdbg",
                "request": "attach",
                "processId": "${command:pickProcess}"
            }
        ]
    }
  6. Set a breakpoint somewhere in the code that you know will be hit. For example, Main::iteration() in main/main.cpp.

  7. Run bin/godot.windows.tools.exe.

  8. Go to Debug → Start Debugging then type in godot to find the running process and press ENTER.

  9. The debugger should now be attached to godot.windows.tools.exe and the breakpoint should be hit.

godot debug

Hi, I am Jeff Rimko!
A computer engineer and software developer in the greater Pittsburgh, Pennsylvania area.