ktox-dota
A Kotlin toolkit for Dota 2 addon and gamemode development — Lua (VScript), Panorama JS/Sass, layouts, and build tooling.
New here? Start from a working addon — ktox-dota-example is a complete project wired up with the plugin, the type libraries, and the layout DSL.
ktox-dota is more than type definitions — it is a complete Kotlin build pipeline for Dota 2 custom games:
ktox-dotaGradle plugin — the build system: transpiles your Kotlin to Lua and Panorama JS, compiles.dota.xml.ktslayouts and Sass, generates the addon'sscripts/npcKeyValues from typed annotations, and deploys everything into your livedota_addons/<name>directories with a fastdevwatch mode.lua-types— type stubs for the Dota 2 VScript (Lua) server-side API: game entities, abilities, items, enums, events, and more.panorama-types— type stubs for the Dota 2 Panorama JavaScript/TypeScript UI framework: panels, game events, CSS properties, and engine events.dota-panorama-layout-dsl— a type-safe Kotlin DSL for writing Panorama layouts (.dota.xml.kts) instead of raw XML.ktox-dota-lib— opinionated, ergonomic Kotlin wrappers over the raw Lua and Panorama APIs.
The type libraries are generated from the @moddota/dota-data JSON definitions, so they stay current with the game.
Key Features
- Full-addon builds —
buildAddon/syncAddon/devtasks handle Lua, Panorama JS, layouts, Sass, KeyValues, and deployment. - Generated
scripts/npcKeyValues — annotate classes with@AbilityKv,@ItemKv,@UnitKv, or@HeroKvand the build writes the matching KV entries, including automatic precache blocks. - Engine-bound classes —
@Dota2Classlowers abilities, items, and modifiers to the engine'sclass({})idiom with the correct native lifecycle hooks. - Complete type coverage — interfaces and classes for every documented Dota 2 API object.
- Idiomatic Kotlin — native names are mapped to camelCase properties and functions;
@NativeNameannotations preserve the original engine names. - Enum safety — all integer flag enums are represented as Kotlin
enum classvalues. - Event system — strongly-typed game events with
EventKey<T>and data class payloads. - Panorama panels — typed interfaces for every Panorama panel type and CSS property.
- Panorama classes —
@PanoramaViewclasses give Panorama panels typed child selectors, generated bootstrap wiring, and optional snippet-based XML reuse. - Live dev mode —
gradlew devre-transpiles and syncs single files on save, typically in tens of milliseconds.
Quick Start
Apply the plugin in the root project of a multi-module addon build:
plugins {
id("com.isycat.ktox-dota") version "<version>"
}
dotaAddon {
projectName = "myaddon" // the dota_addons/<name> directory
}
See the Usage page for the full guide, or browse the API reference in the tabs above.