Tuesday, December 09, 2008

Ember 0.5.5 released!

I meant to publish this post almost a month ago, but never got around to it. Better late than never though...
I finally did the release of Ember 0.5.5 some days into December.

Among the usual slew of bug fixes and overall improvements one of the major new features is the compass. I've written about that before on this blog, and I'm really pleased with how it turned out. It's currently very basic, but I have all kinds of plans for it in the future. Hopefully it will right now help people getting oriented in the world.
This video shows the compass in action.

Another big change was the upgrade to Ogre 1.6. While it might not result in any immediate improvements to the client, it has a much improved script parsing engine and resource management. The latter is extremely useful for us since we now finally can do away with the complex concept of having separate "user" and "system" media. This separation was forces because of earlier versions of Ogre's inability to correctly handle duplicate materials. Instead of letting the client handle the clashes Ogre threw an exception and totally corrupted the internal resource state. Not so any more though. The advantages of this will better be shown in the next release.

We've also added a lot of fixes and improvements to the entity creator. It's still not completely functional though since it's missing proper model preview functionality, something which will be fixes with the next release of Eris (which the next release of Ember will depend on).
Alexey and Thomas also worked on improving the OSX support, to a point where Ember now correctly builds and runs on OSX. Unfortunately it turned out to be a little harder to create a contained package with all dependent libraries. I'm confident that it will be sorted though.

Monday, December 01, 2008

A new compass and minimap

The last couple of weeks I've been working on getting a working compass and minimap into the client. Since the world is extremely dynamic and not known to the client beforehand it's a little bit more complex than one would think. In a game where the world is known in beforehand, it's simply just a matter of slapping a prerendered or hand drawn texture of the world onto a square polygon and show that as the map. That's not something that we can do however as the world is totally dynamic and can be changed at any time. Our setup is instead a little bit more complex.
We want to render the world as it is, but we don't want to have to re-render it each frame, since that would bring the frame rate down. In addition, in order to get the water line properly rendered we must render all terrain tiles in the highest LOD-level. That means sending a lot of polygons to the gfx card (this could however be alleviated in the future by using shaders).
The current setup is therefore to place a camera far up in the sky, looking down. The camera uses orthographic projection, which means that objects won't be smaller as they are futher away. This is crucial for the map perspective, since else it will look just like a regular camera looking down.
We then render from this camera into a texture, 512x512px. This provides us with a snap shot of the current world, minus some foliage which we don't render. In most cases this looks pretty good. Finally we then define a smaller area, 128x128px, which is what we show in the compass. By panning this area within the larger texture we can scroll the map, and only have to update the render when the smaller area reaches the border of the larger texture. When that happens we re-center the camera and do a new render.
In this way we get a nifty compass map which doesn't have to be rerendered each frame.

Finally we need to provide a small arrow in the middle to show the position the camera is facing. The problem here is that CEGUI currently doesn't support rotation of windows, so the solution here is to leverage Ogre. We start with an arrow image which we then slap onto a full screen quad. This quad is then rotated to fit the direction of the camera and rendered into a texture, which is then sent to CEGUI, made into a gui element and placed on top of the compass. It all works splendidly, but there are some extra indirections which might bring the performance down a little bit.

All in all the compass is working pretty well now. There are some minor issues with it sometimes not being correctly updated when terrain pages change, and the buttons for zooming in and out could be made better, but it's pretty much ready for release.
Currently it only works as a simple minimap, but the plan is to add functionality for showing direction markers for interesting entities. We could probably reuse some of the functionality currently used for showing the labels.

With the compass now in place the 0.5.5 release is pretty much feature complete. I plan to get a beta build out this weekend.