Skip to content

Create a project

New projects start from the giter8 template. It scaffolds a Godot project and an sbt build that are already wired together.

sbt new optical002/godot-scala-native-template.g8

You are prompted for:

Property Meaning Default
name Project name: Godot config/name and the output folder My Godot Scala Game
description Short project description A Godot 4 project with a Scala Native (GDExtension) game library.

Layout

my-godot-scala-game/
  godot/                         the Godot project (open this in the editor)
    project.godot
    entry.tscn                   main scene, contains a HelloWorld node
    scala.gdextension            generated by godotBuild
    addons/godot_scala/          editor plugin: build watcher + hot reload
    .scala/                      the built library lands here
  scala/                         the sbt build for your game library
    build.sbt
    project/plugins.sbt
    src/main/scala/game/
      HelloWorld.scala

The whole build definition is two small files.

scala/project/plugins.sbt
resolvers += "jitpack" at "https://jitpack.io"
addSbtPlugin("com.github.optical002.godot-scala-native" % "sbt-godot-scala-native" % "<version>")
scala/build.sbt
lazy val game = (project in file("."))
  .enablePlugins(GodotScalaNativePlugin)
  .settings(
    name := "game",
    scalaVersion := "3.8.1",
    godotProjectDir := baseDirectory.value / ".." / "godot"
  )

The plugin adds the matching scala-native-gdextension binding (same version), the JitPack resolver for it, the Scala Native dynamic-library settings, the class scanner, and the godotBuild task. See the sbt plugin reference for every setting.

Version

The template always pins the newest release on JitPack: a scheduled job in the template repo bumps it within an hour of a new release. Your generated project keeps that exact version until you change it. See Upgrading a project.

Build

cd scala
sbt godotBuild

godotBuild compiles, links the native library, swaps it into godot/.scala/, and writes godot/scala.gdextension. The first run downloads dependencies and takes a few minutes. Later runs are incremental.

First import

A freshly scaffolded Godot project must be imported once. That step registers the GDExtension and resolves scene UIDs. Opening godot/ in the editor does it automatically. For a headless workflow, run it once yourself:

godot --headless --path ../godot --import

Run

godot --path ../godot

The HelloWorld node in entry.tscn prints this to the Output panel or stdout:

Hello from scala! (speed=10.0)

Next: Your first class.