← Palanca Studios

Trek

Game Development Technology from Scratch

by Alexandre Fontoura

Engine C Retro & Modern

A game engine built from the ground up in C with minimal dependencies. Custom software 3D rendering, multi-platform support from DOS to macOS, SIMD optimizations, and a passion for understanding every pixel on screen.

Scene Editor

Scene Editor 1
Scene Editor 2

Model Editor

Model Editor 1
Model Editor 2
Model Editor 3
Model Editor 4
Model Editor 5
Model Editor 6
Model Editor 7

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.

Engine Capabilities

πŸ–₯️
Multi-Platform
DOS, Win9x, Win32, Linux, macOS, and SDL β€” all from one codebase.
🎨
Software Renderer
Custom 3D rasterizer with no GPU dependency. Pure CPU rendering.
⚑
SIMD Optimized
AVX2 vectorized triangle rasterization with 1.76Γ— speedup over scalar.
πŸ”§
Zero Dependencies
Native platform APIs only β€” Win32 GDI, X11, Cocoa. No external libs.
πŸ”€
Cross-Compilation
Build Win32 and Linux binaries from macOS via MinGW and musl-cross.
πŸ“
Modular Architecture
Clean platform abstraction with per-platform implementations.

Platform Support

PlatformBackendDependenciesBinary Size
DOSVESA 2.0+OpenWatcom, DOS4GW~50 KB
Win9xGDIOpenWatcom~45 KB
Win32Win32 GDINone / MinGW~29–155 KB
LinuxX11 / Xliblibx11-dev / musl~20–25 KB
macOSCocoa / Core GraphicsNone~29 KB
SDLSDL2 / SDL3SDL library~15 KB+

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).

References & Books

Trek's development is guided by classic and modern game programming literature:

Rasterization References