Holiday update

As usual December has been a busy time, but a little bit of progress has been happening with Doomsday, too.

Saving 3D model state. I’ve put the most effort into ensuring that the state of 3D model animations gets saved and restored when writing and reading savegames. This has no bearing on gameplay as such, but visually it is pretty important that the objects get rendered the same way before and after loading a save. In practice, this was quite challenging because the new model renderer supports advanced features like multiple animation sequences, scripted rendering passes, and shader variables. All this state information gets included in the savegame package as a new file, so it can also be gracefully ignored in case any compatibility issues or other problems arise when dealing with old save files.

Multiplayer resource check. When joining a multiplayer game, the client checks that the same packages are loaded as on the server. This includes all WADs, DEHs, and PK3s. Any resource mismatches could lead to crashes or other problems during MP games.

Mac menu. I did a small tweak for the Mac UI: Doomsday now has a native menu bar for switching between the available games.

Fate. Finally, I’d like to call attention to a cool Hexen mod by fate that I recently enjoyed playing through. If like me you are a fan of Hexen, this is a nice way to spend a few hours during your holidays: fate_v0.1.pk3. Please leave your feedback and/or comments to the author on the forums.

Merry Christmas and happy holidays everyone! *<:)

Wand update and custom shaders

This week’s screenshot shows a work-in-progress version of veirdo’s beautiful new Sapphire Wand model for Hexen. It takes advantage of the new model rendering features such as random alternative animation sequences, animated shader variables, and custom GL parameters for drawing layered effects.

On the topic of weapon models, the new renderer still lacks the vanilla-style walk bobbing. That shouldn’t be a lot of work to implement, though. After some additional weapon position fine-tuning this should be ready for prime time, and we can start preparing some models for distribution and use with the 2.0 builds.

As planned, last week I was working on a better way to load shaders from packages. I managed to complete the improved functionality as planned: when any package is loaded, it is checked for shader definitions; if found, the shaders are added to the runtime shader bank. Similarly when a package is unloaded, its shaders are removed from the the shader bank. Now there is no longer any special case logic needed for the net.dengine.client packages, as their shaders are loaded the same way as shaders from any other package.

I then proceeded to add a way to customize shaders using macros. Like C, GLSL allows defining macros for the preprocessor. This enables injecting custom code at compile time. For example, let’s say a model wants to continuously scroll its texture. This could be done using Doomsday Script, however one would need to keep restarting the script at regular intervals to keep the animation going — not the most efficient way to do things if you have a lot of objects using the model. However, if the model injects a line of code into the model shader for modifying its UV coordinates on every frame, all the work is done cheaply by the GPU. And even better, if the shader is later updated (for example when the user installs a new version of the engine), the model has a much better chance of continuing to work correctly.

Click the screenshot below for a short animation:

UV scrolling shader

Naturally model packages can also provide their completely custom shaders that do not depend on the net.dengine.client shaders in any way.

I was also briefly obsessed with improving the formatting of log entries. There is something about formatting text that manages to hook me every time. The most visible changes are that the so-called “log sections” that contain contextual information about where a log entry was created are now placed within square brackets. This should improve readability. In the doomsday.out/runtime debug output, the content now uses better alignment to visually indicate which entries belong together.

#1815 200.594 I  (v) [BindContext] 'global' cleared
#1815 200.594 I  (v)               'deui' cleared
#1815 200.594 I  (v)               'console' cleared
#1815 200.594 I  (v)               'message' cleared
#1815 200.594 I  (v)               'chat' cleared

Hexen save woes

I’ve started investigating what could be wrong with Hexen savegames regarding the state of ACS scripts. Right now I’m feeling quite overwhelmed — this code is complicated, even convoluted. Particularly the ACS state is broken down into multiple parts: world state, map state, individual script states as thinkers, and deferred script run requests. Each part is saved and loaded separately.

Due to all the complexity, I’m not surprised we are having malfunctions. Continue reading Hexen save woes