prj tiny
A small first-person sword combat game built with raylib. 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 (built with audio + OGG/Vorbis support)
- A C compiler (gcc/clang)
music.ogg(optional — place next to the binary)
~build
gcc tiny.c -o tiny -lraylib -lm -lGL -lpthread -ldl -lrt -lvorbisfile -lvorbis -logg
For a static build (recommended for distribution):
gcc tiny.c -o tiny -Wl,-Bstatic -lraylib -lvorbisfile -lvorbis -logg \
-Wl,-Bdynamic -lGL -lm -lpthread -ldl -lrt
~run
./tiny
music.oggis 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
Wavestructs and loaded viaLoadSoundFromWave— no.wavfiles needed - Combat: sword swings are time-based with damage applied at the swing midpoint, gated by a
damage_dealtflag to prevent multi-hit - Camera: raylib's built-in
CAMERA_FIRST_PERSONmode
~license
Trinity License