id Software File Format(s)

Im working on a new file format for my engine and Im a bit stuck, I really like the way id Software file formats are, they are all text files and compressed using zlib, which is nice.

My questions is how they feed in the info to OpenGL that quickly… Their loading time is pretty acceptable and they are also probably using VBO for every geometry (which is sent in 1 chunk, so no progressive loading)… does anyone have a clue how they parse their file that quickly and feed the data to GL… I test with fscanf, sscanf, atof but i takes way too much time to load similar “map” files using my implementation…

Anyone know a way to parse quickly similar type of files in a fashion that is easy to feed to GL?


Just read the complete file into a memory buffer (or memory map it directly. Then take a simple tokenizer and rush through the data.

If you dont want to write this yourself, grab the Quake 3 source and look into it (com_parse() was the function’s name, if I remember correctly…).