A Simple C Game Engine

Gama provides a lightweight C library and a modern toolchain, designed to make 2D game development approachable and fun for students and developers.

Core Features

Lightweight C Library

A simple and clean C99 API designed for students and beginners, focusing on core concepts without overwhelming complexity.

Built-in 2D Physics

An effective physics engine is included, with support for bodies, shapes, and collision detection to easily add dynamic interactions.

Immediate Mode Rendering

Draw shapes and UI widgets directly to the screen each frame, simplifying state management and making your code easier to reason about.

Cross-Platform by Design

Write your game once in C and build it for native desktop (Linux, Windows) or for the Web via WebAssembly, using the exact same code.

Animation System

A complete sprite system with support for sprite sheets, custom animation sequences, and a collection of easing functions for smooth motion.

Asset Loading

Natively load common 3D model formats like `.obj` and `.gltf` and popular image formats for textures and sprites.

Guiding Philosophy

01

You Have Control

Gama gives you full control over the main game loop. The engine provides utilities but stays out of your way, allowing you to structure your game exactly as you see fit.

02

Stack First, Heap Less

The API encourages using stack-allocated structs to leverage C's automatic memory management, reducing the cognitive load and common pitfalls of manual memory allocation.

03

No Global State

Designed to avoid global state, Gama allows you to structure your game into different scenes, each with its own state, initialization, and cleanup logic.

A Modern Toolchain

gama dev

Instantly run your project with the fast TCC compiler and enjoy hot-reloading on every file change for a rapid development feedback loop.

gama build

Create optimized release builds for native or web targets using the powerful Zig C compiler for maximum performance.

gama tcc&gama zcc

Gama for Windows bundles pre-configured TCC and Zig compilers. No external downloads or PATH setup needed.

gama bake

Embed assets like images and models directly into your game's executable, simplifying distribution and improving load times.

Clean & Readable Code

#include <gama.h>

int main() {
  // Initialize with window size and title
  gm_init(800, 600, "My Gama Game");
  gm_background(GM_DARKGRAY);

  // Game loop
  do {
    // Draw a moving, purple rectangle
    gm_draw_rectangle(
      gm_anim_sin(0., 1., 1., 0.), 0, // Animate x-position
      0.3, 0.2, gm_rgb(170, 119, 170)
    );
  } while (gm_yield()); // Handles events, clears screen, and loops

  return 0;
}

Live WebAssembly Demo

Gama projects compile directly to WebAssembly. Here is a small interactive sample running entirely in your browser.