Zi9's Blog

🏠 Index 🌐 zi9.dev

Deformerz - An experiment to remake Terep 2

Published 26/05/2026

A bit of background

So this is a project I started in April of 2021. Terep 2 is a tech demo-ish racing game from between 1994 and 1997 created by Nagymathe Denes as a hobby project. My first introduction to this game was way back in primary school where we would play it on the school computers for fun (it had split-screen multiplayer). It was short and sweet fun.

The remake

For my remake I initially tried C#/.NET Core (that's why some of the screenshots reference csharp) but ultimately decided to use C because I like the idea of a remake not built using an off the shelf game engine because it's just less bloaty. I could remake it using Godot but that would be just wack to have a remake be almost 100MB while the original EXE is 37433 bytes. And after some testing I couldn't get the build size down with C# and I wanted to do manual memory management. So barebones C it is. But I need a way to draw graphics and I really don't want to learn how to raw-dog that currently so I went to what in my opinion is the best way to make games in C - Raylib

The map data

Now, due to the license of the original game prohibiting any decompilation or reverse engineering of TEREP2.EXE, I started by just inspecting the data files that come with the game. Surprisingly the map is just constructed from 3 texture files in PCX format and were not the hardest to make sense of:

PCX is a fairly simple format to figure out. It's effectively just a palette based array of pixels with some metadata and I was able to easily make a decoder for these textures, build a mesh from it and display it in raylib.

First texture

Next step was to map the colors from the map files onto a mesh. First iterations of that did not go the best...

But after a bit of debugging and tweaking I managed to bring the map into raylib. I also added an affine shader to mimic the affine mapping that the original game uses.

Loaded map

This is where the project was moved from C# to C as well.

The car data

The car data is not in any standard format. This is a task for just well educated guesses and lots of staring at the data in the hex editor. By putting a simple highlight on the 0x00 bytes, a structure emerges:

Car hex data

After a bit of time I managed to extract some structure of the car model data:

The current final state

That's as far as the project has developed so far. I sort of lost motivation to work on this because I realized I'm gonna need to figure out how to do the deformable body physics... physics is hard...

The project is open source on GitHub

Deformerz