6 ms·
The levels are stored as 6 bytes per "brush" (i.e. block): 1 byte per each x, y, z coordinates and width, depth and length[1]. The y (vertical) resolution of th
by phoboslab 5y ago
The levels are stored as 6 bytes per "brush" (i.e. block): 1 byte per each x, y, z coordinates and width, depth and length[1]. The y (vertical) resolution of these values is a bit higher than the x/z resolution to allow for stairs while allowing for bigger levels on the horizontal plane. So the level files are not directly stored as a grid, but as a collection of axis aligned blocks.
The collision detection however builds a grid out of these, so the game can quickly look up any position within the game world[2].
[1] https://github.com/phoboslab/q1k3/blob/master/pack_map.c#L789-L792 https://github.com/phoboslab/q1k3/blob/master/pack_map.c#L78...
[2] https://github.com/phoboslab/q1k3/blob/master/source/map.js#L69-L82 https://github.com/phoboslab/q1k3/blob/master/source/map.js#...
- ido 5y agoThanks for the explanation! I assume you built a visual map editor to make these levels, rather than writing that data directly?
- phoboslab 5y agoI used TrenchBroom[1] to build the levels. It was initially created to build Quake maps but now supports many derivative games like Half-Life, too. I can't speak highly enough of it; it's really really good! [1] https://trenchbroom.github.io/ https://trenchbroom.github.io/