Best navigation method for RPG?

http://i.imgur.com/s9qh0.png

^I'm creating an RPG Text Adventure using C++, I planned on creating a void function for each individual room, what would be the most logical method of navigation to each room?
I would recommend that you do not write a function for each room.

I went over details relating to this not long ago. See my post here:

http://cplusplus.com/forum/beginner/71141/#msg379639
closed account (zb0S216C)
The problem with creating a function for each room is that it dramatically reduces the maintainability of the code. Each minor change would require a recompilation of the entire project.

I recommend placing room data into a file. When the program loads, load the data from the file into an array or container of some sort. That way, you only need to change the file.

Wazzak
Last edited on
This would be a good time to get into OOP, in my opinion. Never made a text based game, but that's how I would do it.
@Framework, I've yet to learn anything involving array's and applying them to basic programs. Or working with multiple files.
@^
If you're saying you've never learned about arrays, then this is going to be a pain for you. If you're saying you've never seen the practical application of arrays, then I can say personally that they save you probably somewhere around the number of variables you have times two or three to a thousand lines of code, possibly more. I would suggest trying a different game or learning as much about arrays as you can.

Also, for multiple files, you can create a file object array (practical use of arrays, but you can't use that method if you don't understand arrays), or you could use a pointer for variable file names. But I don't think that many files would be any help. I think that it would be more useful to have all your text and stuff for room data in one file. Of course that would still require an array to be any use.
Topic archived. No new replies allowed.