q321
q321 copied to clipboard
Quake III: Arena demake in 64(-ish) KB
Q321 - A tiny unofficial Quake III: Arena demake
https://user-images.githubusercontent.com/5121829/121275477-7fa45f00-c8d5-11eb-88f1-2abef2c1bdb5.mp4
- 2 levels (q3dm1 and q3dm17), ~100 textures/shaders and 27 models
- multithreaded lightmap baker (some details here)
- OpenGL 3.3 renderer (using VBO+suballocation)
- raw mouse input and Quake 3-like physics
- (very) basic UI
P.A.Q. (Preemptively Answered Questions)
Q: Is this a virus? That's what my antivirus says when I try to download/run this demo.
A: No, this is not a virus. It is, however, a compressed executable, and the heuristics used by antivirus programs often flag these files as potentially malicious. If this is the case for you, there are a few possible solutions:
- add an exception in your antivirus settings (unsafe!)
- try the 'raw' (uncompressed) version of the executable (still unsafe, because you're still running a random program from the internet, but maybe slightly less so)
- build the code yourself
Q: Is the demo secretly downloading assets from a server?
A: No.
Q: Then what's that download.js script for?
A: Downloading assets from a server. More specifically, it's a helper script for data/retrieve_models.bat
, which you can use to download model files from the GtkRadiant Q3 gamepack (icculus.org), just in case you want to run the model compiler and regenerate the cooked_models.h file yourself.
Q: Why use crinkler for a 64k, and not kkrunchy or squishy?
A: At the start of the project the goal wasn't '64k', it was 'as small as I can make it' - so crinkler was the sensible choice, and it kept up surprisingly well as the amount of code and data grew. Even at 64k, startup (decompression) time is still reasonable and (when using aggressive settings) the compression ratio is similar to that of kkrunchy_k7, but somewhat below squishy's. It has one notable advantage, though, in that the executables it produces seem a tiny bit less likely to get flagged by antivirus programs, which, in my opinion, outweighs its most significant downside - compression time.
Q: Why does the file size magically go down right before a release?
A: File sizes logged in size_history.txt are from quick development builds, used to get a general idea of the size impact of each code change. Release builds, on the other hand, are generated with much more aggressive compression settings (e.g./ORDERTRIES:100000
), usually taking hours to produce a slightly smaller executable.
Building
Prerequisites
- Visual Studio 2017 with C++ support (toolset v141) and Windows SDK 8.1
Uncompressed builds
For an uncompressed build, open demo.sln
in Visual Studio, select the Release|Win32
configuration, and build/run the demo
project.
Compressed builds
Compressed builds are generated using build.bat
, which creates a file named demo.exe
in the output/crinkler
folder and adds a new entry in size_history.txt.
Simply running build
(with no arguments) will produce a build with a lower compression ratio (in about 30 seconds).
To shrink the exe further (e.g. for release): run build
again, this time with the argument improve
. Warning: this may take a while!
To reproduce an already-released build: place the corresponding repro file in the project root directory and run
build repro <repro_file_name>
:warning: Warning: you may have to add an exception for the output/crinkler
folder in your antivirus settings if the newly-created executable is flagged and removed immediately after being built.
Credits
This is an unofficial recreation of Quake III: Arena (1999).
QUAKE, id, id Software and related logos are registered trademarks or trademarks of id Software LLC in the U.S. and/or other countries.
Many thanks to:
- id Software for the original Quake III: Arena game (Steam, GOG, free demo), map samples, data specifications and code
- Aske Simon Christensen "Blueberry/Loonies" and Rune L. H. Stubbe "Mentor/TBC" for Crinkler
- Beautypi for Shadertoy
- Inigo Quilez for articles and code covering noise, signed distance fields, and more
- Shadertoy user Dave_Hoskins for the Hash without Sine functions
- Shadertoy user Shane for the Asymmetric Blocks function
- Tom Forsyth for the Linear-Speed Vertex Cache Optimisation algorithm
- Fabian "ryg" Giesen for the index buffer compression algorithm
- .theprodukkt/Farbrausch for .kkrieger
- Dr. Martin Roberts for the R2 sequence