Game Map
Posted: Mon Oct 08, 2007 12:35 pm
Hey,
I'm currently creating a game, which needs a map. Basically, every time a user registers, I want him to get a village located at a random location X,Y, where no other villages are currently placed. I'm foreseeing a few problems though:
1. Structurewise I was planning to let each new user be inserted into a table along with the village name and location. My problem is how to make sure that each new user doesn't get his village placed on top of another village; that is, make sure that no new user is assigned the same X,Y as another user?
2. How would I most effectively try and give new users a location "near" other users (and not 10000 fields away), but still not right next to?
3. I was planning to echo the map as a 5x5 table. How would that most effectively be extracted from the tablestructure mentioned above?
Thanks for the help,
Mathias
I'm currently creating a game, which needs a map. Basically, every time a user registers, I want him to get a village located at a random location X,Y, where no other villages are currently placed. I'm foreseeing a few problems though:
1. Structurewise I was planning to let each new user be inserted into a table along with the village name and location. My problem is how to make sure that each new user doesn't get his village placed on top of another village; that is, make sure that no new user is assigned the same X,Y as another user?
2. How would I most effectively try and give new users a location "near" other users (and not 10000 fields away), but still not right next to?
3. I was planning to echo the map as a 5x5 table. How would that most effectively be extracted from the tablestructure mentioned above?
Thanks for the help,
Mathias