diff --git a/prompt.md b/prompt.md index 9d9f05d..93391bf 100644 --- a/prompt.md +++ b/prompt.md @@ -1,26 +1,34 @@ -Project Summary: C/SDL2 Cinematic Game Template +Project Summary: C/SDL2 Cinematic Game Template with Screen Shake and Audio # 🛠 Technical Stack Language: C (C11 standard) -Libraries: SDL2, SDL2_ttf +Libraries: SDL2, SDL2_ttf, SDL2_mixer OS: macOS (Homebrew environment) Build System: Makefile using sdl2-config for cross-platform header/library paths. # 🚀 Current Implementation 1. Core Architecture -Game Loop: Implemented a professional Input $\rightarrow$ Update $\rightarrow$ Render cycle. +Game Loop: Implemented a professional Input → Update → Render cycle. FPS Locking: Locked at 60 FPS using a dynamic frame-capper (SDL_Delay based on frame start/end timestamps) to ensure CPU efficiency and consistent timing. -Delta Time: Implemented time-based calculations instead of frame-based ones to ensure gameplay speed is identical regardless of hardware performance. +Delta Time: Fixed time-step used for consistent updates; delta time passed to input handling (currently unused for movement but maintains architectural consistency). 2. Cinematic Text System -Typewriter Effect: A custom-built system that reveals a message ("Hello, human.") letter-by-letter. -Timing: Uses SDL_GetTicks() to trigger a new character reveal every 150ms. -Rendering: Uses SDL_ttf for high-quality text. The text is dynamically centered on the screen by calculating the surface dimensions relative to the window size. -Memory Safety: Implemented strict null-termination (\0) on the text buffer to prevent memory leakage/artifacts. -3. Game Mechanics & State -Game State Struct: A centralized Game struct that manages the loop status, timers, font pointers, and player data. +Typewriter Effect: A custom-built system that reveals two messages letter-by-letter. +Message 1: "Hello, human." (large font, 120pt) +Message 2: Multi-line Undertale-themed message about C being the best programming language (small font, 24pt) +Timing: Uses SDL_GetTicks() to trigger a new character reveal every ~333ms for message 1 and ~36ms for message 2 (after 3.5s delay). +Rendering: Uses SDL_ttf for high-quality text. The text is dynamically centered on the screen by calculating surface dimensions relative to window size, supporting multi-line strings. +Memory Safety: Implemented strict null-termination (\0) on text buffers to prevent memory leakage/artifacts. +3. Enhanced Effects & Features +Screen Shake: Triggered on each non-space character beep, providing visual feedback with decaying intensity. +Audio Feedback: Plays a beep sound effect (lowered pitch via mixer frequency) for each typed non-space character. Hold-to-Quit: A safety exit mechanism where the user must hold the Escape key for exactly 1000ms (1 second) to terminate the program. -Player Object: A Player struct exists with position and speed data (currently invisible but fully functional in the background). +Player Object: A Player struct exists with position and speed data; arrow key movement is implemented (invisible during intro sequence but functional in background). +4. Game Mechanics & State +Game State Struct: A centralized Game struct that manages loop status, timers, font pointers, audio resources, shake effect, and player data. +Message Transition: Automatically switches from message 1 to message 2 after 3.5 seconds of completing message 1. +Resource Management: Proper initialization and cleanup of SDL, TTF, mixer, fonts, and audio chunks. # 📂 Project Structure Makefile: Handles compilation and linking of SDL2 libraries. src/main.c: The entire game logic, fully documented with header and inline comments. assets/font.ttf: External TrueType font used for rendering. +assets/dialog-beep.wav: Sound effect for character typing. # 🎯 Current Status -The game currently launches a black window, reveals a centered message with a cinematic typewriter animation, and allows the user to exit via a timed Escape-key hold. The codebase is cleaned, documented, and optimized for macOS. \ No newline at end of file +The game launches a black window, reveals a centered message with a cinematic typewriter animation (two sequences), includes screen shake and audio feedback for each typed character, and allows the user to exit via a timed Escape-key hold. Arrow keys move an invisible player character in the background. The codebase is cleaned, documented, and optimized for macOS. \ No newline at end of file