Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   Advanced MUD Concepts (http://www.topmudsites.com/forums/forumdisplay.php?f=7)
-   -   Partitioning a coordinate system? (http://www.topmudsites.com/forums/showthread.php?t=123)

Burr 01-28-2005 06:10 PM

I'm trying to decide how best to implement a coordinate-based system.

1) First, for longterm referencing of position, is it better to partition space using (a) infinitely small points, or (b) finite, space-filling polyhedra (such as cubes, rhombic dodecahedra, or truncated octahedra)?

2) Second, should free objects in open space be allowed to move (a) in any direction and/or for any distance, or (b) only from center to center of a polyhedral point?

(Note that 1b and 2a are not mutually exclusive. One might allow an object to move with no respect to one's partioning of space, and then determine which partition the object is in for other purposes. Whether this is ever a reasonable approach, I'm not sure of.)

Rhuarc 01-30-2005 11:18 AM

Personally, I would stick with a standard 3d cartesian coordinate system - that means using infinitely small points, referenced with vectors (a 'point' in space being made up of an x,y & z coordinate)

There are plenty of 3d vector classes available that already do all (er, alof of, anyway) the math for you. (Let me know if you cant find one, and i'll send you my own (in c++))

If you only allow objects/actors to occupy the center of a space (whatever shape that space takes), then you'll have actors in the same room all occupying the same space, and you'll lose any benefit you would otherwise gain from using a 3d coordinate system in the first place.

Burr 01-30-2005 12:16 PM

Rooms, as the term is used in mu*s, would not be necessary either way. A given area of space may include more than one center, just as it may include more than one point in space. It would simply be a finite set of (potentially many) polyhedra rather than an infinite set of points.

Also, I think vector math should still work well as is. In fact, it is somewhat easier, since you are always working with multiples of the same simple numbers.

For example, imagine a mesh of truncated octahedrons, where the square faces correspond to up, down, north, east, south, and west, and say each polyhedron has a diameter of 1 unit from square face to square face. Then going to the next center over in a positive, direction perpendicular to a hexagonal face (i.e., in an east-north-up diagonal direction) would simply mean calculating of the original position + (3/4)*i + 2*j + 1*k. Two polyhedrons over would be the original position + 1.5*i + 4*j + 2*k. Moreover, one polyhedron due east would simply be the original position + 1*i. Etc.

*Edit: I had to fix my math a bit, but the point remains pretty much the same.


All times are GMT -4. The time now is 07:57 PM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022