Skip to content
Arcade style game written in Zig
Branch: master
Clone or download
Latest commit 940ead5 May 3, 2019

README.md

Oxid

Oxid is an arcade-style game where you fight waves of monsters in a fixed-screen maze. This is more or less a clone of Verminian Trap (2013, Locomalito). Verminian Trap was originally inspired by Wizard of Wor (1980, Midway). Oxid is currently not nearly as fun as Verminian Trap, see TODO.md for planned features.

Oxid is written in the Zig programming language.

Installation

  • Install SDL2 and libepoxy
  • Install Zig (get it from master, version 0.2.0 is too old)
  • Depending on your version of Git, you may have to explicitly update the submodules: git submodule init followed by git submodule update

How to play

To run the debug build:

zig build play

To build and run the release build:

zig build -Drelease-fast=true
zig-cache/oxid

Game controls:

  • arrow keys: move
  • space: shoot
  • esc: leave game
  • m: toggle sound muting

Debug/cheat controls:

  • backquote: fast forward
  • return: skip to next wave
  • F2: toggle rendering of move boxes
  • F3: toggle invulnerability
  • F4: toggle profiling spam
  • F5: cycle through preserved graphics glitches

Screenshot

Screenshot

Code

Oxid uses a minimalistic Entity Component System, which is certainly overkill for a game like this, but for me it's a experiment in itself.

Here are the main gameplay-related files:

The ECS framework itself is located in src/common/gbe/. It is small but quite rough and somewhat opaque as it involves a fair bit of metaprogramming.

Actually using the ECS requires very little boilerplate.

  • To add a component type, add a struct to components.zig and register it in game.zig.
  • To add an entity prototype, add a function to prototypes.zig.
  • To add a system, add a file to systems/ and import/call it in frame.zig.

Adding new graphics, sound effects, or input bindings is not as polished but still relatively easy. Documentation to come later.

Notes

Low-level graphics code was originally based on andrewrk's Tetris demo for Zig.

Sound effects from https://opengameart.org/content/512-sound-effects-8-bit-style

Uses Dawnbringer's 16-colour palette.

Uses my zig-hunk and zig-pcx one-file libraries, as well as zang.

You can’t perform that action at this time.