Hi,

Another question to the devs on this list:

What have you find to be the best way of representing the map and other game 
objects in software?
Two ways I can think of is to either have everything in an big 3d array, or to 
give each object attributes specifying 
the 3d position.

Advantages of giving each object an x y and z attribute:
* objects can have floating point positions
* uses less memory than the array method (not really an issue anymore)
* More than one object can be in the same position (think of doors or walking 
through walls in SOD)
* Possible for objects to be bigger than one unit e.a. having a start position 
as well as an end position

Disadvantages:
* Detecting collisions may be expensive as all the objects need to be searched 
to find an object at a specific position. 
Something like binary search may be useful, but then all the objects must be 
sorted every time an object moves.
* Increasing the number of objects in the game may decrease performance as the 
list of objects to be searched gets 
longer.

Advantages of the 3d array method:
* Very fast to reference an object at a specific position.
This makes path finding and collision detection very fast.
* One object may be placed in several array locations, e.g. having a lot of 
references/pointers in the array point to 
one 
wall object.
* If the array size stays constant, adding more objects will not have such a 
great effect on game performance.

Disadvantages:
* Not possible to have more than one object at the same position, unless each 
array location points to another list.
* Not possible for an object to be bigger than one unit.
* Not possible for objects to have floating point positions.

Something I've missed?

Another way might be to combine the two approaches, e.g. having all fixed 
objects like walls and floors be placed in a 
3d array, and the movable objects like the player and items use the other 
method.

What are your thoughts on this?

Take care,

Rynhardt


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gam...@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to