adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Render Zones


From: Kai Sterker
Subject: [Adonthell-devel] Render Zones
Date: Wed, 12 Aug 2009 09:56:17 +0200

Finally, some new design suggestions :-).

The goal is to limit rendering to a certain height level (or range),
so that we can enter buildings or dungeons and actually see the
interior without switching to an interior map. The benefit of that
will be a more seamless experience during exploration and it'll be
easier for the pathfinding, since we do not need to find paths across
map borders.

For the implementation, I have two ideas, although right now I favor the second.

1. The more naive implementation would be to hardcode the "zones" at
wall-height. I.e. a new zone starts every 128px. We figure out which
zone the player is in and render anything in that zone and below. The
tricky part is that we would only want to do that on the inside, so
we'd have to check if there is scenery above the PCs head. On the
bright side, it'll work automatically and only requires a bit of
hindsight during map building (i.e. aligning stuff properly with the
fixed zones). The downside is, once inside a building, the roof of the
building next door will come off too. And, we render all floors below,
even though they are not visible, as we'd only skip drawing everything
above the current zone.

2. The other solution would be to extend the zones we already use for
marking places for pathfinding. Via a flag, we'd designate a zone to a
"render-zone" that would work as follows: anything that is north,
east, south or west of the current zone will be drawn regardless of
it's height-level. Everything inside the zone's bounds will be
discarded if it is either above or below the zone. The current zone
will be figured out by the mapview every time the view changes, so it
will be independent from the character and tied solely to the mapview.
The bright side is that we get better control over what will appear on
screen or not, and we gain some performance by not drawing all the
floors below us that are hidden anyway [1]. On the downside, zones
need to be created manually (via mapedit) for every floor of every
house and dungeon. We'd also need to store zones more efficiently, so
we can retrieve the correct zone fast.


Any other ideas, suggestions, concerns?

Kai


[1] I'd like to implement a hidden surface removal routine as part of
the renderer, but the problem is that I can only tell if surface A
shadows surface B. What I can't tell is whether surface A might be
(partly) transparent (unless we're really strict about giving an alpha
channel only to those tiles that need it). Then we could at least
consider the non-ARGB, non-masked, fully-opaque tiles (such as floor
(or wall) tiles that would actually block the view and save a bit of
processing power since we have to draw less. (The other idea might be
to use some kind of bit-masks, but that would require more processing
power).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]