ModDota template
A template for Dota 2 Custom Games built with modern technologies.
This tutorial explains how to set up and use the template.
The template includes:
- TypeScript for Panorama
- TypeScript for VScripts
- Simple commands to build and launch your custom game
- Continuous Integration support
Getting Started
- Clone this repository or, if you're planning to have a repository for your custom game on GitHub, create a new repository from this template and clone it instead.
- Open the directory of your custom game and change
namefield inpackage.jsonfile to the name of your addon name. - Open terminal in that directory and run
npm installto install dependencies. You also should runnpm updateonce in a while to get tool updates.
After that you can press Ctrl+Shift+B in VSCode or run npm run dev command in terminal to compile your code and watch for changes.
Contents:
- [common_dts]: TypeScript .d.ts type declaration files with types that can be shared between Panorama and VScripts
- [game/scripts/vscripts]: TypeScript code for Dota addon (Lua) vscripts. Compiles lua to game/scripts/vscripts.
- [content/panorama/layout/custom_game]: TypeScript code for panorama UI. Compiles js to content/panorama/scripts/custom_game
--
- [game/*]: Dota game directory containing files such as npc kv files and compiled lua scripts.
- [content/*]: Dota content directory containing panorama sources other than scripts (xml, css, compiled js)
--
- [dota_types/*]: Generated TypeScript type declarations for Dota 2 Lua and Panorama APIs (git-tracked)
- [vendor/*]: Git submodules (dota-data, TypeScriptDeclarations) used for type generation (gitignored)
- [scripts/*]: Repository installation scripts
Regenerating Dota 2 Type Declarations
The dota_types/ directory contains pre-generated type declarations that are checked into git, so you don't need to regenerate them for normal development. If you want to update them after a Dota 2 patch:
# Full regeneration (launches Dota 2 to capture a fresh API dump) npm run generate-dota-types # Rebuild from existing dump data (no Dota launch, useful for testing build changes) npm run generate-dota-types:skip-dump
This initializes the vendor/ submodules, builds the type generation pipeline, copies the output to dota_types/, and cleans up the submodule working trees so only dota_types/ has changes to commit.
Continuous Integration
This template includes a GitHub Actions workflow that builds your custom game on every commit and fails when there are type errors.
WSL
Recommended WSL setup:
- Keep the repository under WSL filesystem. Keeping it under windows file system and mounting that to WSL will break some things (e.g. npm run dev (
tsc --watch) doesn't work as file notifications from windows filesystem for do not reach processes running in WSL) - Use
npm run wsl-linkto move the addon folders into the Dota install and bind-mount them back into the repo. This avoids UNC symlink issues and keeps Git tracking real directories. - If you get file permission changes in git diff then consider telling git to ignore those -
git config core.filemode false