Xavier's dota2 custom game development template (English translated with DeepL)
If you want to use this template, in addition to mastering the Valve's development tools, you need to additionally learn
- the syntax of
typescript
,javascript
- the basics of
react
- the basics of
node.js
- learn about react-panorama
- learn about TypeScriptToLua
- learn about the
DOTA2 Typescript API
, you can check outnode_modules/dota-lua-types
andnode_modules/panorama-types
after you finishnpm install
.
- convert the contents of the files in
excels
into a kv file and put it in thegame/scripts/npc
- convert the contents of the
localization
folder into a corresponding language file and put it in thegame/resources
- sync the contents of the
game/scripts/npc
tocontent/panorama/scripts/keyvalues.js
- use typescript to write game logic and panorama UI in
content/panorama/src
andgame/scripts/src
respectively
npm run launch [[addon_name] map_name]
launches dota2, all parameters are optional, ifaddon_name
is provided then the specified addon will be loaded (default to launch this project), ifmap_name
is provided then the corresponding map name will be loaded automatically (if addon_name is not provided then the current addon will be loaded by default)npm run dev
enter dev mode to compile the ts source code and watch the changes of the files.npm run prod
to runpublish
operation, it will automatically generatepublish
folder and automatically link todota_addons/you_addon_name_publish
folder, then you can choose this folder to publish (you can set some settings for publishing inpackage.json -> dota_ developer
to make some settings for publishing).
- click use this project as a template to generate your own project or fork this project
- install
node.js
, require above Node v14.10.1 ~~ because versions below is not tested ~~ - clone the generated or fork project
- open
package.json
and changename
to your preferred name - execute
npm install
to install the dependencies, it should automatically linkcontent
,game
folder to yourdota 2 beta/dota_addons/your_preferred_name
, (if you encounter permission problems, please try to restart) npm run dev
and start your development
- content is synchronized with
dota 2 beta/content/dota_addons/your_addon_name
- game is synchronized with
dota 2 beta/game/dota_addons/your_addon_name
- shared to write some shared declarations used in
panorama
andtypescript-to-lua
, likecustom net tables
- excels to edit kv tables
- localization to write localization files
- scripts contains some helper scripts
- if you need encryption, please check
scripts/publish.js
- feel free to submit
issues
- contributions are welcome
- ModDota Community
- React-panorama is developed by https://github.com/ark120202
- Some of the code is from https://github.com/MODDOTA/TypeScriptAddonTemplate
Xavier 的 dota2 自定义游戏开发模板
如果你要使用这个模板,除了掌握 V 社的开发工具以外,你还需要额外学会
typescript
,javascript
的语法react
的基础知识node.js
的基础知识- 学习一下react-panorama
- 学习一下TypeScriptToLua
- 了解一下
DOTA2 Typescript API
,完成npm install
后你可以查看node_modules/dota-lua-types
和node_modules/panorama-types
- 将
excels
文件夹的内容变成 kv 文件并放到game/scripts/npc
文件夹 - 将
localization
文件夹的内容生成对应的语言文件并放到game/resources
文件夹 - 将
game/scripts/npc
文件夹的内容同步到content/panorama/scripts/keyvalues.js
- 前端的
content/panorama/src
与后端的game/scripts/src
文件夹分别用来写用户界面 react 源码和游戏逻辑的 ts 源代码
npm run launch [[addon_name] map_name]
启动 dota2,两个参数为可选参数,如果提供了addon_name
那么会载入指定的 addon(默认该项目),提供了map_name
则会自动载入对应的地图名(若未提供 addon_name 则默认载入当前 addon)npm run dev
进入 dev 模式,将会执行同步KV到js,生成localization,Excel转KV等操作
npm run prod
执行发布
操作,将会自动生成publish
文件夹并自动 link 到dota_addons/you_addon_name_publish
文件夹,之后你可以选择这个文件夹发布(可以在package.json -> dota_developer
中对发布进行一些设置)。加密发布流程
将 packages.json 里面的
encryptFiles
根据你的需要修改,哪些文件加密,哪些不加密
将
encryptDedicatedServerKey
修改成你的图的 DedicatedServerKey
执行
npm run prod
来完成加密流程
可以保持现有的 Invalid_NotDedicatedServer 密钥进行加密,之后在本地启动 publish 文件夹看看加密是否正确运行,正式发布再改成正式的 key
执行
npm run launch your_addon_name_publish
来启动加密后的图,之后执行上传操作
如果要使用加密功能,需要安装 Lua 命令行程序
- 点击使用本项目作为模板生成你自己的项目或者 fork 本项目
- 安装
node.js
,要求是 above Node v14.10.1因为低于这个版本的没有测试过 - clone 生成或者 fork 的项目
- 打开
package.json
,将name
修改为你自己喜欢的名字 - 执行
npm install
安装依赖,他应该会自动 linkcontent
,game
文件夹到你的dota 2 beta/dota_addons
,(如果碰到权限问题,请关闭代码编辑器后使用控制台来执行npm install
,或者重启一下电脑再试) npm run dev
,开始你的开发
- content 会和
dota 2 beta/content/dota_addons/your_addon_name
同步更新 - game 会和
dota 2 beta/game/dota_addons/your_addon_name
同步更新 - shared 用来写
panorama ts
和tstl
公用的声明,如custom_net_tables
等 - excels 用来写 KV 表
- localization 用来写各种本地化文本
- scripts 各种 node 脚本,用来完成各种辅助功能
- 最好不要使用 node 15 以上的版本,因为这个版本的 node 会有各种问题,如果要使用,请自行解决各类环境问题
node.js, LuaForWindows 等一系列环境的配置请自行使用搜索引擎完成,不赘述。
只推荐使用
steam
启动dota2的形式来完成modding,如果尚未安装,请点此下载
- 代码编辑器 Visual Studio Code 或者 Sublime Text 3 (推荐都安装)
- 反编译工具 ValveResourceFormat(推荐)或者 GCFScape(已略过时,某些格式反编译不了,但是速度比较快,推荐都安装)
- Adobe系列工具, 如PhotoShop(必须), Audition(选装)等,请到 官网 下载或自行使用搜索引擎获取
- 代码版本控制 Github Desktop(推荐,和github的配合比较好) 或 SourceTree 或 TortoiseSVN
- 模型编辑器Blender Steam直接安装【steam://install/365670】 Steam商店页面 (用自己顺手的就行,如果不涉及模型编辑可略过)
- 其他实用工具: 文件搜索工具Everything Deepl翻译 Node版本控制nvm-windows
如果你在DOTA2自定义游戏制作过程中遇到了任何问题,可以到本项目的 Issues页面 提问,如果我知道的将会予以解答。