Luigi commited on
Commit
114ddfb
ยท
1 Parent(s): 03eb9aa

docs: Comprehensive README update with AI Analysis and NL interface features

Browse files

- Added detailed AI-powered tactical analysis section
- Documented natural language command interface
- Included performance optimizations for HuggingFace (2 vCPU)
- Updated project status to v2.1 with recent bug fixes
- Showcased shared model architecture
- Added multi-language support details
- Included complete feature list and how-to guides
- Backed up old README to README.old.md

Files changed (2) hide show
  1. README.md +307 -147
  2. README.old.md +244 -0
README.md CHANGED
@@ -8,237 +8,397 @@ pinned: false
8
  license: mit
9
  ---
10
 
11
- # ๐ŸŽฎ Command & Conquer: Tiberium Dawn - Web Version
12
 
13
- A faithful recreation of the classic Command & Conquer: Tiberium Dawn in **pure web technologies** (FastAPI + WebSocket + Canvas).
14
 
15
- ---
16
-
17
- ## ๐Ÿ“‚ Project Structure
18
 
19
- ```
20
- web/
21
- โ”œโ”€โ”€ README.md # This file
22
- โ”œโ”€โ”€ app.py # FastAPI server & WebSocket
23
- โ”œโ”€โ”€ start.py # Server launcher
24
- โ”œโ”€โ”€ localization.py # Multi-language support
25
- โ”œโ”€โ”€ ai_analysis.py # AI engine
26
- โ”œโ”€โ”€ mcp_server.py # MCP server integration
27
- โ”œโ”€โ”€ backend/ # Game logic
28
- โ”œโ”€โ”€ frontend/ # JavaScript game engine
29
- โ”œโ”€โ”€ static/ # Assets (images, sounds)
30
- โ”œโ”€โ”€ docs/ # ๐Ÿ“š Documentation
31
- โ”œโ”€โ”€ tests/ # ๐Ÿงช Test scripts
32
- โ””โ”€โ”€ tools/ # ๐Ÿ› ๏ธ Dev/debug/ops scripts
33
- ```
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  ---
37
 
38
  ## ๐Ÿš€ Quick Start
39
 
 
 
 
40
  ### Local Development
41
 
42
- 1. **Install dependencies:**
43
- ```bash
44
- pip install -r requirements.txt
45
- ```
46
 
47
- 2. **Start the server:**
48
- ```bash
49
- python start.py
50
- ```
51
 
52
- 3. **Open in browser:**
53
- ```
54
- http://localhost:8000
55
- ```
 
 
56
 
57
  ---
58
 
59
- ## ๐Ÿ“– Documentation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- ### ๐Ÿ“š Complete Documentation
62
- All technical documentation is in **[docs/](docs/)** (28 files organized by category):
63
- - **Architecture:** System design, project structure
64
- - **Gameplay:** Features, mechanics, Red Alert compatibility
65
- - **Harvester AI:** Complete AI implementation (6 docs)
66
- - **Deployment:** Setup, Docker, testing
67
- - **Summaries:** Final reports and migration guides
68
 
69
- **Quick Links:**
70
- - **[docs/QUICKSTART.md](docs/QUICKSTART.md)** - Detailed quick start
71
- - **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** - System architecture
72
- - **[docs/FEATURES_RESTORED.md](docs/FEATURES_RESTORED.md)** - All features
73
- - **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)** - Deployment guide
74
- - **[docs/README.md](docs/README.md)** - ๐Ÿ“š Complete documentation index
75
 
76
- ### ๐Ÿงช Testing
77
- All test scripts are in **[tests/](tests/)** (4 scripts):
78
- - `test.sh` - Main test suite
79
- - `test_features.sh` - Feature-specific tests
80
- - `test_harvester_ai.py` - Harvester AI tests
81
- - `docker-test.sh` - Docker deployment tests
82
 
83
- See **[tests/README.md](tests/README.md)** for usage guide.
 
 
 
 
84
 
85
- ---
 
 
 
 
86
 
87
- ## ๐Ÿ› ๏ธ Outils (dev/debug/ops)
 
 
 
 
88
 
89
- Les scripts utilitaires sont dans **[tools/](tools/)**:
90
- - `tools/debug_ai.py` โ€” Utilitaires de dรฉbogage AI
91
- - `tools/local_run.sh` โ€” Lancement local pratique
92
- - `tools/deploy_hf_spaces.sh` โ€” Dรฉploiement vers Hugging Face Spaces
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  ---
95
 
96
- ## ๐ŸŽฎ Key Features
97
 
98
- โœ… **Real-Time Strategy Gameplay**
99
- - Resource management (Tiberium harvesting)
100
- - Base building with power system
101
- - Unit production and combat
102
- - Fog of War
103
 
