diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -0,0 +1,65 @@ +# prj tiny + +A small first-person sword combat game built with [raylib](https://www.raylib.com/). Fight a single enemy in a starlit arena. Built as a learning/prototype project. + + + +## ~features + +- **First-person melee combat** — left-click to swing your sword +- **Procedural audio** — sword swings, footsteps, and ambient drone are all generated in code (no audio files needed) +- **Enemy AI** — the enemy auto-attacks on a randomized timer and turns to face you +- **Player death & respawn** — die and you respawn after 2 seconds +- **Title screen + pause menu** — mouse-driven UI with fade transitions +- **Twinkling starfield** — 200 stars with per-star phase animation +- **Streaming background music** — drop in your own `music.ogg` + +## ~controls + +| Action | Input | +|--------|-------| +| Move | WASD | +| Look | Mouse | +| Swing sword | Left click | +| Pause | ESC | +| Start game | Click PLAY or ENTER | + +## ~requirements + +- [raylib](https://github.com/raysan5/raylib) (built with audio + OGG/Vorbis support) +- A C compiler (gcc/clang) +- `music.ogg` (optional — place next to the binary) + +## ~build + +```bash +gcc tiny.c -o tiny -lraylib -lm -lGL -lpthread -ldl -lrt -lvorbisfile -lvorbis -logg +``` + +For a static build (recommended for distribution): + +```bash +gcc tiny.c -o tiny -Wl,-Bstatic -lraylib -lvorbisfile -lvorbis -logg \ + -Wl,-Bdynamic -lGL -lm -lpthread -ldl -lrt +``` + +## ~run + +```bash +./tiny +``` + +> `music.ogg` is loaded relative to your working directory. Place it next to the binary if you want background music. The game runs fine without it. + +## ~how it works + +The game is a single C file (~625 lines) with no external assets except an optional music file: + +- **Graphics:** raylib's 3D immediate-mode API (`DrawCube`, `DrawCylinderEx`, etc.) for the world + sword models, 2D overlay for HUD/menus +- **Audio:** sounds are synthesized at runtime into `Wave` structs and loaded via `LoadSoundFromWave` — no `.wav` files needed +- **Combat:** sword swings are time-based with damage applied at the swing midpoint, gated by a `damage_dealt` flag to prevent multi-hit +- **Camera:** raylib's built-in `CAMERA_FIRST_PERSON` mode + +## ~license + +Trinity License |