Tuesday, June 22, 2010

Those Wacky Modders!

An old Quake TC called Shrak has thrown up an interesting crash bug. There is one place in the first map where you get to pick up some armour; as soon as you do that your weapon changes (WTF!) and DirectQ goes down in flames. The reason why is that the weapon model has only one frame, and I have to confess that the possibility of that happening had never occurred to me when I wrote my code to handle interpolation of muzzle flashes (which reads the first 2 frames simultaneously).

If you've ever loaded a map with a skybox in DirectQ you may have noticed that it's sloooooow. Skyboxes require 6 textures (one for each face) and some mods provide 1024 x 1024 skyboxes, for a grand total of 24 MB of concompressed data to go down to your Video RAM. Ouch! (The fact that DirectQ loaded each skybox twice didn't help either but I've fixed that now).

One popular external texture pack contains some textures with weird resolutions like 503 x 617. These need to be resampled to powers of two before they can be uploaded to your graphics hardware. A such a high resolution we're talking about taking a process that's already none too speedy (uploading a large texture) and making it substantially slower.

PNG files contained in PK3s need to be uncompressed twice. Once for the PK3 uncompression and once for the PNG uncompression. Just walk away. Make a cup of tea. Go down the shop and buy a newspaper. Take the dog out chasing rabbits. It might be finished by the time you come back.

Another popular external content pack (and you can Quote me on this one!) has a torch model with almost as many triangles in it as the player model. One map makes very heavy use of this torch model, stuffing maybe 50-60 of them into one part of the map. None of which are culled by visibility from certain angles. It's a minor miracle I've got this performing well, but in the normal run of things you can wave your framerates goodbye. (The ironic thing here is that most of those triangles are concentrated in a very very small part of the model that you can't even see unless you're up really really close to it!)

The saga continues... will it ever end?

3 comments:

Chip said...

I think the saga is already over. Many of those wacky mods are old, some of them before 2000. I encountered my share of bugs with After the Fall mod. Sometimes crashing in the first map, and a crash to desktop, somewhere later in the map, don't remember exactly where. I'll try playing it again soon.

But as Inside3D has been revived and it's gathering some pretty good modders, I think all weirdness and hackiness of QuakeC programming is going to disappear.

I'm not sure I believe what I just wrote, but I just hope we'll see better and better mods, more total conversions (I miss those), maybe new, standalone games.

Cheers.

Coranth said...

On Shrak,

I've never seen the weird weapon change you speak of, MH; obviously for me DirectQ crashes as soon as you look at / touch the armor. It's bizzare! Thanks for looking into this so quickly, though! Hrm, maybe you might consider slipping some fixes for major crash-prone mods like Shrak into DirectQ, but only have said fixes and workarounds load when those mods are loaded.

mhquake said...

Try it in FitzQuake and you'll see the model change.

There are obviously 2 kinds of bugfix here. Ones that apply in a more general case (such as the one-frame viewmodel) and ones that are only needed for certain mods.