What data types are you storing in your array? I.E. HOw are you
showing that there
is a wall and not air per se in a particular area? I'm assuming here, that we're
talking about a full-scale map of the level.
At least the way I do it in g3D I have a header called surface.h which
has several defined surface types such as walls, doors, water,
ladders, ropes, vines, etc to reference different surfaces and objects
in the game world. There fore all I need to do is create a 3d array of
type int and fill it with these surface constants, and I can later
reference the array to find out what if anything is at any given point
on the map on demand. Since I have those surface constants it makes
referencing this stuff pretty easy.
I ask these because firstly, it sounds like you're simply treating the
world as a
very large array of described points in essence. (Which begins to
sound exactly like
a 3D coordinate system again) :) The exception being that you have
labels for each
point, which can really unnecessarily inflate the amount of data
needed to render
a map. Even just using a byte of data per coordinate, it inflates the
map eight times
larger than it needs to be rather than using a simpler collision-based model.
That's exactly the issue I encountered when creating levels of any
real size and complexity. That is one reason I was thinking of
shrinking the levels. The way I'm handling things really inflates the
amount of data to store the level in memory. It is something of a
CPU/memory hog when it really doesn't need to. For that reason I
really and truly believe i need to implement a true 3d coordinates
system with proper colision detection to improve the engine.
That said, using an array as a colision detection system is a bit
easier because as you say everything is labeled. For example, if I
want to know if there is a wall 3 units away I can look along that
vector three coordinate units and see exactly what is there just by
referencing the array. It is simple, but is rather waistful of memory
and CPU power in the process.
-And, incidentally, you'll still, in effect, need to use collision
since the map is full-scale. I.E. if your player is moving at 5
coordinates per second
in a direction but that move rate isn't always the same, you'll still
need to check
to see if the path of the player will come into contact with some feature of the
map. You'd need some form of collision detection for this. -Yes?…
Yes and no. Implementing a true colision detection system would
certainly be more appropriate, but I have managed without one. As I
said I managed to do it with a simpkle 3d array regardless of the
player's rate. Here is an an example of how I do it.
// Get the player's current direction, location, and speed
direction = player.IsDirection();
speed = player.IsSpeed();
x1 = player.IsX();
y1 = player.IsY();
z1 = player.IsZ();
// Calculate the player's new location
x2 = GetX(direction, x1, speed);
y2 = GetY(0, y1, speed);
z2 = GetZ(direction, z1, speed);
// Now return the surface at the specified coordinates
surface = world.IsSurface(x2, y2, z2);
Of course, I'm using internal functions from my G3D engine as my
example, but how it works is actually simple. The GetX(), GetY(), and
GetZ() functions simply takes the player's direction, speed, and
coordinates and looks along that vector however many units the player
would travel in a certain frame. The new coordinates or position is
then passed off to my world object which has an array holding the game
world and finds out what if anything is there at that coordinates. As
I said earlier it works fine except for the fact it definitely
inflates the amount of data that needs to be stored to get colision
detection and you can't have more than one object in any given
position at a time.
I like your idea though, using perhaps an array of 8 bit integers,
which could simply
represent a full-scale environment with amazing detail, in the sense
that one could
simply test for a point anywhere on the map and instantly know what
exactly was there.
I.E. A point could contain air, water, be solid or not with numerous materials.
That's the upside alright and why I chose that method when creating
G3D. I just found it easier on the programmer to keep track of things
and doesn't require being a math major to figure out. Although, my
grades in math were decent in school I still have troubles with
geometry and trig without someone to refresh me on how to do this or
that from time to time. In fact, i often have to ask friends in the
know to help with me with math calculations in my programming as my
own math skills are fair, but not great.In fact, the first time I took
trig I almost flunked it just because I couldn't wrap my brain around
sins, cosins, tangents, etc. Although, I think as I get older I'm
becoming a little better at it because game programming has given me a
reason to work harder at higher math, and in high school trig seamed
rather pointless, and i believed it was something i'd never need to
know or use. When the college exams came around though I started to
realise I needed to know this stuff to advance in the computer field,
and it actually had some real life application. Still, if i can find
an easier way to do things I'll avoid doing much math each and every
I think it's really interesting though, as I've said, as it really
sounds like your
and other's full-scale approach is really beginning to blend with a raw 3D coord
system anyway. :) I love the idea of symbolic representation of
'reality' and vice
versa!… woohoo! :)
Amen to that. One reason I like programming games is just rying to
figure out what I can do with symbolic representation of reality.
Trying to figure out how this or that word work and applying math and
stuff to get an idea of how the real works in a computer simulation.
Really cool stuff!
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
All messages are archived and can be searched and read at
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.