Visual Diary: Bright Ideas

Note: This diary is about research into the file formats. Screenshots are from Daggerfall running in DOSBox.

So I’ve been trying to find where Daggerfall stores extra information about flat billboard objects strewn throughout the world. Cows moo, cats meow, and lights… well they light things. For some time I just assumed this information was somewhere unknown in the file formats, and lately I’ve been going mad trying to find it. After not making any progress, I decided that sound effects and lighting properties must be hard-coded based on the texture used.

To test this out, I quickly modified my BSA readers to write back different textures for miscellaneous block flats in BLOCKS.BSA. In the following screenshots the only thing I have modified is the texture index.

lighttest1

Default Scene

This screenshot is of a General Store facade at night. Note the street light is illuminating the store nicely.

Before taking this screenshot, I have prepared a few modified BLOCKS.BSA files with different flats in place of the defaults. The purpose was to see how Daggerfall handled a simple texture index change. If the light kept flickering, then I knew lights were stored elsewhere and had to keep looking.

lighttest2

Lights Out!

After changing the texture index from a street light to a spell effect, the lighting effect is no longer applied. This is a good sign that I’m on the right track.

lighttest3

Testing A Theory

After putting the lights out, it seemed likely that Daggerfall was injecting a standard light source whenever the engine encountered a flat billboard using any texture from TEXTURE.210 (Lights). The billboard is also set to be emissive so that it appears to be self-lit.

To test this out, I replaced the street lights with braziers, and the lights returned. This was enough to prove how lights work, but what about cows and cats? Are billboard sound effects played based on texture alone?

lighttest4

Daisy

For the next test, I found a nice dark spot with a cow standing near a building. This cow is mooing happily – and frequently!

lighttest5

Flame On

I then replaced Daisy with a brazier. Not surprisingly, the mooing stopped completely and the billboard started illuminating the building behind it.

The lesson learned here is never make assumptions when dealing with Daggerfall’s file formats. Just because it makes sense for something to work a certain way doesn’t mean Daggerfall does it like that. Hard-coded lights and sounds, based on texture index, is a good example of how Daggerfall manages not to conform.

The good news is this behaviour is very easy to reproduce in Daggerfall Scout, and I can stop looking for light and sound definitions in RMB blocks. I can start working on my own lighting model to reproduce those wonderfully atmospheric flickering lights.

I also have a suspicion that Daggerfall scales trees and other objects in a hard-coded manner as well. To test this, I’ll use the same texture modification technique on trees and find out. If the results are interesting, I’ll add to this visual diary.

Posted in Daggerfall Scout, Visual Diary.