How miwate/invasion-c works
Purpose and entry points
INVASION is a native C/SDL2 game, apparently centered on defending against zombie waves with manually or automatically placed turrets. The build entry point is Makefile; make produces build/jeu, while level-oriented targets select content such as levels/impossible.txt or the automated levels/demo.txt scenario. Runtime execution begins in src/main.c.
Application orchestration
src/main.c is the top-level coordinator. The declared module split is exposed by prot/jeu.h, prot/video.h, and prot/replay.h: main should initialize subsystems, select/load a level, run the game loop, and arrange shutdown. src/jeu.c contains core gameplay state and rules; src/io.c and src/video.c provide its interaction boundaries.
Gameplay and level content
The gameplay domain is isolated in src/jeu.c with its public interface in prot/jeu.h. Level files are data-driven scenario inputs rather than compiled maps: levels/facile.txt, levels/survie.txt, and levels/demo.txt represent selectable difficulty/mode variants. Control flows from level selection into game-state initialization, then through repeated gameplay updates until completion or failure.
Input/output and persistence boundary
src/io.c is the terminal/file interaction layer described by the repository architecture. It mediates user-facing textual I/O and communicates with gameplay rather than making the game engine depend directly on terminal behavior. Persistent artifacts include replay.txt and score/leaderboard files under lb/, notably lb/scores.txt and lb/bravo.txt; replay-facing declarations live in prot/replay.h.
Rendering and media
src/video.c, defined by prot/video.h, owns graphical presentation. It loads assets from tex/ and renders through SDL image/window facilities; the source art includes tex/zombies.psd, tex/fond.psd, and font tex/pixelgame.otf. Audio is a separate runtime asset dependency, currently audio/invasion.mp3, likely consumed through SDL_mixer.
Runtime and build infrastructure
The executable is compiled with GCC via Makefile; generated objects and binary are placed in build/ (build/main.o, build/jeu.o, build/jeu). Required external native libraries are SDL2 plus SDL_image, SDL_mixer, and SDL_ttf. This is a desktop native application, not a service or web runtime.
Legacy boundary
_old/main_old.c and _old/ scripts are historical/alternative implementation material. They should not be treated as part of the active architecture unless the Makefile explicitly references them; the active source set is src/ plus prot/.
Main entry points: jeu.c Gameplay engine · main.c Main coordinator · video.c SDL renderer · jeu jeu
Components 16
Build & Runtime
Game Application
- Main coordinator · Initializes subsystems, selects levels, runs the loop, and shuts down.
src/main.c - Gameplay API
prot/jeu.h - Gameplay engine · Owns game state, wave progression, and outcomes.
src/jeu.c - Terminal & file I/O · Keeps textual interaction outside the gameplay engine.
src/io.c - Video API
prot/video.h - SDL renderer · Creates graphical presentation and renders gameplay state.
src/video.c - Replay API
prot/replay.h
Game Content & Persistence
- Level scenarios · Selectable difficulty and automated game scenarios.
levels/demo.txt - Textures & font · Zombie art, background art, and game font.
tex/zombies.psd - Game audio
audio/invasion.mp3 - Replay record
replay.txt - Leaderboard files · Scores and congratulatory leaderboard content.
lb/scores.txt
Connections 18
- Makefile → GCC: invokes
- GCC → jeu: builds
- jeu → Main coordinator: starts
- Main coordinator → Gameplay API: uses
- Gameplay API → Gameplay engine: defines
- Main coordinator → Video API: uses
- Video API → SDL renderer: defines
- Main coordinator → Replay API: uses
- Main coordinator → Level scenarios: selects and loads
- Level scenarios → Gameplay engine: initializes scenario
- Gameplay engine → Terminal & file I/O: exchanges text I/O
- Gameplay engine → SDL renderer: provides state
- SDL renderer → Textures & font: loads
- SDL renderer → Game audio: uses
- Gameplay engine → Replay record: records
- Replay API → Replay record: declares access
- Gameplay engine → Leaderboard files: updates scores
- jeu → SDL2 libraries: links against