On Sat, Jan 3, 2009 at 1:57 PM, jasper van der jeugt <jasper...@gmail.com> wrote:
> I haven't quite been involved in Adonthell development, but here is the main > algorithm I use in my RPG engine for drawing: > > - For each object keep a list of colliding objects that are below or behind > this object. (Speed this up by only calculating this list when an object > moves.) > - All drawable objects have a label "drawn". Start by setting all these > labels to "false". > - Now, for all entities in the map: > * If this entity's label "drawn" is true, skip. > * For all objects in the list, draw. > * Set "drawn" to true. > > That did the trick for me (and seemed to work for large objects, too), hope > this helps. Sounds a little bit like what I am trying now, except that there is no caching (yet) and instead of a flag, objects that have been drawn get removed from the draw queue. The main issue still is figuring out which object overlap which. I have a neat way of figuring out whether two objects overlap, but I can't tell reliably which one is in the front and which one is behind. The key difference is that I don't want to assume that all objects are somehow connected to each other, so I don't think I can work with a list of adjecent/colliding objects. Sounds like a good idea though :-). So right now I am in the middle of debugging, figuring out object order manually and trying to cast that into an algorithm. There's other stuff keeping me busy, though. So it'll take another couple days before something useable will come forth. I am over the point where I think it can be done with a simple formula, so I'll just write the code that works and see if it can be refined afterwards. That'll should get me further than the previous attempts to find the perfect elegant solution to a problem that might not have such a solution :-). Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel