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.

Visual Diary: Adding Ground Detail

Every now and then, I plan on adding a visual diary showing a feature as it progresses. Today’s diary is about ground details.

 It's A Start

It’s A Start

I’ve added a simple ground plane under the city map. The ground in Daggerfall is composed of squares fitting perfectly under a block. The ground is tiled together in the same way blocks are tiled together to form a complete map.

The next step is texture it.

 Um Not Quite

Um, Not Quite

Even though I’ve written ground builders a few times in the past (the first was in Daggerfall Explorer), adding this feature into a new engine is bound to encounter bugs. I’ve not quite nailed it this attempt.

 Done

Textures Done

The ground textures are now being placed and aligned correctly across all maps.

 Needs Region Textures

Still Needs Region Processing

Daggerfall uses texture swaps for each region/climate type. You can play with these combinations in Daggerfall Explorer. Here is Sentinel using the default “temperate” texture set used while developing the ground plane.

At some point, I need to re-code the ability to swap in the correct texture. But for now I want to do something a little more interesting.

 New Flats

New Flats

In this screenshot, I’ve started adding flats. My first attempt isn’t that successful. They aren’t at the right height, size, or transparent. But they are standing in the right places, so it’s is a good start.

Another issue with these flats you can’t see in the screenshot is they always face the camera. If you fly into the air and look down, they’re lying flat on the ground! A quick change to the axis alignment will sort that out.

Flats1
Flats2

Working Flats

Flats are now correctly positioned, axis aligned, and alpha-enabled. I feel the scaling needs some work. At this time, it is unknown which numbers Daggerfall uses to scale flats. I will refine this as development progresses.

I’ve never been a huge fan of flat billboards in games, but they were a standard technique in days past and part of the Daggerfall landscape. Despite being antique tech, I feel some of the old charm has started to make its way back into the otherwise dreary maps in Daggerfall Scout.

The next step is to do some gardening and add the local plant life, such as trees, etc. These aren’t stored in the flats records along with everything else. I need to find them before I can draw them from the game files.

I hope you enjoyed this first visual diary.