尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证Sistema de batalha de gladiadores virtuais programáveis.
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗gladCode is a web-based programming game and arena where players code AI gladiators in C or Python to battle autonomously. The platform features selectable Phaser.js 2D and Three.js top-down 3D battle replays, visual block-based programming (Blockly), raw C/Python editing (ACE Editor), tournament systems, and live WebSocket notifications.
gladCode 2 runs as a microservices architecture managed via Docker Compose:
flowchart TD
User([User Browser]) -->|HTTP / PHP Pages| Apache[Apache / PHP 8 Frontend\npublic_html:80]
User -->|WebSockets| Node[Node.js WebSocket Server\nnode:3000]
Apache -->|MySQL Driver| DB[(MySQL 8.0 Database\nmysql:3306)]
Node -->|MySQL Driver| DB
Apache -->|POST /:dirname| Runner[Runner Express API\nrunner:3000]
Runner -->|Spawn Container| VM[gladcode2-vm Container\npswerlang/gladcode2-vm]
VM -->|Compile & Run| Payload[C Simulation Engine\npayload/gladCodeServerMain]
Payload -->|Socket IPC| GladiatorCodes[User Gladiator Codes\ncode0.c, code1.c...]
Payload -->|Generates| SimLog[simlog JSON]
SimLog -->|Expand incremental frames| Playback[Shared Playback State\nscript/render2/battle-state.js]
Playback -->|Classic 2D| Phaser[Phaser.js Renderer\nscript/render.js]
Playback -->|Coliseum 3D| Three[Three.js Renderer\nscript/render2.js]
| Service | Location | Tech Stack | Role & Responsibilities |
|---|---|---|---|
| Apache / PHP Frontend | public_html/ | PHP 8, Apache, jQuery, Phaser.js, Three.js | Web UI, user auth, gladiator management, tournament routing, simulation invocation, and selectable battle replay rendering |
| Runner Service | runner/ | Node.js (ESM), Express, Docker CLI | Docker-in-Docker executor. Receives battle requests, runs containerized simulations |
| WebSocket Server | node/ | Node.js, Express, Socket.IO | Real-time chat, live notification delivery, tournament updates |
| Simulation Engine | payload/ | C (GCC, pthreads, Sockets) | Multi-threaded arena server executing turn-by-turn combat between gladiator scripts |
| Database | database-2025.*.sql | MySQL 8.0 | Stores user accounts, gladiators, tournament schedules, battle logs, and stats |
[!NOTE] No Local Node/Python Requirement: Node.js and Python are not required on the host machine. All services, scripts, and compilers run inside Docker containers.
Copy environment template files:
cp .env.example .env
cp config/config.json.example config/config.json
cp node/config.json.example node/config.json
config/config.jsonlives outside the web root and is mounted into Apache at/var/www/private/config.json(seecompose.yaml). Never put secrets inpublic_html/—public_html/config.jsonis deprecated, still read as a last-resort fallback, and blocked by.htaccess. If you have one, move it:mv public_html/config.json config/config.json.
Ensure MySQL credentials in .env, config/config.json, and node/config.json match:
{
"mysql": {
"host": "mysql",
"port": "3306",
"user": "root",
"password": "root_password",
"database": "gladcode"
}
}
Start all containers in detached mode:
docker compose up -d
Service endpoints:
http://runner:3000)localhost:3306gladCode 2 includes a dev-tools suite in public_html/dev-tools/:
cd public_html/dev-tools
# Dump current MySQL database to dump_gladcode.sql
./dump_restore.sh dump
# Restore database from dump_gladcode.sql
./dump_restore.sh restore
cd public_html/dev-tools
# List test tournaments
./tournament.sh list
# Reset specific tournament by ID
./tournament.sh reset 12
# List real production tournaments (with pagination)
./tournament.sh list-real 1 10
# Reset real production tournament
./tournament.sh reset-real 45
editor.php using either visual blocks or text editing.public_html/banned_functions.json to prevent unauthorized memory/game state modification.public_html/back_simulation.php prepares a temporary run folder under public_html/runs/{hash}/ with payload/ files and user scripts (code0.c, code1.c, etc.), then sends an HTTP POST to http://runner:3000/{hash}.gladcode2-vm container with restricted CPU (--cpu-quota=50000) and a 30-second execution deadline.socket_compile.sh compiles gladiator code, launches gladCodeServerMain, and manages socket IPC between gladiators and the C game engine.simlog). script/playback.js expands it into complete frames, then the saved battle setting selects either the classic Phaser renderer (script/render.js) or the top-down Three.js renderer (script/render2.js). The 3D renderer dresses each gladiator in Synty modular models mapped and recoloured from its persisted skin, walking with a distance-driven gait and playing Synty animation clips for melee, ranged, spell, block and charge actions timed on the replay clock (pausing freezes them; replay speed scales them). Both renderers use the same 100 ms simulation cadence and authoritative arena coordinates.gladcode2/
├── .github/ # GitHub workflows & Copilot instructions
├── Dockerfile-apache # PHP 8 + Apache + Docker CLI container definition
├── Dockerfile-dind # Docker-in-Docker container definition for runner
├── compose.yaml # Docker Compose microservices specification
├── database-2025.*.sql # Database initialization SQL dumps
├── node/ # Node.js Socket.IO WebSocket server
├── payload/ # C battle simulation engine & socket API source
├── public_html/ # Apache web root (PHP backends, JS, CSS, dev-tools)
│ ├── assets/ # Runtime 3D character source, palette atlases, and weapon models
│ ├── back_simulation.php # Simulation orchestrator
│ ├── banned_functions.json# Security function filter
│ ├── dev-tools/ # Tournament & DB management CLI/Web suite
│ ├── runs/ # Temporary simulation workspace directory
│ └── script/ # Playback UI plus Phaser and Three.js renderers
│ └── render2/ # Modular Three.js arena, entities, effects, audio, camera, and state helpers
└── runner/ # Express Docker execution service
gladcode2-vm).runner/runner.js.setPosition, setHp, setAp, lvlUp, etc.) blocked during compilation.