Monday, January 12, 2009

Unified terrain mods

Since this summer's Google Summer of Code we've had support in both Ember and Cyphesis for terrain modifiers. The server side implementation was however incomplete and didn't support all of the shape types available. Furthermore, Sear didn't have any support for terrain mods.
When working on providing a more unified functionality for both the clients and server it quickly became apparent that we needed to push some of the functionality in Ember down to lower level libraries in order to avoid code duplication.
The first step was to extend WFMath to have atlas parsing and generating methods for the more complex shapes. Previously only primitives such as Position and Vector had such methods. One of the advantages of this is that all clients and servers won't have to bother themself with the format of the atlas data, since that's taken care of by WFMath.
Another issue was that the actual code for connecting terrain modifications to the entities to which they belonged was duplicated in both Ember and Sear. The main issue was that it would normally go into the Eris library, but Eris didn't have any dependency on Mercator. That was easily fixed by adding such a dependency, after which the bulk of the duplicated code could be moved into Eris.
The end result of all this is that we now finally have correct and unified support in both Cyphesis, Ember and Sear for all available terrain mods and the shapes used by them. One of the most useful of the mods are the level mod, which makes sure that an area of the terrain is levelled. This is extremely useful when placing houses and other structures, because you want to make sure that the house sits on level ground. If not, you run the risk of having ground poking through the floor, or the foundation of the house seemingly resting on air.
In the following movie you will see a house to which a rectangular polygon shaped level mod is attached. The level mod doesn't have any specific height set and will therefore use the height of the entity itself.

Higher quality can be found here.

No comments: