introduction
Prayer is a cross-platform outdoor/indoor game engine I've been working on in my spare time. It has grown from a simple terrain demo into a full-fledged engine with buildings, weapons, and physics. Most of the non-terrain features were implemented within the last two months in a desperate bid to make it as impressive and full-featured as possible before I graduated and starting looking for work. It's written using OpenGL, and currently supports Windows and Mac OS X. I've been developing it on my MacBook Pro with BootCamp, which has made cross-platform development a breeze.

I am assisted in the art department by friend and UAF B.F.A. student Dan Bruington and his brother David. Dan created all of the models you see and some of the buildings. David has created a few more buildings and two dungeons. My art contributions have primarily been textures, shaders, and procedural geometry.

Prayer is, and probably always will be, in a state of development. There are lots of visual flaws. The water is terrible at the moment, there are only short-range shadows, and the glow needs tweaking. But when seen in motion, I think the engine is really breathtaking. I plan on releasing a demo as soon as it is relatively bug-free and complete. I will be taking my laptop into job interviews and showing off Prayer if the interviewer is interested.

screenshots


features

Terrain
Geo mip mapping for LOD. Terrain patches are stored in vertex buffer objects as triangle strips with triangle skirts to conform to neighboring patch's LOD. Terrain data is streamed in between frames, making traversing large maps almost seamless. Holes can be punched in the terrain to allow entrance to underground structures like dungeons and caves.

Each pixel of terrain rendered consists of four parts:

A lazily updated shadowmap computed in a fragment program whenever the sun moves enough to be noticable. A high resolution normalmap is used in the obvious way, while low-resolution shadows are cast from large hills. Thanks to the GPU, the shadowmap can be updated between frames without the player noticing.

An RGBA splatmap. The alpha chooses between a grass detail texture and a generic grayscale detail texture. The generic texture is colored according to the RGB component, so it can take on the appearance of rock, dirt, or purple space dust.

Carefully applied noise. In addition to the detail textures, noise is applied at a low frequency to distant terrain features to give them more definition. Noise is applied at a high frequency to the ground beneath the player's feet to make the ground appear crisp and detailed.

Sky
I implemented A Practical Analytic Model for Daylight by Preetham/Shirley/Smits with some artistic tweaking. The clouds consist of two tiling textures that scroll across the sky dome. The clouds are given 'hotspots' where their alpha is strongest, and these hotspots grow and shrink with time. They are colored using a color look-up texture with a few parameters. At dawn, clouds near the sun draw from a pinker palette. As the sun sinks below the horizon, the sky switches to a simple deep bluish hue and stars become visible. The stars are based on actual Earth data, their colors, positions, and magnitudes were parsed from the brightest 4,000 stars of the HYG database. There are several moon sprites representing the lunar phases.

Flora
The world is coated in realistic grass that sways in the wind. It is spawned randomly wherever the terrain's splatmap has a grass texture. The vertex shader shrinks the grass in the distance, growing up from the ground as you get closer to it. The effect is much less disorientating than the classic alpha fade used in most games. It can even be a bit hypnotic. We also have beautiful custom procedural trees, with parameters that can be tweaked and viewed in real-time in the editor. The leaves are large billboards, with some special vertex shader magic to eliminate some of the problems you see in SpeedTree. Ever walked under a tree, looked up, and rotated the camera in Oblivion? The effect is disturbing. Prayer's leaves look good from beneath, from the side, and from above. The trees are batch impostered when they are far enough away. They continue to animate and sway in the wind as imposters even miles away, making the whole world seem much more alive.

Models
We use the DirectX .X model format for models. Parsing the .X ascii format yourself is a pretty joyless experience. I am planning on putting up some code and probably a tutorial on the subject soon to save others the trouble. The stock Microsoft SDK Maya exporter crashes often, so we were lucky enough to find Chad Vernon's Maya exporter. He was kind enough to send me the source so I could fix a small skeleton bug, and at long last we had a working content pipeline for models! Currently the models are skinned in a separate CPU thread. One of these days I will get around to implementing GPU skinning, although I think the GPU already has enough to do.

Buildings & Interiors
Buildings and underground structures are stored as Quake 3 BSPs. The outside faces and indoor faces are tagged separately for efficient lighting. From a distance, the buildings are rendered as imposters and updated only when the view angle changes sufficently. Get closer and just the outside faces are drawn. If you approach a window or open a door, the inside is drawn as well. When you're in the middle of a dungeon with no windows in sight, no time is wasted on the terrain.

Physics
Fully integrated with the Newton Game Dynamics SDK. Boxes, chairs, and other rigid objects move and bounce realistically, without the bizarre 'floaty' feel many games have. To show off the physics, we have some toys in the demo to play around with:

Telekinesis: You can grab any object you want at a distance, throw it against other objects, stack it, or manipulate it in any other way you see fit.

Buggy: Hop in a buggy and drive around. Realistic suspension and unrealistic tire slip and friction make driving fun and easy. Point the camera in the direction you want to go and the tires will take you away.

Ropes: Ropes can be affixed to any point on any object. Tie two boxes together, or tie a box to a buggy and tow it around.

Sound & Music
Prayer uses OpenAL for 3D positional sound. There are only a few sound effects at the moment, but we'll be adding more as time goes on. Ambient loops and music are streamed from ogg files, and can be triggered by events like entering a building.

Editor

Prayer has a full-featured cross-platform editor written using my OpenGL GUI library, The Handy OpenGL GUI Toolkit. I was originally just going to write it using Windows forms, but the ability to also use it under Mac OS X was just too tempting, and HOG made it really easy to create a nice user interface. It has two sections, the studio and the world editor. Currently, the only module in the studio is an editor for the procedural trees, allowing you to tweak parameters and see how the generated trees look in real-time. The world editor has several modules. You can paint colors and grass onto the terrain, create mountains and valleys, or cut holes for underground structures. Trees can be 'airbrushed' onto the ground in wide random swaths or planted individually. BSP's can be placed and rotated. Eventually, physics and game objects will be placed with the editor. For the time being you have to spawn them using the console.