Overview
What Is Trek?
Trek is a personal project to build a complete game development technology stack from scratch. It provides a modern platform for games to run on with minimum dependencies β a single executable that can run multiple sample games with a basic software rendering engine and a basic scripting language.
The engine is written in C and targets an extraordinary range of platforms: DOS (VESA), Win9x (GDI via OpenWatcom), Win32, Linux (X11/Xlib), macOS (Cocoa/Core Graphics), and SDL2/SDL3 as a fallback. All core platform implementations use zero external dependencies β just the native system APIs.
Features
Engine Capabilities
Compatibility
Platform Support
| Platform | Backend | Dependencies | Binary Size |
|---|---|---|---|
| DOS | VESA 2.0+ | OpenWatcom, DOS4GW | ~50 KB |
| Win9x | GDI | OpenWatcom | ~45 KB |
| Win32 | Win32 GDI | None / MinGW | ~29β155 KB |
| Linux | X11 / Xlib | libx11-dev / musl | ~20β25 KB |
| macOS | Cocoa / Core Graphics | None | ~29 KB |
| SDL | SDL2 / SDL3 | SDL library | ~15 KB+ |
Architecture
Modular Design
Trek uses a clean platform abstraction layer. The main program is platform-agnostic, calling into a common platform.h API that each backend implements natively:
src/platform.h β Common platform API interface
src/platforms/windows.c β Win32 GDI implementation
src/platforms/linux.c β X11/Xlib implementation
src/platforms/macos.m β Cocoa implementation
src/main.c β Platform-agnostic main program
Cross-compilation is handled via CMake toolchain files for MinGW-w64 (Windows) and musl-cross (Linux).
Learning
References & Books
Trek's development is guided by classic and modern game programming literature:
- Game Engine Architecture
- Game Programming Patterns
- Foundations of Game Engine Development
- 3D Math Primer for Graphics and Game Development
- Computer Graphics from Scratch
- Tricks of the Game Programming Gurus
- Black Art of 3D Game Programming
- Tricks of the 3D Game Programming Gurus








