diff options
| -rw-r--r-- | LICENSE | 29 | ||||
| -rw-r--r-- | README.md | 65 | ||||
| -rw-r--r-- | mus_example.ogg (renamed from mus/mus_rêverie_-_debussy.ogg) | bin | 3948954 -> 3948954 bytes | |||
| -rw-r--r-- | screenshot.png | bin | 0 -> 8640 bytes | |||
| -rw-r--r-- | tiny.c | 4 |
5 files changed, 96 insertions, 2 deletions
@@ -0,0 +1,29 @@ +Trinity License + +~ 2026 ln <ln at 200l dot xyz> + +Redistribution and use in source and and any other forms, with or without +modification, are permitted provided that the following conditions are met: + +Any redistributions, with or without modification to software, or derivative +works in any form must retain the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +Any redistributions, with or without modification to software, or derivative +works in any form must include the entire source code. + +Any redistributions, with or without modification to software, or derivative +works in any form must remain gratis and not be sold at any price for any +amount of profit. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -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 diff --git a/mus/mus_rêverie_-_debussy.ogg b/mus_example.ogg Binary files differindex 222c750..222c750 100644 --- a/mus/mus_rêverie_-_debussy.ogg +++ b/mus_example.ogg diff --git a/screenshot.png b/screenshot.png Binary files differnew file mode 100644 index 0000000..2270d57 --- /dev/null +++ b/screenshot.png @@ -390,8 +390,8 @@ main(int argc, char *argv[]) SetSoundVolume(snd_footstep, 0.35f); SetSoundVolume(snd_ambience, 0.3f); /* Background music (your own .ogg file). */ - Music music = LoadMusicStream("mus_rêverie_-_debussy.ogg"); - SetMusicVolume(music, 0.4f); + Music music = LoadMusicStream("mus_example.ogg"); + SetMusicVolume(music, 1.0f); PlayMusicStream(music); /* 3D Camera. */ Camera3D camera = { 0 }; |