# 🎨 RR3 Community Server - Assets Directory

This directory stores game assets that will be served to RR3 clients.

## 📁 Directory Structure

```
Assets/
├── cars/          # Car models, physics data
├── tracks/        # Track models, AI data
├── textures/      # UI and visual textures
└── audio/         # Sounds and music
```

## 🔍 How to Get Assets

### ⚠️ Legal Disclaimer

**Assets are copyrighted by Electronic Arts**. This system is designed for:
- ✅ Game preservation after server shutdown
- ✅ Personal use with legally purchased games
- ✅ Private servers for owned content

**DO NOT:**
- ❌ Distribute EA's assets publicly
- ❌ Use for piracy
- ❌ Share without proper rights

### Method 1: Extract from Your Installation

If you own Real Racing 3 and it's installed on your device:

```bash
# Connect Android device
adb shell

# Navigate to game data
cd /data/data/com.ea.games.r3_row/files/

# List downloaded assets
ls -la

# Pull to your PC (requires root or backup permission)
exit
adb pull /data/data/com.ea.games.r3_row/files/ ./rr3-assets-backup/

# Copy .pak files to Assets directory
cp ./rr3-assets-backup/*.pak ./Assets/cars/
```

### Method 2: Monitor Downloads

Use network monitoring to see what the official game downloads:

```bash
# Install Charles Proxy or Fiddler
# Configure Android to use proxy
# Launch RR3 and let it download content
# Save downloaded files from proxy cache
```

### Method 3: From APK (Some assets are bundled)

```bash
# Decompile APK
apktool d realracing3.apk -o rr3-decompiled

# Look for bundled assets
cd rr3-decompiled/assets/
ls -la *.pak

# Copy to server
cp *.pak /path/to/RR3CommunityServer/Assets/
```

## 📦 Asset File Naming

Assets should be named consistently:

### Cars
```
nissan_silvia_s15.pak
ford_focus_rs.pak
porsche_911_gt3_rs.pak
ferrari_488_gtb.pak
mclaren_p1_gtr.pak
```

### Tracks
```
silverstone_national.pak
brands_hatch_gp.pak
dubai_autodrome.pak
laguna_seca.pak
spa_francorchamps.pak
```

### Textures
```
ui_textures.pak
car_textures_pack1.pak
environment_textures.pak
```

### Audio
```
engine_sounds_pack1.pak
ambient_sounds.pak
music_track1.pak
```

## 🔌 API Endpoints

Once assets are in place, they're accessible via:

```
GET /synergy/content/manifest
    - List all available assets

GET /synergy/content/download/{type}/{id}
    - Download specific asset
    Example: /synergy/content/download/cars/nissan_silvia_s15

GET /synergy/content/info/{type}/{id}
    - Get asset metadata

GET /synergy/content/list/{type}
    - List all assets of a type

GET /synergy/content/health
    - Check content service status
```

## 🧪 Testing

### 1. Add a test asset

Create a dummy .pak file for testing:

```bash
# Create test file
echo "Test asset content" > Assets/cars/test_car.pak
```

### 2. Check if it appears

```bash
curl http://localhost:5001/synergy/content/manifest
```

Should show:
```json
{
  "version": "1.0.0",
  "assetCount": 1,
  "assets": [
    {
      "id": "test_car",
      "type": "cars",
      "size": 19,
      "url": "/synergy/content/download/cars/test_car"
    }
  ]
}
```

### 3. Download it

```bash
curl http://localhost:5001/synergy/content/download/cars/test_car -o test.pak
```

### 4. Check in game

Connect your modded APK to the community server and start the game. It should request assets from:
```
http://your-server:5001/synergy/content/download/cars/...
```

Monitor with:
```bash
adb logcat | grep -E "(Content|Download|Asset)"
```

## 📊 Asset Sizes

Typical RR3 asset sizes:

- **Car Model**: 10-20 MB
- **Track**: 50-100 MB  
- **Texture Pack**: 5-10 MB
- **Audio Pack**: 1-5 MB
- **Full Game Assets**: 2-4 GB total

Plan storage accordingly!

## 🔐 Security

Assets are served as-is without authentication (for game preservation).

If you want to add authentication:

1. Edit `ContentController.cs`
2. Add `[Authorize]` attribute to endpoints
3. Require API key or session token

## 🚀 Performance

For better performance:

1. **Use a CDN** - Cloudflare, AWS CloudFront
2. **Enable caching** - Add Cache-Control headers
3. **Compress files** - Use gzip for .pak files
4. **Use HTTPS** - For secure delivery

## 📝 Asset Metadata (Optional)

You can add `.json` files alongside `.pak` files:

`nissan_silvia_s15.json`:
```json
{
  "id": "nissan_silvia_s15",
  "name": "Nissan Silvia Spec-R",
  "type": "car",
  "class": "C",
  "version": "1.0.0",
  "dependencies": [
    "car_textures",
    "engine_sounds"
  ]
}
```

## 💡 Tips

1. **Start small** - Add one car, test it
2. **Verify checksums** - Ensure files aren't corrupted
3. **Organize by version** - Keep track of asset versions
4. **Document sources** - Know where each asset came from
5. **Backup everything** - Assets are precious!

## 🆘 Troubleshooting

### Assets not showing in manifest
- Check file permissions
- Ensure .pak extension
- Verify directory structure

### Download fails
- Check file exists
- Verify server is running
- Look at server logs

### Game crashes after download
- Asset might be corrupted
- Wrong asset version
- Incompatible format

## 📚 Resources

- Real Racing 3 Wiki: Game content information
- Unity Asset Bundle Extractor: Tool for Unity games
- QuickBMS: Extract game archives
- Wireshark: Network traffic analysis

---

**This folder enables full offline gameplay!** 🎮

With all assets present, RR3 can run completely independently from EA's servers.

**Remember**: Only use assets you legally own. This is for preservation, not piracy! 🏁
