ollama-game/README.md
2026-08-30 03:21:26 +02:00

72 lines
No EOL
2.5 KiB
Markdown

# C/SDL2 Game Framework
A lightweight, professional game template built with C and SDL2, designed for macOS. This project implements a robust game loop architecture with a cinematic introductory sequence and precise frame-rate management.
## 🚀 Features
- **Fixed Time-Step Loop**: Locked at 60 FPS using `SDL_Delay` and execution time calculation to ensure consistent gameplay across different hardware.
- **Cinematic Intro System**:
- Typewriter-style text animation driven by millisecond timers (`SDL_GetTicks`).
- Dynamic centering algorithm for text rendering regardless of string length.
- "Hold-to-Quit" mechanism utilizing `delta_time` for mathematical precision.
- **State Management**: Centralized `Game` struct acting as the single source of truth for the application state.
- **macOS Optimized**: Configured to work seamlessly with Homebrew-installed SDL2 libraries.
## 🛠️ Technical Stack
- **Language**: C (C11)
- **Libraries**:
- `SDL2`: Core windowing, input, and rendering.
- `SDL2_ttf`: TrueType font rendering.
- `SDL2_image` & `SDL2_mixer`: Linked and ready for asset expansion.
## 📋 Prerequisites
You must have Homebrew installed on your macOS system. Install the required SDL2 dependencies using:
```bash
brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer
```
## 🔨 Building and Running
The project includes a `Makefile` to automate the compilation process.
1. **Compile the project**:
```bash
make
```
2. **Run the game**:
```bash
./game
```
3. **Clean build files**:
```bash
make clean
```
## 📂 Project Structure
- `src/main.c`: Core game logic, including the game loop, input handling, update, and render functions.
- `Makefile`: Build configuration using `sdl2-config` for path resolution.
- `assets/`: Directory for game assets (e.g., `font.ttf`).
## 🎮 Controls
- **Hold ESC**: Exit the game (requires a 1-second hold during the intro).
- **Arrow Keys**: Movement logic is implemented (currently disabled during the intro sequence).
## 🗺️ Roadmap
- [ ] Implement transition from Intro Sequence to Active Gameplay.
- [ ] Integrate sprite rendering for the player character.
- [ ] Expand game world with interactive objects.
- [ ] Add background music and sound effects using `SDL2_mixer`.
## 🔊 Audio Credits
- dialog-beep.wav: Sound effect from [freesound.org](https://freesound.org/people/nugsano/sounds/842200/) by nugsano
## 🔤 Font Credits
- font.ttf: Determination Mono Web Font from [FontSpace](https://www.fontspace.com/determination-mono-web-font-f23209)