D2X-XL Worklog

Notes on features and problems from the development of D2X-XL, newest first.

A New Renderer

History

After having mostly gotten rid of the lag plaguing D2X-XL for so long, it was time to take a more general look at its rendering engine, which didn't really cope too well with the huge new levels DLE-XP and D2X-XL had made possible, or with displaying large amounts of objects at a time. Actually D2X's render code had just been a quick hack, threading the most basic OpenGL calls into the initially software based renderer to make it work with OpenGL hardware acceleration. There had been no tweaks, no code or data rearrangements, nothing to make it utilize OpenGL at least halfway efficiently. For standard Descent levels and visuals that wasn't a requirement anyway, D2X threw the polygons fast enough at the graphics card. Not so for D2X-XL with its huge levels, high poly count models, new effects and new lighting methods. In certain situations, D2X-XL slowed down to a slide show even on powerful systems.

Considerations

I had been thinking about how I could change that for quite a while already, and at some point of time I even asked myself why I should keep 'polishing a turd' instead of rewriting the renderer altogether. Well, there were several answers to this question: I didn't have the time for a complete rewrite, I probably didn't even have the skill (though that mostly boils down to having enough time), and I liked the 'turd'. So I set out to do something about what I had already.

Objects

Step one was to optimize the model renderer. The current model data will be converted to a more manageable format on the fly when first rendering it, and during subsequent render calls, the optimized model will be used in more efficient lighting and rendering routines. This brought a 50% speed increase and allowed to multi-thread certain CPU intensive tasks, because they weren't executed inline during rendering, but ahead of it, like the lighting. Not bad.

Geometry

The second step was to rewrite the static geometry renderer. This was a pretty complex task and took quite some time to accomplish. First thing I did was to split routines doing general stuff (like computing vertex color and light) off the legacy renderer so that I could easily reuse them in the new render path. Next I devised an efficient data structure for the level geometry and separated the various render processes from each other, executing them sequentially instead of inline during rendering (primarily the lighting). This again allows to execute CPU intensive tasks ahead of the rendering, putting them into multiple threads if the hardware suggests it. It also allows for implementing rendering optimiziations like only setting the depth buffer in an initial render pass, reducing overdraw in subsequent passes (overwriting a further away pixel with a closer one). That optimization made it possible to sort the faces due to criteria minimizing state switches (like using a different texture, or shader program) during rendering. Finally, more efficient render calls could be used here, too. Depending on the area rendered, these optimizations can bring up to 70% speed increase (the more faces and textures, the greater the improvement).

Transparency

During the work on the new render path I found out that rendering all transparent faces back to front after having rendered all opaque geometry had become mandatory. Fortunately I had already implemented that as an option. You can imagine how great my relief was that I didn't have to write and test that code too, because it already was all there and working.

Lighting

A nice side effect of all the work I had spent on this was that I could improve the appearence of OpenGL style lighting. It was a bug at first that brought me there: Depending on player position, certain faces appeared brighter or darker. When investigating the issue, I found out that this always happened in the direct vicinity of faces emitting light, and depended on whether that face or its neighbours got rendered first. Light emitting faces received a 'brightness boost' in the form of a specular highlight and some shine. This looked pretty good, so I just extended this treatment to every face. Voilà: Nicer, more vibrant lighting and no more brightness changes.

Conclusion

The complexity of the new render path brought a few bugs I didn't catch right away, but hopefully they are a thing of the past as I write this. So enjoy the speedier rendering particularly where you need it: In big mines with lots of objects flying around (probably at you ).


News

A new D2X-XL update fixing broken screen resolution persistence is available

There is yet another D2X-XL update is available (the new Pumo Mines broke a few things ...)

Believe it or not: There's a new D2X-XL version online!

Uploaded updated D2X-XL and library source code that compiles with Visual Studio 19

After a really long time, another new DLE version is available

A new DLE version is available (hear, hear!) :D

A new Max OS X version of D2X-XL is available!

D2X-XL now offers a cartoon style render mode!

New D2X-XL and DLE versions are available

Blarget has got his own area in the level spotlight

New D2X-XL and DLE versions are available

A couple of levels have been added to the level spotlight

Hooray! We're finally having a new Mac OS X version of D2X-XL!

D2X-XL now features an observer mode for multiplayer games

A new D2X-XL version with improved multiplayer synchronization is available

A new D2X-XL version fixing out of sync problems in multiplayer games is available

A new D2X-XL version with many multiplayer bug fixes is available

Added high quality (ogg) Descent 1 and 2 music to the downloads area

A new D2X-XL version with important bug fixes is available

D2X-XL compiles and runs on Linux again!

Descent 1 and 2 high res textures are now available as complete downloads

A new DLE version with a ton of bug fixes and improvements is online

A new D2X-XL version is online

A new D2X-XL version with a much needed bug fix is online

A new DLE version is online

Published another DLE version with more bug fixes and improvements by Sirius

Published a new D2X-XL version

Published a new DLE version with tons of bug fixes and improvements by Sirius

D2X-XL now supports Oculus Rift 3D headsets!

Updated DLE and D2X-XL to support new level features requested by Pumo

Added an article about DLE's new tunnel generator to the worklog

DLE's new tunnel generator is finished

Added a new article to the worklog

Published a new DLE version

Added a new article to the worklog

Added two new articles to the worklog

D2X-XL and DLE-XP now support triangular segment sides!

DLE-XP has an OpenGL render and 1st person view!

New DLE-XP version available

Wrote a new worklog article

Check out DarkFlameWolf's level spotlight section!

New DLE-XP and D2X-XL versions are available

A new DLE-XP version is available

Added a worklog article about the way point feature

Added way point support to DLE-XP and D2X-XL

Posted a bunch of new screenshots

Posted a bunch of new screenshots

A New version of DLE-XP is available

New OS X version of D2X-XL is available!

Added article about lightmaps to worklog.

New article and video added to worklog.