kogot

April 24, 2026 · View on GitHub

Warning

This project is in heavy development and is not ready for production use. Expect breaking changes, incomplete APIs, and rough edges. You're welcome to explore the code, but don't build anything serious on it yet.

kogot is an experimental Kotlin/Native binding for Godot 4.6+ via the GDExtension interface. The goal is to bring Kotlin to Godot with the same philosophy as godot-rust/gdext — a mechanical, verifiable projection of Godot's official API contract, with a minimal generated runtime layer.

What Works (Early Stage)

FeatureStatus
Engine classes (codegen from Godot JSON API)~2000+ files generated. Done
Builtin types: String, Array, Dictionary, VariantDone. Pending improvements
Class registration (register(), freeInstance(), createInstance())Done. Pending processor
MethodBind calls via invoke() with Variant conversionPending
Properties (@Export annotation)Pending
Virtual methods (NodeVirtualCalls, NodeVirtualDispatcher)In progress
Signals (Signal0 — zero args)Design
Signals with params (Signal1..22)Design

Architecture

User Code (@Godot class)

processor/KogotProcessor (KSP annotation processing)

codegen/ → kotlin-native/api/build/generated/ (2000+ generated .kt files)

kotlin-native/binding/ (runtime class registration)

kotlin-native/ffi/ (GDExtension FFI via cinterop)

Godot Engine (C++)

Project Structure

kogot/
├── analysis/              # KSP backend-agnostic metadata extraction
├── codegen/               # Godot API model + KotlinPoet code generation
├── processor/             # KSP compiler plugin (annotation processing)
├── kotlin-native/
│   ├── annotations/       # User annotations: @Godot, @Export, @Rpc, @Tool
│   ├── api/               # Generated Godot API classes (build/generated/)
│   ├── binding/           # Runtime binding registration
│   ├── ffi/               # Low-level FFI to Godot C functions via .def cinterop
│   └── runtime/           # Kotlin/Native runtime support
├── jvm-ffm/               # Java FFM integration (incomplete)
├── build-logic/           # Gradle convention plugins (including jextract-gradle-plugin)
├── mi-juego-prueba/       # Test Godot project
└── docs/                  # Design docs, roadmap, and exploration notes

Generated API Sample

// Generated from Godot's JSON API — DO NOT EDIT
class GodotString(rawPtr: COpaquePointer?) : GodotNative, AutoCloseable {
    constructor()  // empty string
    constructor(from: GodotString)  // copy constructor
    constructor(value: String)  // from Kotlin String
    override fun close() { ... }
}

// Generated Node class with full Godot API projection
public open class Node(nativePtr: COpaquePointer) : GodotObject(nativePtr) {
    public var name: StringName
    public var uniqueNameInOwner: Boolean
    public var sceneFilePath: GodotString
    // ... full Godot Node API
}

User Annotations

@Godot class MyNode(nativePtr: COpaquePointer) : Node(nativePtr) {
    @Export var health: Int = 100

    companion object {
        val isDeadSignal: Signal0 = signal("is_dead")
        val healthSignal: Signal1<Int> = signal("health", param<Int>("value"))
    }
}

Build

./gradlew assemble

Roadmap

Follow the project board for updates.

References