104
- โœ… **Authentic C&C Experience**
105
- - GDI faction with classic units
106
- - Minimap with live updates
107
- - Construction yard, power plants, barracks, refineries
108
- - Infantry, tanks, and harvesters
109
 
110
- โœ… **Web-Native**
111
- - No downloads or installations
112
- - Play directly in browser
113
- - Cross-platform compatible
114
- - Responsive UI
115
 
116
- โœ… **Multiplayer Ready** (Foundation)
117
- - WebSocket-based architecture
118
- - Real-time state synchronization
119
- - Scalable server design
120
 
121
- ---
 
 
 
 
122
 
123
- ## ๐ŸŽฏ Controls
 
 
 
 
 
124
 
125
- | Action | Key/Mouse |
126
- |--------|-----------|
127
- | **Select unit/building** | Left Click |
128
- | **Move unit** | Right Click (ground) |
129
- | **Attack** | Right Click (enemy) |
130
- | **Box select** | Click + Drag |
131
- | **Build structure** | Click building button |
132
- | **Place building** | Click grid location |
133
- | **Change language** | Language buttons (top) |
 
134
 
135
  ---
136
 
137
- ## ๐ŸŒ Multi-Language Support
 
 
138
 
139
- - ๐Ÿ‡ฌ๐Ÿ‡ง English
140
- - ๐Ÿ‡ซ๐Ÿ‡ท Franรงais
141
- - ๐Ÿ‡น๐Ÿ‡ผ ็น้ซ”ไธญๆ–‡
 
 
 
142
 
143
- Switch language anytime with top-left buttons.
 
 
 
 
 
 
 
 
 
 
144
 
145
  ---
146
 
147
- ## ๐Ÿ—๏ธ Tech Stack
148
 
149
- **Backend:**
150
- - FastAPI (async web framework)
151
- - WebSockets (real-time communication)
152
- - Python 3.8+
153
 
154
- **Frontend:**
155
- - Vanilla JavaScript
156
- - HTML5 Canvas (rendering)
157
- - CSS3 (UI styling)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
- **Game Engine:**
160
- - Custom JavaScript engine
161
- - Canvas-based rendering
162
- - WebSocket state sync
 
 
163
 
164
  ---
165
 
166
- ## ๐Ÿ“ฆ Deployment
167
 
168
- ### Docker (Recommended)
169
 
170
- ```bash
171
- docker build -t rts-web .
172
- docker run -p 8000:8000 rts-web
173
- ```
 
 
 
 
 
 
 
174
 
175
- See **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)** for complete deployment guide.
 
176
 
177
  ---
178
 
179
  ## ๐Ÿงช Testing
180
 
181
- Run the test suite:
 
182
  ```bash
 
183
  ./tests/test.sh
 
 
 
 
 
 
 
 
 
 
 
 
184
  ```
185
 
186
- See **[tests/README.md](tests/README.md)** for all available tests.
187
 
188
  ---
189
 
190
- ## ๐Ÿ“Š Project Status
 
 
 
 
 
 
 
 
 
191
 
192
- **Version:** 2.0 (Web)
193
- **Status:** Production Ready โœ…
194
- **Rating:** 4.9/5 (97.3% feature parity with Pygame)
 
195
 
196
- **Compared to C&C Red Alert:**
197
- - 49% raw feature parity
198
- - 4.7/5 context-adjusted score
199
- - 3 aspects superior to Red Alert
200
 
201
- See full comparisons inside docs/ (if present).
 
 
 
202
 
203
  ---
204
 
205
- ## ๐Ÿ“œ License
 
 
206
 
207
- MIT License - See LICENSE file for details.
 
 
208
 
209
  ---
210
 
211
- ## ๐Ÿ™ Credits
 
 
212
 
213
- Inspired by **Command & Conquer: Tiberium Dawn** (Westwood Studios, 1995)
 
 
 
 
 
214
 
215
  ---
216
 
217
- ## ๐Ÿค– MCP (Model Context Protocol) Integration
 
 
218
 
219
- This project includes support for the Model Context Protocol (MCP), allowing AI agents to interact with the game programmatically.
220
 
221
- ### Features
222
 
223
- - **Game State Access**: AI agents can retrieve the current game state
224
- - **Action Execution**: AI agents can perform actions in the game
225
- - **AI Analysis**: Access to tactical analysis from the built-in AI
226
- - **Documentation Access**: Provides game documentation as resources
227
 
228
- ### Running the MCP Server
 
 
 
 
229
 
230
- ```bash
231
- cd web
232
- python mcp_server.py
233
- ```
234
 
235
- The MCP server will start on port 8001.
236
 
