I'm creating a text-based rpg and I'm having some trouble... What I would like to do is implement a room type that would store description and among other things, have a navigation system (I.E. GO NORTH). Since I'm using c++, I've gone ahead and created a rooms class.. but that's roughly all I've done. If anyone here could lend me their expertise in such matters, I would greatly appreciate it.
Sorry if my post seems a bit unclear.

Indeed, it is unclear... Also, you are asking for brain storm here... I am not sure if this would be the right forum for you even though it is going to be C++. What I mean is that this forum is for answering question about C++, but not about designing a program. Maybe a game forum would be more appropriate. In other words, you are still under 'requirement' and 'design document' steps. This forum would be more appropriate when you get to 'implementation'.

Make a class for a "player" and a "game" to go along with "room" (obviously you need many other classes but this gives a foundation). Have "game" instantiate an array of rooms and a player object.

Try to go a bit further and come up with some code and we can definitely help you with that.

>>I'm creating a text-based rpg
Text based rpg's are quite hard to design initially. If you're starting off with classes & OOP concepts I suggest you design a check-board game such as chess or checkers. When you feel comfortable with the array/matrix & the complexity, then I'd suggest you look into RPGs. OpenGL just might come in handy here. Just a suggestion. :)

things like 'game', 'player', 'room', etc don't sound particularly abstract to me :-)

Usually when I think about concepts, the initial question is "what does the program do - i.e. rather than considering the program as a bunch of uninteresting static objects, think about the interactions between them, especially in relation to the inputs/outputs of the program; this usually leads to being able to describe the parts of the program which will be more difficult to model - bits relating to its dynamic behaviour.

Assuming that a text-based game is going to be primarily text descriptions of objects, i'd guess that the most fundamental abstract concept which exists is that the all entities in your game world must be describable with a textual description; and there Describable could be your first 'concept'

After that, you may decide that some things in your game are also Attackable.. others are Usable. some things may be Destroyable (perhaps all destroyable items are also attackable, but not all attackable items are destroyable?).

Some entities may also have a particular 'state' which can change (like a door could be open/closed, a monster may be dead/alive, a destroyable entity may change from being "existing" to "nonexisting" after its destroyed..) - if its possible for an entity to have its state changed, then that might subscribe to a 'changable' concept.

When thinking about these concepts, they might end up in a loose heirarchy; otherwise they could simply serve as the "base" for your concrete entities - either way they should give rise to the kind of interfaces you probably want to think about

[i]Describable[/i]
    /|\
     |
 [i]Changable[/i] <----.
    /|\          \
     |            \
[i]Attackable[/i]      [i]Usable[/i]
    /|\
     |
[i]Destroyable[/i]

Drawing things out on paper is a good idea in any case - write yourself a clear specification of what-does-it-do; then the concepts may start to jump out

Edited 6 Years Ago by Bench: n/a

Bench, you hit the nail on the head. The problem I have when creating programs is that while I may know a great way to accomplish a particular task, I more often then not have trouble implementing it within the context of my program. Example: I know that an array could be a good way of (say) storing the player's inventory, but I just can't seem to visualize a good way to implement it. Oh well, I suppose I'll just have to plow through it. Thanks again for helping out guys, some of your posts cleared things up a bit. Btw, I'm not a complete n00b at c++, I'm familiar with classes and OOP but again, I just can't seem to make that leap from abstraction to reality. I apologize for the long post.

This article has been dead for over six months. Start a new discussion instead.