adonthell-devel
[Top][All Lists]
Advanced

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

Re: [Adonthell-devel] Map object thoughts


From: Andrew Phillips
Subject: Re: [Adonthell-devel] Map object thoughts
Date: Thu, 14 Jun 2007 08:44:17 -0500

I'm gratified to know that I'm not the only one whose code segfaults. The topic of map objects interests me, but I'm not sure I know what 'lazy copying' is.

As an example for 3-D, irregular bounding boxen: would a tree whose lowest branches are ten feet off the ground need a bounding box that only describes the trunk?

Andrew

On 6/13/07, Kai Sterker <address@hidden> wrote:
1. Bounding Boxes:
==============

Right now, the x and y extension of an object's bounding box is
specified in multiples of the grid size (40px). That will not work
well for thin objects (like people, columns, trees, walls, etc.) and
for larger objects whose size isn't a multiple of the grid size. (for
example I've got a ground tile that is 60x60).

The first thing that should happen (possibly after an initial demo
release) is to change the bounding box to all pixel size. That should
improve the collision detection that currently isn't very
sophisticated.

I'd also like to be able to change the shape of the bounding box. At
the very least, it would be nice if the (top) corners could have
different heights, enabling us to create sloped objects. If anyone
really dares, we might implement real 3-dimensional bounding boxes to
cover for irregular-shaped objects.


2. Map Object State:
===============

Each map object model has a pixel offset, so that it does not need to
be aligned with the grid. The offset you specify there is then used by
all objects using that model. So for my 60x60 ground tile, I would
have to use 4 different models (with offsets 0:0, 0:20, 20:0 and
20:20) to create a seamless ground.

It is possible to specify a separate offset when actually placing
objects on the map, but right now the collision detection code does
not support this (I tried and it caused a segfault). Maybe this issue
can be resolved together with the changes to bounding boxes. But there
might be a different approach that also takes into account another
issue:

There is only one instance of each map object, even if it is used
multiple times on the map. That's great for efficiency but not so
great for objects like doors or chests and the like. If you change the
state of one such object, all other objects would change too. In the
same way, if you change the offset of one object, all others' offset
is changeit as well.

What we would need is a way to change the attributes of a map object
without affecting other objects that initially share the same
instance. A technique like lazy copying comes to mind here. We also
need to make sure that the state can be saved and restored correctly
for each object. A reference to the original object model will not be
enough.

Kai

reply via email to

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