New Year, more Godot! I’m finally taking the time to make my windows environment as comfy as I can make it. My day job has me working on macOS/linux so I’m familiar with just running stuff with simple shell scripts, maybe a makefile, and I’m off to the races.

With Godot I’m developing primarily on Windows, in Neovim, and using the Rust GDExtension. Trying to stay in the flow of coding and iterating starts to become important so today I decided to spend some time setting up some scripts to help with that flow.

A Task Runner

I’ve usually relied on makefiles in the past, despite their issues. But on Windows I didn’t have the patience with dealing with them. Enter just. It takes out some of the oddities of make and streamlines a few aspects. So far I was liking it for its simplicity; especially since I’m already working in rust so getting started was just:

cargo install just

Then I make a justfile with…

# use PowerShell instead of sh:
set shell := ["powershell.exe", "-Command"]

…at the top since I’m using Windows Terminal and Powershell.

GDExtension

I’m using Godot’s Rust GDExtension and it’s been great! While they have added support for reloading your GDExtension without having to bounce the editor, it seems to only work some of the times. So my workflow, to avoid confusion on what’s actually happening, has been to bounce the editor when I’m doing any major code changes. The other perk is Godot is so lightweight that bouncing the editor is almost no cost compared to the likes of Unity or Unreal. I’m not sure if that’ll stay the same as the project grows, but for now it works :). So to keep the iteration loop tight I created two just targets where one builds my rust lib and then another launches the Godot project with the editor. Below is how that looks:

# use PowerShell instead of sh:
set shell := ["powershell.exe", "-Command"]

alias s := run-server
alias c := run-client

build-client:
  cargo build --package my_client

run-client: build-client
  godot --path "G:\dev\projects\my_godot_project\gd_client" -e -w --resolution 1920x1080; Read-Host

# ...other targets related to server/test stuff...

build-client is pretty self explanatory, but the run-client task took some fiddling with to get it to work the way I wanted. Namely the addition of Read-Host so that the script wouldn’t exit and I could easily see output from Rust. Without it just will spawn a new instance of the shell, godot will launch, and the shell exits and you won’t see any issues from the Rust side. Without any output from the Rust side I would be running blind on what’s going on in the app. Running the godot command from the terminal directly worked, so I was a bit perplexed at first with what was going on.

Current Working Directory

Another issue I ran into in my project was having the working directory change so that .env files could be found or other relative path stuff. To do that I prepended the relevant command with a cd whatever; like below:

  cd "crates_client\client"; godot --path "G:\dev\projects\my_godot_project\gd_client" -e -w --resolution 1920x1080; Read-Host

Anyway, here’s to hoping this saves someone a few minutes and they find it useful if they are trying to setup their own native Godot workspace :).

References

  1. just tool
  2. Quickstart for Windows