A Godot 4.5 GDExtension project for visualizing and simulating electronic circuits. Parses xschem .sch schematics and .sym symbol files, renders them in 2D/3D, and optionally runs SPICE simulations via ngspice.
git clone https://github.com/ismilesen/circuit-simulator.git
cd circuit-simulator
git submodule update --init godot-cpp src/xschem2spice
Do not use --recursive for the normal app build. The xschem2spice
repository contains large test-fixture submodules, and one nested test
dependency uses an SSH URL. Those tests are not needed to compile this project.
If you already cloned without submodules:
git submodule update --init godot-cpp src/xschem2spice
scons
This compiles the C++ source in src/, including the src/xschem2spice
submodule library sources, and places the resulting shared library in
project/bin/.
For web exports, install and activate Emscripten before building:
scons platform=web target=template_debug threads=no
scons platform=web target=template_release threads=no
If SCons reports Required toolchain not found for platform web, Emscripten is
not active in the shell that is running the build.
The simulator dynamically loads ngspice at runtime. To enable simulation:
ngspice.dll (Windows) or libngspice.so (Linux) and sharedspice.h in a new folder named ngspice.CPPPATH line in SConstruct.Open the project/ folder as a Godot project (Godot 4.5+).
.sch schematic files in project/schematics/..sym symbol files in project/symbols/sym/, or upload them alongside the schematic..sch upload is converted to a generated .spice netlist with xschem2spice; uploading a separate netlist is optional.circuit-simulator/
├── godot-cpp/ # Git submodule (Godot C++ bindings)
├── src/ # C++ GDExtension source (CircuitSimulator, SchParser)
├── project/ # Godot project
│ ├── bin/ # Built shared libraries + .gdextension
│ ├── camera/ # 3D camera controller
│ ├── parser/ # GDScript .sym parser
│ ├── scripts/ # 3D circuit visualizer script
│ ├── symbols/ # Circuit symbol GDScript + sym/ for .sym files
│ ├── schematics/ # Place .sch files here
│ └── ui/ # Upload panel and sidebar UI
│ └── visualizer/
│ └── simulator/
├── SConstruct # Build configuration
└── README.md