I’ve been working on refactoring the terrain and “location” code for the XL Engine. There were several deficiencies with the original DaggerXL system that I was seeking to rectify, which I’ll talk about below. Everything I show in this post was rendered with the software renderer, running in 8 bit mode. As I’ve talked about before, GPU support has also been expanded – Shader Model 2.0 support will no longer be required. The new requirement for GPU rendering is OpenGL fixed function support.
The sky in Daggerfall is basically a flat plane that is scrolled as the camera is rotated, very much like the backgrounds in psuedo-3D games such as the original Mario Kart. The result is that the scrolling of the background doesn’t match the rotation in the foreground. In vanilla Daggerfall this looked strange but when running at smoother framerates an higher resolutions it looks rather disturbing. The XL Engine now uses a “tapered cylinder” to map the 2D sky textures onto 3D geometry in the scene. The result is proper scrolling and perspective while maintaining the appearance of “infinite” distance.
One visual problem in DaggerXL were the “rounded cliffs” that showed up in the terrain, especially around locations. The terrain generation has been improved, changes in elevation in the base heightmap are visualized in a much nicer way now. In addition medium detail data has been added/generated, resulting in more variety. Terrain textures are handled properly now as well, without the seams and hardlines that were in DaggerXL. There are still the occasional seams, when a combination of terrain types isn’t support by the art, but these are rare and were present in vanilla Daggerfall as well. Finally coastlines look much better now then in the last release of DaggerXL.
In DaggerXL transitions between cells caused hiccups that were very noticeable, as new terrain tiles were generated and locations loaded. Due to the terrain refactoring, these pauses are very rarely long enough to be noticeable now. Only parts of the terrain that need updating are regenerated, the area that stays the same is simply “moved” into the correct place for the new view. This means that only a fraction of the visible terrain needs to be touched, instead of all of it like before.
Object positioning is handled using two sets of coordinates – “local world space” and “global.” The global coordinates point to the “cell” the where the objects exist in the world. The “local world space” coordinates are the objects fine grain position within that cell. To position objects relative to the camera, they are converted into “relative” coordinates – basically centered around the cell that the player or camera currently occupies. In the previous release, objects were responsible for updating these relative coordinates in their game logic code. This was obviously a very bad idea, something easy to miss or fail to update. Now these relative coordinates are no longer explicitly stored, only the local world space and global coordinates are actually stored and handled by the objects. The conversion to relative coordinates is done, as needed, at a low level. All code goes through this path, freeing the game logic from having to worry about it at all. This fixes a variety of issues, including the “phantom collisions” and other collision related issues.
Foliage updates and rendering speed has also improved, resulting in much improved exterior rendering performance even on low end hardware or using software rendering. The flats are also scaled properly, fixing scaling issues that the previous release had with several flats.
This post only scratches the surface, a lot of work has been completed since the last update. Below I show a movie of some of this stuff in action.
For the movie the in-game UI has been disabled (just like all the screenshots) and enemies are not loaded. However the release will have all the UI elements, monsters and so forth that the previous release had. Also animated sprites have not been fully reincorporated yet, but they will be in the final release too.
There are more features that I didn’t talk about above that will also be in the release as well. This release will be more complete in terms of gameplay as well as visuals. Features include: waves in the ocean (as shown in the video), NPCs that walk around the locations, improved UI – fixing a variety of issues such as click-through, mouse offset, etc. and implementing missing features such as unequipping items, getting item info, scroll bars and more. So this release is not just about the refactoring and engine merger but improving and fixing existing features, improving performance, improving hardware support – with fixed function support and the software renderer, paving the way for cross platform support, adding networking support (though no actual multiplayer in this release), implementing new features for both gameplay and visuals, merging all projects under one engine and more.