Database Design problem

A

Anonymous

Guest
I am developing a simple game. I have run into a delema of database design. I have a playing board of 500x500 spaces and 6 categories of items that could be spread around the board. Items on the board can be looked up by category and id, but what is the best way to store the contents of the board? The whole 50,000 line table of the contents is out, so what do you think?

:-o
 
Highlander65 said:
I am developing a simple game. I have run into a delema of database design. I have a playing board of 500x500 spaces and 6 categories of items that could be spread around the board. Items on the board can be looked up by category and id, but what is the best way to store the contents of the board? The whole 50,000 line table of the contents is out, so what do you think?

Coordinates seems like the obvious way to me. Each item has a pair of coordinates, row and column, that describe where it is on the board. Then it's easy to query to see if a particular square has an item on it, or near it, and easy to find out what square a particular item is on. Something like:

Code:
CREATE_TABLE items (
   id INT PRIMARY KEY,
   name VARCHAR,
   row INT(3),
   col INT(3)
);
 
Back
Top