Parallel-by-default game framework written in Zig
Go to file
kayomn c68753bf84
continuous-integration/drone/push Build is passing Details
Fix final CWD usage in build script
2024-07-25 21:29:28 +01:00
.vscode Remove unnecessary backbuffer copy 2024-07-25 01:24:13 +01:00
demos Remove unnecessary delta time arg to fixed-timestep systems 2024-07-25 14:25:55 +01:00
ext Initial replacement of Sokol shdc with a runtime compilation system 2024-07-02 23:08:25 +01:00
promo Update readme with promotional content and new build instructions 2024-07-24 00:54:14 +01:00
src Fix CWD path usage in build script 2024-07-25 21:13:52 +01:00
.drone.yml Fix Zig test build errors 2024-07-24 00:56:14 +01:00
.gitattributes Update readme with promotional content and new build instructions 2024-07-24 00:54:14 +01:00
.gitignore Convert project into Zig package and add demos (#55) 2024-07-24 00:25:18 +01:00
.gitmodules Initial replacement of Sokol shdc with a runtime compilation system 2024-07-02 23:08:25 +01:00
build.zig Fix final CWD usage in build script 2024-07-25 21:29:28 +01:00
build.zig.zon Convert project into Zig package and add demos (#55) 2024-07-24 00:25:18 +01:00
readme.md Add missing section to readme 2024-07-25 14:26:39 +01:00

readme.md

Ona

Screenshot of Ona rendering a CRT display distrotion effect on the default texture

Table of Contents

  1. Overview
  2. Goals
  3. Technical Details
    1. Requirements
    2. Building
    3. Packaging

Overview

Ona is a straightforward game engine with the aim of staying reasonably lightweight through a modular architecture.

Ona is also the Catalan word for "wave".

Goals

  • Fully-featured two-dimensional raster and vector rendering capabilities.

  • Support major computer gaming ecosystems; Namely Microsoft Windows, SteamOS, Unix-like systems, and the web.

  • Minimize external dependencies.

  • Provide utilities for handling rendering but otherwise leave the higher-level game logic and data structuring to the programmer.

  • Enforce an architecture that makes non-interdependent logic trivially parallelizable.

Technical Details

Requirements

Ona currently depends the following third-party tools to build it:

  • Platform support for SDL2 at version 2.0.20 installed via the standard shared binary format redistributable.
  • SPIR-V shader compilation system utilities available from the system path, namely glslangValidator.
  • Zig compiler toolchain.

As the project evolves, dependencies on libraries external to the project codebase will be minimized or removed outright to meet the goals of the project as closely as possible.

Building

After the repository has finished cloning, you will then want to also clone all Git submodule dependencies via the git submodule update --init --recursive command. If you are using a Git front-end, this may be a menu option or is handled automagically, it varies depending on the front-end.

Once all third-party tools and dependencies are satisfied, navigate to the root project folder and run zig build demos to build the demo executables. The resulting binaries will be placed in /demos with a name respective to the source file it was built from.

To experiment without creating your own Zig project, you can create a new uniquely named source file in this directory and the zig build demos step will (re)build it along with everything else.

The unit testing suite for the engine modules (src/ona, src/gfx, etc.) may be built and ran via zig build tests.

Tests are ran by our continuous integration host so should these shouldn't fail locally without user intervention. If they do, feel free to report an issue via my email linked in my Sauce Control bio or through any other means of public communication I have.

Packaging

Since this is a Zig package it can be consumed via the Zig package manager using the usual steps.

(These steps have been adapted from Andre Weissflog's tutorial for for setting up Sokol with Zig package manager.)

  1. Create a new Zig project if you have not already.
  2. Create a build.zig.zon accompanying your build.zig if you do not already have one.
  3. Your build.zig.zon should, at minimum, contain the following dependency listed in the dependencies section:
.{
    .dependencies = .{
        .ona = .{
            .url = "git+https://sauce.pizzawednes.day/kayomn/ona.git#[commit-hash]",
        },
    },
}
  1. Make sure the [commit-hash] is a recent commit that will work with your version of the Zig compiler and, when in doubt, choose the latest master commit.

  2. Run zig build and add the content hash it outputs in your terminal to your dependencies:

.{
    .dependencies = .{
        .ona = .{
            .url = "git+https://sauce.pizzawednes.day/kayomn/ona.git#[commit-hash]",
            .hash = "[content-hash]",
        },
    },
}
  1. Add a package declaration for Ona to your build.zig and add the relevant modules to your application.
const ona_dependency = b.dependency("ona", .{
  .target = target,
  .optimize = optimize,
});

const app = b.addExecutable(.{
    .name = "My Ona App",
    .target = target,
    .optimize = optimize,
    .root_source_file = b.path("src/main.zig"),
});

app.root_module.addImport("ona", ona_dependency.module("ona"));
app.root_module.addImport("gfx", ona_dependency.module("gfx"));
app.root_module.addImport("hid", ona_dependency.module("hid"));