# Spacetris SDL3 - Production Deployment Guide

## 🚀 Build Scripts Available

### 1. Quick Package (Recommended)
```powershell
.\package-quick.ps1
```
- Uses existing Debug/Release build from build-msvc
- Creates distribution package with all dependencies
- **Size: ~939 MB** (includes all assets and music)
- **Output:** `dist/SpacetrisGame/` + ZIP file

### 2. Full Production Build
```powershell
.\build-production.ps1 -Clean
```
- Builds from source with Release optimizations
- Complete clean build process
- More comprehensive but requires proper CMake setup

### 3. Simple Batch Build
```batch
build-production.bat
```
- Windows batch file alternative
- Simpler but less features

## 📦 Package Contents

The distribution package includes:

### Essential Files
- ✅ `spacetris.exe` - Main game executable
- ✅ `Launch-Spacetris.bat` - Safe launcher with error handling
- ✅ `README.txt` - User instructions

### Dependencies  
- ✅ `SDL3.dll` - Main SDL library
- ✅ `SDL3_ttf.dll` - Font rendering support

### Game Assets
- ✅ `assets/fonts/` - PressStart2P-Regular.ttf (retro font)
- ✅ `assets/images/` - Logo, background, block textures (BMP format)
- ✅ `assets/music/` - Background music tracks (11 tracks)
- ✅ `assets/favicon/` - Icon files
- ✅ `FreeSans.ttf` - Main UI font

## 🎯 Distribution Options

### Option 1: ZIP Archive (Recommended)
- **File:** `SpacetrisGame-YYYY.MM.DD.zip`
- **Size:** ~939 MB
- **Usage:** Users extract and run `Launch-Spacetris.bat`

### Option 2: Installer (Future)
- Use CMake CPack to create NSIS installer
- ```bash
  cmake --build build-release --target package
  ```

### Option 3: Portable Folder
 Direct distribution of `dist/SpacetrisGame/` folder
- Users copy folder and run executable
 [ ] Launch-Spacetris.bat works
## 🔧 Build Requirements
 **Solution:** Use `Launch-Spacetris.bat` for better error reporting
### Development Environment
- **CMake** 3.20+
- **Visual Studio 2026 (VS 18)** with Desktop development with C++ workload
- **vcpkg** package manager
- **SDL3** libraries (installed via vcpkg)

### vcpkg Dependencies
```bash
vcpkg install sdl3 sdl3-ttf --triplet=x64-windows
```

## ✅ Pre-Distribution Checklist

### Testing
- [ ] Game launches without errors
- [ ] All controls work (arrows, Z/X, space, etc.)
- [ ] Music plays correctly
- [ ] Fullscreen toggle (F11) works
- [ ] Logo and images display properly
- [ ] Font rendering works (both FreeSans and PressStart2P)
- [ ] Game saves high scores

### Package Validation
### Package Validation
- [ ] All DLL files present
- [ ] Assets folder complete
- [ ] Launch-Spacetris.bat works
- [ ] README.txt is informative
- [ ] Package size reasonable (~939 MB)

### Distribution
### "spacetris.exe is not recognized"
- **Solution:** Ensure all DLL files are in same folder as executable
- [ ] Test extraction on clean system
- [ ] Verify game runs on target machines
### Game won't start
- **Solution:** Use `Launch-Spacetris.bat` for better error reporting

## 📋 User System Requirements

### Minimum Requirements
- **OS:** Windows 10/11 (64-bit)
- **RAM:** 512 MB
- **Storage:** 1 GB free space
- **Graphics:** DirectX compatible
- **Audio:** Any Windows-compatible audio device

### Recommended
- **OS:** Windows 11
- **RAM:** 2 GB
- **Storage:** 2 GB free space
- **Graphics:** Dedicated graphics card
- **Audio:** Stereo speakers/headphones

## 🐛 Common Issues & Solutions

### "spacetris.exe is not recognized"
- **Solution:** Ensure all DLL files are in same folder as executable

### "Failed to initialize SDL"
- **Solution:** Update graphics drivers, run as administrator

### "No audio"
- **Solution:** Check audio device, update audio drivers

### Game won't start
- **Solution:** Use `Launch-Tetris.bat` for better error reporting

## 📈 Performance Notes

### Asset Loading
- **BMP images:** Fast loading, reliable across systems
- **Music loading:** ~11 tracks loaded asynchronously during startup
- **Font caching:** Fonts loaded once at startup

### Memory Usage
- **Runtime:** ~50-100 MB
- **Peak:** ~200 MB during asset loading

### Optimizations
- Release build uses `/O2` optimization
- Link-time optimization enabled
- Assets optimized for size/performance balance

## 🔄 Update Process

1. **Code changes:** Update source code
2. **Rebuild:** Run `.\package-quick.ps1` 
3. **Test:** Verify functionality
4. **Distribute:** Upload new ZIP file

---

**Ready for distribution!** 🎮✨
