- Full game title: OpenMW
- Developer: OpenMW community
- Type: Open Source
- Target Platforms: Windows, Linux, Mac, (Android)
- Links: YouTube channel, GitHub
Table of contents[Show/Hide]
OpenMW is a cross-platform open source rewrite of the Elder Scrolls III: Morrowind engine. In it's current state it is mostly complete and can be used to play Morrowind plus the official expansions.
Being an open-world RPG engine, it uses a large number of Ogre features, so we will describe our experience in this article.
- Programming Language: C++
- Main library: Ogre3D (currently 1.9)
- Other libraries: SDL2, MyGUI, OpenAL, FFmpeg, Bullet physics
We have written custom Ogre Archive classes to be able to load resources from BSA (Bethesda Softworks Archive) files, and for handling case-insensitive path lookup as necessary on Linux systems.
This works fine and requires no changes to Ogre itself, but for a cleaner code we are hoping that the Resource system redesign GSOC eventually gets merged into Ogre.
Morrowind uses the proprietary NetImmerse file format, which is very flexible. It is more of a "scripted scene" format rather than a mesh format. OpenMW can load NIF files and convert them into a set of Ogre Entities, Particle Systems and Controllers.
We also used the Ogre ParticleSystem for NIF file support. We had to register custom Emitter and Affector classes to properly emulate the particle behaviour for NIF files. Thanks to Ogre's extensible design this did not require any changes in Ogre.
OpenMW has a flexible shader pipeline, courtesy of the Shiny add-on, allowing us to create many complex shader permutations from a single shader file. It also currently supports both GLSL and HLSL shaders from the same shader file, using porting macros defined in a header.
"Shiny" and the related Material system improvements Draft that I published sparked off some discussions on the Ogre forums, and was a source of inspiration for the new "HLMS" material system now officially included in Ogre 2.1. Once we start using Ogre 2.1, we will most likely port our shaders to this system and shiny will become obsolete.
The Ogre animation system does not support timed animation events, so a custom animation system was written that moves the bones in the Ogre skeleton manually. Over the course of development, we found a few oddities in Morrowind's animation system that we needed to replicate, so writing a custom animation system turned out to be a good choice.
Vertex morph animation is used in some NIF files, for example the facial animations and various creature animations. We used the Pose animation feature in Ogre to implement this and it "just worked"!
Morrowind's characters have segmented meshes for the various body parts. This becomes necessary when exchanging a body part with a clothing part, for example. To implement this we used Ogre's TagPoint system, which allows us to attach entities to a bone in the skeleton. One mostly unknown feature in Ogre is being able to create an "empty mesh" with no vertices, but a skeleton assigned to it. We use this to create an empty "base entity" which the various body parts and clothing parts are then attached to using TagPoints.
Initially we used the Ogre::Terrain component and it worked mostly OK, but we were not able to achieve the same triangle layout as necessary for the Morrowind terrain. This caused an ugly crack in the environment where objects are placed precisely on the terrain. It also became apparent that the Ogre::Terrain component was unsuitable for paging large worlds.
In 2013 a custom terrain engine was written for OpenMW, which is able to display all of Vvardenfell's landmass at once.
For the user interface we are using MyGUI. It turned out to be rather easy to get it to resemble Morrowind's GUI, and at the same time MyGUI is feature rich and has some usability improvements "out of the box" over the Morrowind GUI. Thanks to its flexible skinning system and available toolset it will be easy for modders to create their own UI skins and layouts.
For the BINK cutscenes in Morrowind we have written a custom video player using FFmpeg. In 2014 this player was refactored to be a generic Ogre video player and is now available under the MIT license as an Ogre-addon.