Re: Modeling events that occur in a game world
- From: Jordan Marr <jnmarr@xxxxxxxxxxx>
- Date: 27 Apr 2007 12:00:45 -0700
Try these queries with your RDBMS. Create a simple 2D world using
points and lines, let there be areas. One area could be a poison pond,
just a simple polygon like (1,1), (1,7), (7,7), (7,1) will do.
Now answer queries like:-
-1. "Have you fallen into the poison pond"?
is point (0,0) within the pond, is (3,3) within it?
-2. "There are two polygons do they intersect"? (collision)
-3. Create a road with corners; "how far is it from
point A to point B if you travel only via the road"?
Without a spatial join things are a tad awkward.
This reminds me of a project I worked on recently involving a LPS
(local positioning system). The system consisted of sensors that were
placed inside a building, and tags worn by people or objects that
enabled them to be tracked by the software. We were creating guidance
software for blind people. Part of this involved mapping out the
building with things like walls, and other objects that people needed
to be routed around.
My plan was to use AutoCAD to either create maps visually, or import
existing blueprint layouts. Then the software could simply delegate
all spatial needs to AutoCAD. To go along with Topmind, AutoCAD is
simply an in-memory database of geometry (and it's good at what it
does).
But my boss wanted to manually create maps by walking around and
recording bounding box coordinates for each wall and object in a room,
and then save that array of coordinates to SQL Server... modeled as:
Object (1 to *) Coordinates.
And he didn't just save the bounding box coordinates, he saved every
single coordinate within that bounding box rounded to the nearest inch
within the coordinates table for each object. So that meant that the
process for adding a new object was this:
1) using LPS hardware, manually write down the array of XYZ bounding
box coordinates
2) enter coordinates into a script to create a list of all points
inside box
3) create an object entry in object table
4) create 1 zillion related coordinates entries for that object
Very "awkward", as you said.
He then created a webservice to bounce current position against the
coordinates table to return an object.
If we had used my method, adding a new object would have been as
simple as drawing it in AutoCAD. The software would have determined
spatial information by bouncing your current location against the CAD
layout and returning the names of nearby objects.
Jordan
.
- Follow-Ups:
- Re: Modeling events that occur in a game world
- From: Alvin Ryder
- Re: Modeling events that occur in a game world
- References:
- Modeling events that occur in a game world
- From: Aaron J. M.
- Re: Modeling events that occur in a game world
- From: topmind
- Re: Modeling events that occur in a game world
- From: Alvin Ryder
- Modeling events that occur in a game world
- Prev by Date: Re: Modeling events that occur in a game world
- Next by Date: Re: Modeling events that occur in a game world
- Previous by thread: Re: Modeling events that occur in a game world
- Next by thread: Re: Modeling events that occur in a game world
- Index(es):