Kanama: experimental Kotlin scripting for Godot through GDExtension + JVM

Hi everyone,

I’ve been working on Kanama, an experimental Kotlin scripting runtime for Godot.

Kanama lets you attach .kt files to Godot nodes as script resources, build them with Gradle/KSP, and run them through a GDExtension runtime powered by the JVM and Java’s Foreign Function & Memory API.

The goal is to keep the usual Godot workflow, but make Kotlin available for game code.

For example:

@ScriptClass(attachTo = "Node")
class HelloKanama(godotObject: MemorySegment) :
  KanamaScript<Node>(godotObject, ::Node) {
  @OnReady
  fun ready() {
    GD.print("Hello from Kotlin")
  }
}

In the editor, the Kotlin file is loaded as a script resource and can be attached to a node. The runtime handles script registration, lifecycle callbacks, Godot API calls, signals, exported properties, and hot reload.

Current status:

  • Experimental 0.1.0 preview available today
  • Targets Godot 4.7 beta 2
  • Desktop-first (macOS arm64, Windows x64, Linux x64, and Linux arm64)
  • Android export is experimental
  • iOS export is not available
  • Web export is not planned
  • Supports @Tool
  • Supports debugging in IntelliJ / Running projects
  • Comes with a companion addon to make it easy to build from within Godot 4.

Some difference compared to other solutions

  • No engine fork
  • No engine module
  • No JNI glue in game code
  • Uses Gradle/KSP for project scripts and generated script metadata
  • Generated Godot API wrappers are available and still growing

The companion demo repo includes several ported Godot projects and small gameplay samples. I’ve been using those demos, plus Bunnymark-style stress tests, to validate wrapper coverage, script dispatch, hot reload, and runtime performance.

The project is still early stage and I would not consider it production ready. If you need an established Kotlin integration for Godot today, you should also look at Godot Kotlin/JVM. Kanama is a separate approach built around stock Godot + GDExtension + Panama/FFM.

Links:

The project is licensed under MIT.

Plan is to have to make it available in the asset store when things are a bit more stable.

3 Likes

For a general idea on how the performance compares to C# and Godot/JVM, you can check kanama-demos/Bunnymark/BENCHMARK_RESULTS.md at main · falcon4ever/kanama-demos · GitHub - it does show some potential of what we can do with FFM.

1 Like

I am looking forward to be able to use Kotlin with Godot. Kotlin is an awesome language, and although I don’t hate on C#, it’s really kind of pointless - Kotlin has the same features usually in a better form. The only big exception may be value types, but even that is coming long-term.

Imho, you are picking the correct technical approach, not going with the JNI route, best of luck.