01.Setting up the project - godot-nim/gdext-nim GitHub Wiki
At first, please work according to the contents of Godot Docs - Setting up the project.
We will start the project in the following state:
.
โโโ art
โ โโโ enemyFlyingAlt_1.png
โ โโโ enemyFlyingAlt_2.png
โ โโโ enemySwimming_1.png
โ โโโ enemySwimming_2.png
โ โโโ enemyWalking_1.png
โ โโโ enemyWalking_2.png
โ โโโ gameover.wav
โ โโโ House In a Forest Loop.ogg
โ โโโ playerGrey_up1.png
โ โโโ playerGrey_up2.png
โ โโโ playerGrey_walk1.png
โ โโโ playerGrey_walk2.png
โโโ fonts
โ โโโ FONTLOG.txt
โ โโโ LICENSE.txt
โ โโโ Xolonium-Regular.ttf
โโโ icon.svg
โโโ icon.svg.import
โโโ project.godot
Development with gdext-nim depends on the following software Please make sure that you meet the requirements.
| Software | Confirmation |
|---|---|
| Godot >= 4.4 |
godot --version: 4.4.X.stable.YYY
|
| Nim >= 2.0 | nim -v |
| gdext >= 0.10 | nimble list -i | grep gdext |
Let's define a new extension by executing the following command in your project root (the folder that project.godot is placed):
gdextwiz new-extension nimmainThat will create a nim/ folder as follows:
.
โโโ nim
โ โโโ nimmain
โ โโโ bootstrap.nim
โ โโโ config.nims
โ โโโ src
โ โโโ classes
โ โโโ gdmyclass.nim
โ
Let's quickly build the extension and make sure gdext works.
gdextwiz buildThe gdextwiz build command builds the specified Nim extension. If unspecified, all buildable extensions are targeted.
Did you succeed in your build? If so, you would like to add some nodes to your scene. Conveniently, the gdextwiz new-extension command defines a MyClass class as a sample. Let's add this one.

Note
For those familiar with GDNative (pre-Godot 3 expansion system):
As you can see, classes defined using GDExtension are registered in the engine's class database as entirely new classes, not scripts.
It is a sad decision, but MyClass is no longer needed, so let's delete it. Delete the file nim/nimmain/src/classes/gdmyclass.nim and remove the import statement from nim/nimmain/src/bootstrap.nim.
# nim/nimmain/src/bootstrap.nim
import gdext
- import classes/gdMyClass
GDExtensionEntryPointbootstrap.nim is the entry point for the Nim extension. By importing the required classes from this file, they will be recognized by the engine.
Now let's rebuild the extension and focus the editor, and you will see that MyClass can no longer be added to the scene. As you can see, gdext-nim supports hot reloading. You can proceed with development without restarting the editor.
Nevertheless, the integration between gdext-nim and Godot Editor is not perfect. If you encounter a puzzling error, try restarting the editor once.