Tuesday, June 12, 2007

Expanding areas

Well, turns out there's still some work to be done in the area department. Mercator has some missing methods in the area handling code. For one thing, there's a Mercator::Area::setLayer method signature, but no implementation. I don't know however if it makes much sense for an area to change it's layer once it's been created; perhaps that's why it's missing?
In addition, when an area is added to the terrain, through Mercator::Terrain::addArea, there's no corresponding removeArea method. Writing such a method is however not completely straight forward since when an area is added to the terrain, it's in turn added to only those Segments that it intersects. One would however think that when removing an Area all one has to do is to iterate over all Segments and remove it when found.
The third problem is that since an area only is added to those segments that it intersects, problems arises when an area is either moved to another segment, or changed so that it now intersects another segment. The effect is that no shading will occur on the new segment. The solution for this would be to add a new method Mercator::Terrain::refreshArea(Mercator::Area* area) which will iterate through all segments, and remove the area if it no longer intersects the segment, and add it where it does.

Also, I had to restart cyphesis since all the NPCs had died. They start out at full health, but since they never eat, they eventually starve to death. When restarting I took the opportunity to update to the latest cvs version. I also added some boulders to the landscape. We have some very nice boulder meshes that Jay did, along with a nice texture, but for some reason it's not used. A normal forest landscape is filled with all kind of boulders. The result can be seen here. Note that the shading of the boulders for some reason is a little bit strange; I'll have to investigate why that is.

No comments: