Git Product home page Git Product logo

dota's Introduction

X-Template

License: MIT Version Xavier's dota2 custom game development template (English translated with DeepL)

Pre-requisites

If you want to use this template, in addition to mastering the Valve's development tools, you need to additionally learn

  1. the syntax of typescript, javascript
  2. the basics of react
  3. the basics of node.js
  4. learn about react-panorama
  5. learn about TypeScriptToLua
  6. learn about the DOTA2 Typescript API, you can check out node_modules/dota-lua-types and node_modules/panorama-types after you finish npm install.

Supported features

  1. convert the xlsx, xls kv files into a kv file and put it in the game/scripts/npc,
  2. convert addon.csv to addon_*.txt, (also you can convert them back to addon.csv),
  3. convert kv files to sync_keyvalues.js for you to fetch kv data in panorama UI, and generates sync_keyvalues.js.d.ts for you to use in your typescript code,
  4. use typescript to write game logic and panorama UI in content/panorama/src and game/scripts/src.
  • please check gulpfile.ts for more details.

Supported commands

  1. npm run launch [[addon_name] map_name] launches dota2, all parameters are optional, if addon_name is provided then the specified addon will be loaded (default to launch this project), if map_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)
  2. npm run dev enter dev mode to compile the ts source code and watch the changes of the files.
  3. npm run test and npm run prod to run publish operation, it will automatically generate publish folder and automatically link to dota_addons/you_addon_name_publish folder, then you can choose this folder to publish (you can set some settings for publishing in package.json -> dota_ developer to make some settings for publishing).

Usage

  1. click use this project as a template to generate your own project or fork this project
  2. install node.js, require above Node v14.10.1 ~~ because versions below is not tested ~~
  3. clone the generated or fork project
  4. open package.json and change name to your preferred name
  5. execute npm install to install the dependencies, it should automatically link content,game folder to your dota 2 beta/dota_addons/your_preferred_name, (if you encounter permission problems, please try to restart)
  6. npm run dev and start your development

Contents

  • 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 and typescript-to-lua, like custom net tables
  • excels to edit kv tables
  • localization to write localization files
  • scripts contains some helper scripts
  1. if you need encryption, please check scripts/publish.js
  2. feel free to submit issues
  3. contributions are welcome

Acknowledgements

X-Template

Xavier 的 dota2 自定义游戏开发模板

使用这个模板的好处

  1. 可以使用更为现代的语言来进行开发,也就是typescript
  2. 可以UI和游戏后端逻辑都使用typescript来开发,而不是需要分别学习luajavascript
  3. 使用表格工具来填写并管理你的kv文件,而无需掌握他们的结构。
  4. 使用react来开发UI可以更好地管理你的代码,而无需掌握xml的写法。
  5. 帮助解决了V社的工具中诸如UI无法读取KV文件UI图片不会自动编译等问题。
  6. 加密发布代码的支持,可以帮助你保护一些关键代码。

支持的功能

  1. 前端的content/panorama/src与后端的game/scripts/src文件夹分别用来写用户界面 react 源码和游戏逻辑的 ts 源代码
  2. 将你的 excel 文件变成 kv 文件并放到game/scripts/npc文件夹
  3. addon.csv 变成 addon_*.txt,(也可以把 addon_*.txt 变成 addon.csv)
  4. game/scripts/npc文件夹的内容同步到content/panorama/src/utils/sync_keyvalues.js, 同时生成 sync_keyvalues.js.d.ts 用于你的 typescript 代码

支持的指令

  1. npm run launch [[addon_name] map_name] 启动 dota2,两个参数为可选参数,如果提供了addon_name那么会载入指定的 addon(默认该项目),提供了map_name则会自动载入对应的地图名(若未提供 addon_name 则默认载入当前 addon)
  2. npm run dev 进入 dev 模式,将会执行同步KV到js,生成localization,Excel转KV等操作
  3. npm run testnpm run prod 执行发布操作,将会自动生成publish文件夹并自动 link 到dota_addons/you_addon_name_publish文件夹,之后你可以选择这个文件夹发布(可以在package.json -> dota_developer中对发布进行一些设置)。

    加密发布流程

将 packages.json 里面的encryptFiles根据你的需要修改,哪些文件加密,哪些不加密(客户端会使用到的技能和Modifier代码建议不加密)

encryptDedicatedServerKey修改成你的图的 DedicatedServerKey

执行npm run test 来完成测试加密流程

可以保持现有的 Invalid_NotDedicatedServer 密钥进行加密,之后在本地启动 publish 文件夹看看加密是否正确运行

执行 npm run prod 来完成正式发布加密流程

执行npm run launch your_addon_name_publish来启动加密后的图,之后执行上传操作

如果要使用加密功能,需要安装 Lua 命令行程序

使用步骤

  1. 点击使用本项目作为模板生成你自己的项目或者 fork 本项目
  2. 安装node.js,要求是 above Node v14.10.1 因为低于这个版本的没有测试过
  3. clone 生成或者 fork 的项目
  4. 打开package.json,将name修改为你自己喜欢的名字
  5. 执行npm install安装依赖,他应该会自动 linkcontent,game文件夹到你的dota 2 beta/dota_addons,(如果碰到权限问题,请关闭代码编辑器后使用控制台来执行npm install,或者重启一下电脑再试)
  6. 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 tststl公用的声明,如custom_net_tables
  • scripts 各种 node 脚本,用来完成各种辅助功能
  • 请仔细查阅 gulpfile.ts 来查看 gulp 的使用方法

注意事项

  • 最好不要使用 node 15 以上的版本,因为这个版本的 node 会有各种问题,如果要使用,请自行解决各类环境问题

DOTA2 Modding 工具推荐

node.js, LuaForWindows 等一系列环境的配置请自行使用搜索引擎完成,不赘述。

只推荐使用steam启动dota2的形式来完成modding,如果尚未安装,请点此下载

需要安装的软件包括:
  1. 代码编辑器 Visual Studio Code 或者 Sublime Text 3 (推荐都安装)
  2. 反编译工具 ValveResourceFormat(推荐)或者 GCFScape(已略过时,某些格式反编译不了,但是速度比较快,推荐都安装)
  3. Adobe系列工具, 如PhotoShop(必须), Audition(选装)等,请到 官网 下载或自行使用搜索引擎获取
  4. 代码版本控制 Github Desktop(推荐,和github的配合比较好) 或 SourceTreeTortoiseSVN
  5. 模型编辑器Blender Steam直接安装【steam://install/365670】 Steam商店页面 (用自己顺手的就行,如果不涉及模型编辑可略过)
  6. 其他实用工具: 文件搜索工具Everything Deepl翻译 Node版本控制nvm-windows

其他

如果你在DOTA2自定义游戏制作过程中遇到了任何问题,可以到本项目的 Issues页面 提问,如果我知道的将会予以解答。

dota's People

Contributors

williamgwj avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.