C++ Workshop - Project 2

Started by
94 comments, last by Warlord_Shaun 15 years, 11 months ago
Quote:
Or perhaps it shouldn't be a global...after all, maybe other entities will be able to move through rooms...perhaps such data could be stored with the entity...including the player?


Me likey. This generalizes well to wandering mobs. It also allows you to put mobs inside of objects, such as a genie in a bottle or some other creature hiding in a treasure chest. A container is a container afterall, and a room IS-A kind of container. =)

But should the container tell you which objects/characters are within it, or should the character tell you which room it's in...or both? [grin]
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Advertisement
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.

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.

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.

Good idea, bad idea or indifferent?
Quote:Original post by jwalsh
Quote:
Or perhaps it shouldn't be a global...after all, maybe other entities will be able to move through rooms...perhaps such data could be stored with the entity...including the player?


Me likey. This generalizes well to wandering mobs. It also allows you to put mobs inside of objects, such as a genie in a bottle or some other creature hiding in a treasure chest. A container is a container afterall, and a room IS-A kind of container. =)

Quote:
But should the container tell you which objects/characters are within it, or should the character tell you which room it's in...or both? [grin]

Perhaps both [grin] After all, it would be hardly fair for a room to not be able to notify those who exist within it that it needs to describe its self to the player! (Or to the monster, or the wandering feather...) Furthermore, one would hope that one could tell what room one was in! Less one find that one needs move to another room...and lo and behold! You're trapped in a bag of holding! Muahahahahahaaha!

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

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?)

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Do we get bonus points for parsing natural english instead of using the menu system?
Quote:Original post by Deyja
Do we get bonus points for parsing natural english instead of using the menu system?


If you are to go down that route then I would suggest you abstract the idea of input to allow for a menu system natural english parsing. The output of a system would always be a command but the input could be natural english or menu based input. This allows you to first create a system based on menu input, so you don't get side tracked with details, then after everything is in place you can go back and add in english parsing with out having to refactor.

It's always nice to have a fall back plan. Get it working quick and easy and then go back and add in the bells and whistles.
Quote:Original post by Deyja
Do we get bonus points for parsing natural english instead of using the menu system?


No. This will be done in project 3 or 4 anyways. =)
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
There's going to be a Project 4? O_O *dies*
Quote:If you are to go down that route...
It was a rhetorical question. I've done this before. :)
Quote:Original post by linkofazeroth
There's going to be a Project 4? O_O *dies*


LOL by project 4 JWalsh will have a server hosted and we'll be tinkering with our MUD's.

This topic is closed to new replies.

Advertisement