Home

Awesome

Zig-Showdown

A community effort to create a small multiplayer 3D shooter game in pure zig

Development

Communication

The main communication happens via the Zig Showtime discord. Please join if you want to participate!

Asset Building

Assets are spread over 3 different folders:

When invoking zig build assets, the build system will search for files in assets-in and will translate them into the game-custom format which are stored in assets.

Assets that don't need to be converted will just be copied flat into the assets folder.

Translation Table

This table lists all implemented (or planned) asset file associations:

Input FileTarget File ExtensionResource Type
*.png.texTexture
*.tga.texTexture
*.bmp.texTexture
*.obj.mdlModel
*.wav.sndSound (https://github.com/zig-community/Zig-Showdown/issues/9)
*.ogg.musMusic (https://github.com/zig-community/Zig-Showdown/issues/11)

Tools

Each tool receives three cli args:

  1. Input path: This is a path to the file that should be converted
  2. Output path: This is the target file where the final asset file should be written
  3. Asset name: This is the identifier (file path) which is used in the game can should be used to refer to other assets

Contribution

Checkout

Clone the repo and all submodules:

git clone https://github.com/zig-community/Zig-Showdown --recursive

Committing

Feel free to create a PR to this repo, but please make sure you've run zig fmt on your files to keep a consistent state.

Build

# Use this to build the project
zig build assets install

# Use this to run the game in a debug session
zig build assets run

Recommended to be built with the latest master, but Zig 0.7.0 should be fine.

The following build targets are available:

The following build options are available:

OptionAllowed ValuesDefault ValueEffect
default_portu163315Sets the default game port
initial_statecreate_server, create_sp_game, credits, gameplay, join_game, main_menu, options, pause_menu, splashsplashSets the initial state of the game, changing where the game starts. This allows improved debugging for stuff like gameplay or options where waiting for the normal game flow to finish is too long.
enable-fps-counterbooltrue when DebugWhen enabled, displays a text that shows frame time in ms and frame rate in fps.
embed-resourcesboolfalseWhen enabled, the assets folder is embedded into the final executable, creating a single-file game.
renderersoftware, openglsoftwareSets the given value as the rendering backend for the game. This allows to exchange the used graphics APIs.
jackboolfalseEnables the JACK audio backend
pulseaudioboolEnabled on LinuxEnables the PulseAudio audio backend
alsaboolEnabled on LinuxEnables the ALSA audio backend
coreaudioboolEnabled on MacOSEnables the CoreAudio audio backend
wasapiboolEnabled on WindowsEnables the WASAPI audio backend
debug-toolsboolfalseTools are usually built in ReleaseSafe mode for performance, but when working on the tools, it's better to compile them in Debug mode. Setting this flag does this.

OpenGL Loader

You need zig-opengl to regenerate the binding:

# assuming we are in the project repository:
SHOWDOWN_ROOT=$(pwd)

# Prepare the opengl generator
cd /path/to/zig-opengl
make generator.exe

# Create our OpenGL 3.3 + GL_ARB_direct_state_access
mono generator.exe OpenGL-Registry/xml/gl.xml $(SHOWDOWN_ROOT)/deps/opengl/gl_3v3_with_exts.zig GL_VERSION_3_3 GL_ARB_direct_state_access GL_KHR_debug