Skip to content
ktox-dota logo

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-dota Gradle plugin — the build system: transpiles your Kotlin to Lua and Panorama JS, compiles .dota.xml.kts layouts and Sass, generates the addon's scripts/npc KeyValues from typed annotations, and deploys everything into your live dota_addons/<name> directories with a fast dev watch 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 buildsbuildAddon / syncAddon / dev tasks handle Lua, Panorama JS, layouts, Sass, KeyValues, and deployment.
  • Generated scripts/npc KeyValues — annotate classes with @AbilityKv, @ItemKv, @UnitKv, or @HeroKv and the build writes the matching KV entries, including automatic precache blocks.
  • Engine-bound classes@Dota2Class lowers abilities, items, and modifiers to the engine's class({}) 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; @NativeName annotations preserve the original engine names.
  • Enum safety — all integer flag enums are represented as Kotlin enum class values.
  • 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@PanoramaView classes give Panorama panels typed child selectors, generated bootstrap wiring, and optional snippet-based XML reuse.
  • Live dev modegradlew dev re-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.