This document provides guidance for AI coding agents working in the PHPDTS (PHP Battle Royale) codebase.
## Project Overview
PHPDTS is a PHP-based web game emulating Battle Royale gameplay. It uses vanilla PHP with MySQL database, custom template system, and no framework dependencies.
**Tech Stack:** PHP 7.4/8.2, MySQL 5.7+, HTML/CSS/JavaScript (vanilla), PDO/MySQLi
---
## Build/Run/Test Commands
### Development Server
```bash
# Start PHP built-in server (recommended for development)
php -S localhost:8080 -t.
# Alternative using Yii (if composer dependencies installed)
composer install
./yii serve -t .
```
### Database Operations
```bash
# Database initialization - run via browser
# Navigate to: http://localhost:8080/install.php
# Import database structure
mysql -u root -p dbname < gamedata/sql/all_forInstall.sql
```
### Bot/Daemon Process
```bash
# Enable game bot daemon
bash ./bot/bot_enable.sh
# Run with nohup for persistence
nohup bash ./bot/bot_enable.sh &
```
### Testing
This project does not have a formal test framework. Manual testing is done by:
1. Running the game in browser
2. Using devtools.php for debugging
3. Checking `$log` variable output in-game
For ad-hoc PHP syntax checking:
```bash
# Check PHP syntax on a single file
php -l include/game/battle.func.php
# Check all PHP files
find .-name"*.php"-exec php -l{}\;
```
### Configuration Cache
```bash
# Regenerate configuration after modifying config files
composer dump-autoload
```
---
## Code Style Guidelines
### File Organization
```
phpdts/
├── include/ # Core PHP libraries
│ ├── common.inc.php # Main initialization (load first)