https://github.com/huangkaoya/redalert2
免责声明:这是基于《时空分裂》中文版RA2WEB www.ra2web.com 的分析而开发,并意图基于最新的react和three版本进行重构。
但项目所有权利(包括收益权)归《时空分裂》/RA2WEB负责人所有。未经《时空分裂》的所有者/RA2WEB负责人许可,严禁用于任何商业行为。
需要注意的是,《时空分裂》的所有者从未以任何方式开源游戏客户端代码(即便存在诸如mod-sdk之类的周边开源内容)。本项目运行产生的BUG、功能不完善,不能等同视为对《时空分裂》的名誉贬损。任何基于本项目开展商业行为,包括但不限于植入广告、开发“弹幕红警”收受礼物获利、直接封装收费、以“作者”身份骗取赞助和充电收益等,均视为对《时空分裂》原作者Alexandru Ciucă和RA2WEB的侵权。
红色警戒2网页版,一款经典的即时战略类游戏的完整TypeScript重构版本,使用React + TypeScript + Vite + Three.js构建。
Disclaimer
This project is developed based on the analysis of the Chinese version of Chronodivide — RA2WEB (www.ra2web.com), and is intended to be refactored using the latest versions of React and Three.js. All rights to this project, including profit rights, belong to the owner of Chronodivide. Without permission from the owner of Chronodivide, any commercial use of this project is strictly prohibited.
It should be noted that the owner of Chronodivide has never open-sourced the game client code in any form, even though some peripheral open‑source content such as a mod‑SDK exists. Bugs, incomplete functions or other issues arising from the operation of this project shall not be regarded as damage to the reputation of Chronodivide. Any commercial activities conducted based on this project, including but not limited to placing advertisements, developing a “bullet-screen Red Alert” mode to profit from gifts, directly packaging and selling the project, or fraudulently obtaining sponsorship and donation revenue by claiming to be the “author”, shall be deemed as infringement upon the original author of Chronodivide, Alexandru Ciucă, and RA2WEB.
本项目是使用Typescript编写,完全对标“红色警戒2”的游戏引擎,本地自行导入红色警戒2美术素材后,就可以获得类似红警2的游玩体验
Bun 1.3.10Vite 8.0.1React 19.2.4 + react-dom 19.2.4TypeScript 5.9.3three 0.183.2Playwright 1.58.2127.0.0.1:4000Bun 1.3+WebGLWeb Audio APIFile System Access APIcd redalert2
bun install
bun run dev
默认访问地址:
http://127.0.0.1:4000
生产构建与预览:
bun run build
bun run preview
类型检查:
bun run typecheck:entry
仓库当前已经不再只依赖手点验证。scripts/ 下维护了一组可直接执行的回归脚本,主要覆盖大厅、进图、机制和 tester 入口。
常用命令包括:
bun run debug:game-res-init
bun run debug:viewport
bun run debug:options
bun run debug:storage-explorer
bun run debug:skirmish
bun run debug:skirmish-lobby-data
bun run debug:victory-exit
bun run debug:superweapon
bun run debug:nuke
bun run debug:radiation
bun run debug:minimap-shroud
bun run debug:anti-air-hit
bun run debug:terror-drone
bun run debug:chrono-legionnaire
bun run debug:test-entries
bun run debug:tester-panels
这些脚本的产物默认会写入 .artifacts/,便于回看截图和 JSON 结果。
主菜单中的测试入口目前分为三类:
VXL测试SHP测试音频测试建筑测试载具测试步兵测试飞行器测试大厅测试世界测试移动测试这些 tester 页面不是孤立 Demo,而是当前仓库里很重要的调试和回归入口。页面左侧面板状态会同步到调试状态对象,自动化脚本也会直接使用这些入口验证渲染和交互结果。
React 19.2.4TypeScript 5.9.3Vite 8.0.1three 0.183.2Bun 1.3.10Playwright 1.58.27z-wasmfile-system-access@ffmpeg/ffmpeg@ra2web/pcxfile@ra2web/wavefileredalert2/
├── public/ 静态资源、配置、locale、遗留样式
├── scripts/ Playwright 自动化回归脚本
├── src/
│ ├── data/ 原版资源格式、编码、地图、VFS
│ ├── engine/ 渲染、音频、资源加载、底层引擎能力
│ ├── game/ 游戏逻辑、对象系统、触发器、规则、超武
│ ├── gui/ 主菜单、HUD、选项、游戏内 UI
│ ├── network/ 网络和联机相关基础设施
│ ├── tools/ 独立 tester 页面
│ └── util/ 通用工具
├── docs/ 对齐记录与工程说明
└── vite.config.ts 开发和构建配置
src/engine/
gfx/:three 渲染层、材质、批处理、viewport、lightingrenderable/:游戏对象到可视对象的桥接层sound/:音频混音、音乐、音效播放gameRes/:资源导入、CDN 加载、缓存与目录处理src/game/
gameobject/:单位、建筑、抛射体、trait、locomotorrules/:INI 规则读取与对象规则构建trigger/:地图触发器、条件、执行器superweapon/:核弹、闪电风暴、超时空等超武逻辑src/gui/
screen/mainMenu/:主菜单、地图选择、大厅、选项screen/game/:游戏内 HUD、世界交互、菜单component/:React 组件jsx/:自定义 UI 渲染桥接src/tools/
bun run dev
bun run build
bun run preview
bun run typecheck:entry
4000docs/build-alignment-log.md.artifacts/提交改动前,至少建议执行:
bun run typecheck:entry
bun run build
如果改动涉及大厅、资源加载、进图、HUD、机制或 tester,请补跑相应的 debug:* 脚本。
本项目基于GNU General Public License v3.0(GPL-3.0)许可证开源。详见 LICENSE 文件。
注意: 本项目仅用于学习和研究目的。红色警戒2是EA公司的知识产权,导入美术素材时请确保拥有合法的游戏副本。
免责声明: 本项目仅供学习研究使用,不用于商业目的。红色警戒2及相关商标归EA公司所有。