A small top‑down game originally built for college coursework, now re-released using SDL2 for portability.
- Rendering, input, and windowing are implemented with SDL2 and SDL2_image.
- Maps are plain-text grids validated at load time.
- Assets are simple XPM bitmaps.
- Makefile — cross‑platform build (Windows/Linux/macOS)
- src/ — game sources
- Core: src/and_goodbye.c, src/config.c
- Map I/O: src/render.c, src/read_fd.c, src/split_string.c
- Gameplay: src/movement.c, src/validator.c, src/infected_map.c, src/image.c, src/utils.c
- include/ — project headers and vendored SDL headers
- Project API: include/and_goodbye.h
- img/ — XPM sprites
- maps/ — sample maps (*.ber)
- lib/ and bin/ — Windows SDL2 binaries
Prerequisites:
- Linux/macOS: SDL2 + SDL2_image development packages
- Debian/Ubuntu:
sudo apt install libsdl2-dev libsdl2-image-dev
- Fedora:
sudo dnf install SDL2-devel SDL2_image-devel
- macOS (Homebrew):
brew install sdl2 sdl2_image
- Debian/Ubuntu:
- Windows: MinGW-w64 (or MSYS2/mingw), uses bundled DLLs in lib/ and bin/
Commands:
- Build (release):
make
- Build (debug):
make debug
- Clean objects:
make clean
The output binary is and_goodbye
(Linux/macOS) or and_goodbye.exe
(Windows).
-
Linux/macOS:
./and_goodbye maps/map.ber
-
Windows:
and_goodbye.exe maps\map.ber
- Ensure
SDL2.dll
andSDL2_image.dll
are on PATH or next to the executable (see bin/).
- The game expects a
.ber
map file path as the first argument. - Close the window or use the platform’s standard close action to quit.
- Keyboard handling is implemented in src/movement.c.
- Sample maps are in maps/.
- Maps must be:
- Non-empty and rectangular — enforced in src/validator.c
- Fully surrounded by walls (
1
) — see walls checks in src/validator.c
- Loading flow:
render_map
reads the file, accumulates text, and splits lines viasplit_string
, using buffered reads fromkeep_reading_fd
.
- Tile size is defined by
IMG_SIZE
(currently 32).
- "ERROR: FILE NOT FOUND" — the provided map path is wrong or unreadable.
- "ERROR: EMPTY MAP" — the file has no content.
- "Error\nMAP SHOULD BE A RECTANGLE" — inconsistent line lengths.
- "Error\nMAP MUST BE SURROUNDED BY WALLS 1" — outer border is not walls.
On Linux/macOS, missing libraries at link/runtime usually means SDL2/SDL2_image dev/runtime packages aren’t installed.
- Assets are XPM files referenced in include/and_goodbye.h (e.g., character and environment sprites under img/).
- Windows build uses
-I\include\SDL2 -L\lib
from the Makefile and links-lmingw32 -lSDL2main -lSDL2 -lSDL2_image
.
This project depends on SDL2 and SDL2_image; see their respective licenses in the SDL distributions. Project source and assets are provided for educational