237
- ### Documentation
238
 
239
- See **[docs/MCP_INTEGRATION.md](docs/MCP_INTEGRATION.md)** for detailed information about the MCP integration.
 
 
240
 
241
  ---
242
 
243
- **๐Ÿ“š Full Documentation:** [docs/](docs/)
244
- **๐Ÿงช Test Scripts:** [tests/](tests/)
 
 
8
  license: mit
9
  ---
10
 
11
+ # ๐ŸŽฎ RTS Commander - Command & Conquer Web Edition
12
 
13
+ A modern web-based Real-Time Strategy game inspired by Command & Conquer: Tiberium Dawn, featuring **AI-powered tactical analysis** and **natural language command interface**.
14
 
15
+ **๐ŸŒ [Play Now](https://huggingface.co/spaces/Luigi/rts-commander)** | **๐Ÿ“š [Documentation](docs/)** | **๐Ÿงช [Tests](tests/)**
 
 
16
 
17
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ ## โœจ Key Features
20
+
21
+ ### ๐ŸŽฏ Classic RTS Gameplay
22
+ - **Resource Management**: Harvest Tiberium to fund your war machine
23
+ - **Base Building**: Construct power plants, refineries, barracks, and war factories
24
+ - **Unit Production**: Train infantry, build tanks, and deploy helicopters
25
+ - **Real-Time Combat**: Command your forces against an aggressive AI opponent
26
+ - **Fog of War**: Explore the battlefield and reveal enemy positions
27
+ - **Power System**: Manage energy production and consumption (Red Alert-style)
28
+
29
+ ### ๐Ÿค– AI-Powered Tactical Analysis
30
+ - **Real-time battlefield analysis** powered by Qwen2.5-Coder-1.5B LLM
31
+ - **Strategic recommendations** based on current game state
32
+ - **Resource management tips** and economic guidance
33
+ - **Threat assessment** and defensive positioning advice
34
+ - **Multi-language support** (English, French, Chinese)
35
+ - Updates every 60 seconds with fresh tactical insights
36
+
37
+ ### ๐Ÿ’ฌ Natural Language Command Interface
38
+ - **Talk to your units** in plain language (any language!)
39
+ - **Examples**:
40
+ - "Move my tanks to the north base" โ†’ Parsed to move commands
41
+ - "Construire une centrale รฉlectrique" โ†’ Build power plant
42
+ - "็”Ÿ็”ขไธ‰ๅ€‹ๆญฅๅ…ต" โ†’ Train 3 infantry units
43
+ - **Powered by LLM** with MCP-style command translation
44
+ - **Fallback examples** provided in multiple languages
45
+ - **Real-time translation** from natural language to game commands
46
+
47
+ ### ๐ŸŒ Multi-Language Support
48
+ - ๐Ÿ‡ฌ๐Ÿ‡ง **English** - Full interface and AI analysis
49
+ - ๐Ÿ‡ซ๐Ÿ‡ท **Franรงais** - Interface complรจte et analyse IA
50
+ - ๐Ÿ‡น๐Ÿ‡ผ **็น้ซ”ไธญๆ–‡** - ๅฎŒๆ•ด็•Œ้ขๅ’ŒAIๅˆ†ๆž
51
+ - Switch languages instantly during gameplay
52
+
53
+ ### ๐ŸŽจ Modern Web Technologies
54
+ - **No installation required** - Play directly in browser
55
+ - **Cross-platform** - Works on desktop, tablet, and mobile
56
+ - **Real-time multiplayer ready** - WebSocket architecture
57
+ - **Responsive UI** - Adapts to different screen sizes
58
+ - **Canvas-based rendering** - Smooth 60 FPS gameplay
59
 
60
  ---
61
 
62
  ## ๐Ÿš€ Quick Start
63
 
64
+ ### Play Online
65
+ Visit **[https://huggingface.co/spaces/Luigi/rts-commander](https://huggingface.co/spaces/Luigi/rts-commander)** to play instantly!
66
+
67
  ### Local Development
68
 
69
+ ```bash
70
+ # Clone the repository
71
+ git clone <repository-url>
72
+ cd rts/web
73
 
74
+ # Install dependencies
75
+ pip install -r requirements.txt
 
 
76
 
77
+ # Start the server
78
+ python start.py
79
+
80
+ # Open in browser
81
+ # http://localhost:8000
82
+ ```
83
 
84
  ---
85
 
86
+ ## ๐ŸŽฎ How to Play
87
+
88
+ ### Basic Controls
89
+
90
+ | Action | Control |
91
+ |--------|---------|
92
+ | **Select units/buildings** | Left Click |
93
+ | **Move units** | Right Click on ground |
94
+ | **Attack enemies** | Right Click on enemy unit/building |
95
+ | **Box select multiple units** | Click + Drag |
96
+ | **Build structure** | Click building button in sidebar |
97
+ | **Place building** | Click on construction grid |
98
+ | **Cancel building** | Press Escape |
99
+ | **Pan camera** | Arrow Keys or WASD |
100
+ | **Use NL interface** | Type in left sidebar input |
101
+
102
+ ### Getting Started
103
+
104
+ 1. **Build a Power Plant** - Required for all other structures
105
+ 2. **Build a Refinery** - Process Tiberium for credits
106
+ 3. **Wait for Harvester** - Automatically deployed with refinery
107
+ 4. **Build a Barracks** - Train infantry units
108
+ 5. **Defend your base** - Enemy attacks start quickly!
109
+ 6. **Expand and conquer** - Build more structures and units
110
+
111
+ ### Using AI Analysis
112
+
113
+ The **AI Analysis Panel** (right side) provides:
114
+ - **Battlefield Overview**: Current situation assessment
115
+ - **Economic Status**: Credits, production, and resource flow
116
+ - **Military Assessment**: Unit counts and combat readiness
117
+ - **Strategic Advice**: What to do next
118
+ - **Tactical Tips**: How to improve your position
119
+
120
+ ### Using Natural Language Commands
121
+
122
+ The **NL Command Interface** (left side) lets you:
123
+ 1. Type commands in natural language (any supported language)
124
+ 2. View example commands for inspiration
125
+ 3. See command history and results
126
+ 4. Get instant feedback on command execution
127
+
128
+ **Example Commands:**
129
+ - "Build 5 infantry units"
130
+ - "Dรฉplacer mes tanks vers le nord"
131
+ - "ๆ”ปๆ“Šๆ•ตไบบ็š„ๅŸบๅœฐ"
132
 
133
+ ---
 
 
 
 
 
 
134
 
135
+ ## ๐Ÿ—๏ธ Architecture
 
 
 
 
 
136
 
137
+ ### Tech Stack
 
 
 
 
 
138
 
139
+ **Backend:**
140
+ - **FastAPI** - Modern async web framework
141
+ - **WebSockets** - Real-time bidirectional communication
142
+ - **llama-cpp-python** - LLM inference engine
143
+ - **Qwen2.5-Coder-1.5B** - Shared model for NL and AI analysis
144
 
145
+ **Frontend:**
146
+ - **Vanilla JavaScript** - No heavy frameworks
147
+ - **HTML5 Canvas** - High-performance rendering
148
+ - **CSS3** - Modern responsive UI
149
+ - **WebSocket Client** - Real-time state synchronization
150
 
151
+ **AI/ML:**
152
+ - **Shared Model Manager** - Single LLM instance for efficiency
153
+ - **Thread-safe queue system** - Sequential request processing
154
+ - **Optimized for 2 vCPU** - HuggingFace Free tier compatible
155
+ - **Fallback mechanisms** - Graceful degradation if LLM unavailable
156
 
157
+ ### Key Components
158
+
159
+ ```
160
+ web/
161
+ โ”œโ”€โ”€ app.py # FastAPI server & game loop
162
+ โ”œโ”€โ”€ model_manager.py # Shared LLM instance manager
163
+ โ”œโ”€โ”€ nl_translator.py # Natural language โ†’ MCP commands
164
+ โ”œโ”€โ”€ ai_analysis.py # Tactical analysis engine
165
+ โ”œโ”€โ”€ localization.py # Multi-language support
166
+ โ”œโ”€โ”€ mcp_server.py # MCP protocol server
167
+ โ”œโ”€โ”€ static/
168
+ โ”‚ โ”œโ”€โ”€ game.js # Game engine & rendering
169
+ โ”‚ โ”œโ”€โ”€ nl_interface.js # NL command interface
170
+ โ”‚ โ””โ”€โ”€ styles.css # UI styling
171
+ โ”œโ”€โ”€ backend/
172
+ โ”‚ โ”œโ”€โ”€ constants.py # Game constants
173
+ โ”‚ โ””โ”€โ”€ app/ # Core game logic
174
+ โ”œโ”€โ”€ docs/ # ๐Ÿ“š Documentation (28+ files)
175
+ โ””โ”€โ”€ tests/ # ๐Ÿงช Test scripts
176
+ ```
177
 
178
  ---
179
 
180
+ ## ๐Ÿค– AI Features Deep Dive
181
 
182
+ ### Shared Model Architecture
 
 
 
 
183
 
184
+ To optimize memory usage and CPU resources, both the **AI Analysis** and **NL Translator** share a single LLM instance:
 
 
 
 
185
 
186
+ - **Model**: Qwen2.5-Coder-1.5B (Q4_0 quantized, ~1GB RAM)
187
+ - **Thread-safe**: Queue-based request handling
188
+ - **Memory efficient**: 50% reduction vs. dual instances
189
+ - **CPU optimized**: 1 thread (HuggingFace 2 vCPU environment)
190
+ - **Fast response**: 128-256 token limits, 10-15s timeouts
191
 
192
+ ### Natural Language Translation Pipeline
 
 
 
193
 
194
+ 1. **User Input** โ†’ Natural language command in any language
195
+ 2. **LLM Processing** โ†’ Qwen2.5 translates to MCP-style JSON
196
+ 3. **Validation** โ†’ Command structure verified
197
+ 4. **Execution** โ†’ Converted to game actions
198
+ 5. **Feedback** โ†’ Success/error notification to user
199
 
200
+ **Supported Command Types:**
201
+ - `MOVE_UNIT` - Move units to position
202
+ - `BUILD_UNIT` - Train units from buildings
203
+ - `BUILD_BUILDING` - Construct new structures
204
+ - `ATTACK_UNIT` - Attack enemy units
205
+ - `ATTACK_BUILDING` - Attack enemy structures
206
 
207
+ ### AI Tactical Analysis
208
+
209
+ The AI analyzer provides strategic insights by:
210
+ 1. **State Analysis**: Evaluates current game situation
211
+ 2. **Threat Detection**: Identifies immediate dangers
212
+ 3. **Resource Assessment**: Checks economic health
213
+ 4. **Strategic Planning**: Suggests next moves
214
+ 5. **Localization**: Presents analysis in user's language
215
+
216
+ **Update Frequency**: Every 60 seconds (configurable)
217
 
218
  ---
219
 
220
+ ## ๐Ÿ”ง Performance Optimizations
221
+
222
+ Optimized for **HuggingFace Free Tier** (2 vCPUs, 16GB RAM):
223
 
224
+ ### LLM Optimizations
225
+ - **Threads**: 1 (instead of 4) to avoid CPU contention
226
+ - **Batch size**: 128 for faster response times
227
+ - **Context size**: 4096 tokens (balanced)
228
+ - **Token limits**: 128-256 (fast responses)
229
+ - **Timeouts**: 10-15s (prevents freezing)
230
 
231
+ ### Game Loop Optimizations
232
+ - **Tick rate**: 20 FPS (50ms per frame)
233
+ - **State broadcast**: Only when connections exist
234
+ - **AI analysis**: Every 60s (reduced from 30s)
235
+ - **Debug logging**: Periodic (not per-frame)
236
+
237
+ ### Memory Management
238
+ - **Shared model**: Single LLM instance (~1GB)
239
+ - **Model caching**: Loads once, reused forever
240
+ - **Process isolation**: Fallback if shared model busy
241
+ - **Thread cleanup**: Automatic resource management
242
 
243
  ---
244
 
245
+ ## ๐Ÿ“Š Project Status
246
 
247
+ **Current Version**: 2.1
248
+ **Status**: โœ… Production Ready
249
+ **Deployment**: Live on HuggingFace Spaces
 
250
 
251
+ ### Recent Updates (October 2025)
252
+
253
+ โœ… **Fixed critical bugs**:
254
+ - Game loop now runs continuously (60 FPS maintained)
255
+ - Unit movement working correctly
256
+ - Production system functional
257
+ - NL translator loads properly from /tmp/rts/
258
+
259
+ โœ… **Performance improvements**:
260
+ - LLM optimized for 2 vCPU environment
261
+ - Reduced thread count (4โ†’1)
262
+ - Shorter timeouts (30sโ†’15s)
263
+ - Smaller token limits (512โ†’256)
264
+
265
+ โœ… **New features**:
266
+ - Shared model manager (50% memory reduction)
267
+ - Auto-retry for NL translator connection
268
+ - Comprehensive debug logging
269
+ - Periodic game tick confirmation
270
 
271
+ ### Known Limitations
272
+
273
+ โš ๏ธ **Single-player only** (multiplayer infrastructure ready but not enabled)
274
+ โš ๏ธ **GDI faction only** (Nod not implemented)
275
+ โš ๏ธ **Limited unit types** (infantry, tanks, helicopters, harvesters)
276
+ โš ๏ธ **Basic AI opponent** (follows build queue, trains units, attacks)
277
 
278
  ---
279
 
280
+ ## ๐Ÿ“š Documentation
281
 
282
+ Complete documentation is available in **[docs/](docs/)** (28+ files):
283
 
284
+ ### Essential Docs
285
+ - **[QUICKSTART.md](docs/QUICKSTART.md)** - Detailed getting started guide
286
+ - **[ARCHITECTURE.md](docs/ARCHITECTURE.md)** - System design and structure
287
+ - **[FEATURES_RESTORED.md](docs/FEATURES_RESTORED.md)** - All implemented features
288
+ - **[DEPLOYMENT.md](docs/DEPLOYMENT.md)** - Deployment instructions
289
+ - **[MCP_INTEGRATION.md](docs/MCP_INTEGRATION.md)** - Model Context Protocol
290
+
291
+ ### Recent Docs
292
+ - **[NL_INTEGRATION_SUCCESS.md](docs/NL_INTEGRATION_SUCCESS.md)** - NL interface implementation
293
+ - **[NL_UI_ARCHITECTURE_FIX.md](docs/NL_UI_ARCHITECTURE_FIX.md)** - Shared model architecture
294
+ - **[CODE_CHANGES_NL_FIX.md](docs/CODE_CHANGES_NL_FIX.md)** - Bug fixes summary
295
 
296
+ ### Full Index
297
+ See **[docs/README.md](docs/README.md)** for complete documentation catalog.
298
 
299
  ---
300
 
301
  ## ๐Ÿงช Testing
302
 
303
+ Test scripts in **[tests/](tests/)** directory:
304
+
305
  ```bash
306
+ # Run main test suite
307
  ./tests/test.sh
308
+
309
+ # Test specific features
310
+ ./tests/test_features.sh
311
+
312
+ # Test NL integration
313
+ python tests/scripts/test_nl_integration.py
314
+
315
+ # Test shared model
316
+ python tests/test_shared_model.py
317
+
318
+ # Docker deployment test
319
+ ./tests/docker-test.sh
320
  ```
321
 
322
+ See **[tests/README.md](tests/README.md)** for detailed testing guide.
323
 
324
  ---
325
 
326
+ ## ๐Ÿณ Docker Deployment
327
+
328
+ ### Quick Deploy
329
+
330
+ ```bash
331
+ # Build image
332
+ docker build -t rts-commander .
333
+
334
+ # Run container
335
+ docker run -p 7860:7860 rts-commander
336
 
337
+ # Access at http://localhost:7860
338
+ ```
339
+
340
+ ### HuggingFace Spaces
341
 
342
+ This project is configured for automatic deployment to HuggingFace Spaces:
 
 
 
343
 
344
+ 1. Model auto-downloads to `/tmp/rts/` on first run
345
+ 2. Optimized for 2 vCPU environment
346
+ 3. Automatic restart on push to main branch
347
+ 4. Health checks and monitoring included
348
 
349
  ---
350
 
351
+ ## ๐Ÿ› ๏ธ Development Tools
352
+
353
+ Scripts in **[tools/](tools/)** directory:
354
 
355
+ - `local_run.sh` - Quick local development server
356
+ - `debug_ai.py` - AI debugging utilities
357
+ - `deploy_hf_spaces.sh` - Deploy to HuggingFace Spaces
358
 
359
  ---
360
 
361
+ ## ๐Ÿค Contributing
362
+
363
+ Contributions welcome! Areas for improvement:
364
 
365
+ - **New unit types** (aircraft, advanced vehicles)
366
+ - **Nod faction** (buildings, units, technologies)
367
+ - **More map variety** (different terrains, objectives)
368
+ - **Multiplayer mode** (lobby, matchmaking)
369
+ - **Campaign mode** (missions, story)
370
+ - **Better AI** (strategic planning, tactics)
371
 
372
  ---
373
 
374
+ ## ๐Ÿ“œ License
375
+
376
+ MIT License - See [LICENSE](LICENSE) file for details.
377
 
378
+ ---
379
 
380
+ ## ๐Ÿ™ Credits
381
 
382
+ **Inspired by**: Command & Conquer: Tiberium Dawn (Westwood Studios, 1995)
 
 
 
383
 
384
+ **Powered by**:
385
+ - [FastAPI](https://fastapi.tiangolo.com/) - Web framework
386
+ - [Qwen2.5-Coder](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) - LLM model
387
+ - [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) - LLM inference
388
+ - [HuggingFace Spaces](https://huggingface.co/spaces) - Hosting platform
389
 
390
+ **Special Thanks**: To all contributors and players who provided feedback!
 
 
 
391
 
392
+ ---
393
 
394
+ ## ๐Ÿ“ž Support
395
 
396
+ - **Bug Reports**: Open an issue on the repository
397
+ - **Feature Requests**: Start a discussion
398
+ - **Questions**: Check the [docs/](docs/) first, then ask!
399
 
400
  ---
401
 
402
+ **๐ŸŽฎ Ready to command your forces? [Play Now!](https://huggingface.co/spaces/Luigi/rts-commander)**
403
+
404
+ *"In the grim darkness of the Tiberium future, there is only war... and natural language commands."* ๐Ÿš€
README.old.md ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: RTS Commander
3
+ emoji: ๐ŸŽฎ
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ ---
10
+
11
+ # ๐ŸŽฎ Command & Conquer: Tiberium Dawn - Web Version
12
+
13
+ A faithful recreation of the classic Command & Conquer: Tiberium Dawn in **pure web technologies** (FastAPI + WebSocket + Canvas).
14
+
15
+ ---
16
+
17
+ ## ๐Ÿ“‚ Project Structure
18
+
19
+ ```
20
+ web/
21
+ โ”œโ”€โ”€ README.md # This file
22
+ โ”œโ”€โ”€ app.py # FastAPI server & WebSocket
23
+ โ”œโ”€โ”€ start.py # Server launcher
24
+ โ”œโ”€โ”€ localization.py # Multi-language support
25
+ โ”œโ”€โ”€ ai_analysis.py # AI engine
26
+ โ”œโ”€โ”€ mcp_server.py # MCP server integration
27
+ โ”œโ”€โ”€ backend/ # Game logic
28
+ โ”œโ”€โ”€ frontend/ # JavaScript game engine
29
+ โ”œโ”€โ”€ static/ # Assets (images, sounds)
30
+ โ”œโ”€โ”€ docs/ # ๐Ÿ“š Documentation
31
+ โ”œโ”€โ”€ tests/ # ๐Ÿงช Test scripts
32
+ โ””โ”€โ”€ tools/ # ๐Ÿ› ๏ธ Dev/debug/ops scripts
33
+ ```
34
+
35
+
36
+ ---
37
+
38
+ ## ๐Ÿš€ Quick Start
39
+
40
+ ### Local Development
41
+
42
+ 1. **Install dependencies:**
43
+ ```bash
44
+ pip install -r requirements.txt
45
+ ```
46
+
47
+ 2. **Start the server:**
48
+ ```bash
49
+ python start.py
50
+ ```
51
+
52
+ 3. **Open in browser:**
53
+ ```
54
+ http://localhost:8000
55
+ ```
56
+
57
+ ---
58
+
59
+ ## ๐Ÿ“– Documentation
60
+
61
+ ### ๐Ÿ“š Complete Documentation
62
+ All technical documentation is in **[docs/](docs/)** (28 files organized by category):
63
+ - **Architecture:** System design, project structure
64
+ - **Gameplay:** Features, mechanics, Red Alert compatibility
65
+ - **Harvester AI:** Complete AI implementation (6 docs)
66
+ - **Deployment:** Setup, Docker, testing
67
+ - **Summaries:** Final reports and migration guides
68
+
69
+ **Quick Links:**
70
+ - **[docs/QUICKSTART.md](docs/QUICKSTART.md)** - Detailed quick start
71
+ - **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** - System architecture
72
+ - **[docs/FEATURES_RESTORED.md](docs/FEATURES_RESTORED.md)** - All features
73
+ - **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)** - Deployment guide
74
+ - **[docs/README.md](docs/README.md)** - ๐Ÿ“š Complete documentation index
75
+
76
+ ### ๐Ÿงช Testing
77
+ All test scripts are in **[tests/](tests/)** (4 scripts):
78
+ - `test.sh` - Main test suite
79
+ - `test_features.sh` - Feature-specific tests
80
+ - `test_harvester_ai.py` - Harvester AI tests
81
+ - `docker-test.sh` - Docker deployment tests
82
+
83
+ See **[tests/README.md](tests/README.md)** for usage guide.
84
+
85
+ ---
86
+
87
+ ## ๐Ÿ› ๏ธ Outils (dev/debug/ops)
88
+
89
+ Les scripts utilitaires sont dans **[tools/](tools/)**:
90
+ - `tools/debug_ai.py` โ€” Utilitaires de dรฉbogage AI
91
+ - `tools/local_run.sh` โ€” Lancement local pratique
92
+ - `tools/deploy_hf_spaces.sh` โ€” Dรฉploiement vers Hugging Face Spaces
93
+
94
+ ---
95
+
96
+ ## ๐ŸŽฎ Key Features
97
+
98
+ โœ… **Real-Time Strategy Gameplay**
99
+ - Resource management (Tiberium harvesting)
100
+ - Base building with power system
101
+ - Unit production and combat
102
+ - Fog of War
103
+
104
+ โœ… **Authentic C&C Experience**
105
+ - GDI faction with classic units
106
+ - Minimap with live updates
107
+ - Construction yard, power plants, barracks, refineries
108
+ - Infantry, tanks, and harvesters
109
+
110
+ โœ… **Web-Native**
111
+ - No downloads or installations
112
+ - Play directly in browser
113
+ - Cross-platform compatible
114
+ - Responsive UI
115
+
116
+ โœ… **Multiplayer Ready** (Foundation)
117
+ - WebSocket-based architecture
118
+ - Real-time state synchronization
119
+ - Scalable server design
120
+
121
+ ---
122
+
123
+ ## ๐ŸŽฏ Controls
124
+
125
+ | Action | Key/Mouse |
126
+ |--------|-----------|
127
+ | **Select unit/building** | Left Click |
128
+ | **Move unit** | Right Click (ground) |
129
+ | **Attack** | Right Click (enemy) |
130
+ | **Box select** | Click + Drag |
131
+ | **Build structure** | Click building button |
132
+ | **Place building** | Click grid location |
133
+ | **Change language** | Language buttons (top) |
134
+
135
+ ---
136
+
137
+ ## ๐ŸŒ Multi-Language Support
138
+
139
+ - ๐Ÿ‡ฌ๐Ÿ‡ง English
140
+ - ๐Ÿ‡ซ๐Ÿ‡ท Franรงais
141
+ - ๐Ÿ‡น๐Ÿ‡ผ ็น้ซ”ไธญๆ–‡
142
+
143
+ Switch language anytime with top-left buttons.
144
+
145
+ ---
146
+
147
+ ## ๐Ÿ—๏ธ Tech Stack
148
+
149
+ **Backend:**
150
+ - FastAPI (async web framework)
151
+ - WebSockets (real-time communication)
152
+ - Python 3.8+
153
+
154
+ **Frontend:**
155
+ - Vanilla JavaScript
156
+ - HTML5 Canvas (rendering)
157
+ - CSS3 (UI styling)
158
+
159
+ **Game Engine:**
160
+ - Custom JavaScript engine
161
+ - Canvas-based rendering
162
+ - WebSocket state sync
163
+
164
+ ---
165
+
166
+ ## ๐Ÿ“ฆ Deployment
167
+
168
+ ### Docker (Recommended)
169
+
170
+ ```bash
171
+ docker build -t rts-web .
172
+ docker run -p 8000:8000 rts-web
173
+ ```
174
+
175
+ See **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)** for complete deployment guide.
176
+
177
+ ---
178
+
179
+ ## ๐Ÿงช Testing
180
+
181
+ Run the test suite:
182
+ ```bash
183
+ ./tests/test.sh
184
+ ```
185
+
186
+ See **[tests/README.md](tests/README.md)** for all available tests.
187
+
188
+ ---
189
+
190
+ ## ๐Ÿ“Š Project Status
191
+
192
+ **Version:** 2.0 (Web)
193
+ **Status:** Production Ready โœ…
194
+ **Rating:** 4.9/5 (97.3% feature parity with Pygame)
195
+
196
+ **Compared to C&C Red Alert:**
197
+ - 49% raw feature parity
198
+ - 4.7/5 context-adjusted score
199
+ - 3 aspects superior to Red Alert
200
+
201
+ See full comparisons inside docs/ (if present).
202
+
203
+ ---
204
+
205
+ ## ๐Ÿ“œ License
206
+
207
+ MIT License - See LICENSE file for details.
208
+
209
+ ---
210
+
211
+ ## ๐Ÿ™ Credits
212
+
213
+ Inspired by **Command & Conquer: Tiberium Dawn** (Westwood Studios, 1995)
214
+
215
+ ---
216
+
217
+ ## ๐Ÿค– MCP (Model Context Protocol) Integration
218
+
219
+ This project includes support for the Model Context Protocol (MCP), allowing AI agents to interact with the game programmatically.
220
+
221
+ ### Features
222
+
223
+ - **Game State Access**: AI agents can retrieve the current game state
224
+ - **Action Execution**: AI agents can perform actions in the game
225
+ - **AI Analysis**: Access to tactical analysis from the built-in AI
226
+ - **Documentation Access**: Provides game documentation as resources
227
+
228
+ ### Running the MCP Server
229
+
230
+ ```bash
231
+ cd web
232
+ python mcp_server.py
233
+ ```
234
+
235
+ The MCP server will start on port 8001.
236
+
237
+ ### Documentation
238
+
239
+ See **[docs/MCP_INTEGRATION.md](docs/MCP_INTEGRATION.md)** for detailed information about the MCP integration.
240
+
241
+ ---
242
+
243
+ **๐Ÿ“š Full Documentation:** [docs/](docs/)
244
+ **๐Ÿงช Test Scripts:** [tests/](tests/)