Quote:Original post by westond My head is swiming with ideas about how to impliment this. I can see using alot of class inheritance that would work well with this scenario.
But, like one of the posters above... Im wondering about how to keep track of the player in the world. My first thought is to create a cell object that is held in a two dimensional array and the player moving aobut by simple cell arithmatic ie... north (x,y+1) south (x,y-1) east (x+1,y) etc. There would be an array for the main world, then as the character say moved into a building, then that building would have an array of cells with which to move around in... each level to that building would be its own array of cells. Cells would hold objects and object containers as well as descripters that convey what the cell looks like to the player. The player would keep track of his direction and relay that to the cell so the cell would know how to describe itself. This adds the ability to redescribe the room based on which direction the player is facing and only have certain object or containers visable if the player was facing the right direction in the cell.
I have several problems with this type of implimentation...
1. it seem expensive in memory since every cell and array would have to be built at runtime and kept alive in memory.
|
The amount of memory used for this would be trivial.
Quote: 2. keeping reference to cells and objects in the cells seems to be complex since you run the risk of a pointer going out of scope easily and trying to determine what and how many pointers you will need at the upper scope so they are available to be assigned in later scopes.
|
Perhaps, although there are techniques that can be used to simplify this...
Quote: 3. a database seems to be the best route for storing and retrieving this much information.. so that its not all in memory.. but rather in a .dat file of some sort. That would be the way I would want to impliment it but I dont have the knowledge for that yet.
|
Everything is a database [grin]. The real question is, to what degree is it a database? You will need a database of some kind simply to store the various bits and pieces of information you're going to run through, including but not limited to: rooms, room connections, monsters, monster stats, players, player stats, treasure, treasure stats, quests, etc...
Quote:Good idea, bad idea or indifferent? |
Your idea of direction dependant data is a bad one IMO. Think about it this way: When you enter a room do you always stand facing one direction never looking side to side? No. You generally give it a good look around, this is where the description of the room comes in. The description is generally what you would see were you to enter the "room" and look around a bit. Now, having it describe the room differently depending on which direction you enter from is entirely possible (and presents some very fun possibilities...a maze of one room anyone?)