class design of a text based RPG

Started by
7 comments, last by lordcorm 17 years ago
hi, i want to create a text based rpg as a part learning exercise / demonstration of the standard template library, was just wondering if anyone could point me n the right direction of ideal class designs for something like this, dont usually design code before i implement but would really like to get this right the first time. thanks alot
http://stowelly.co.uk/
Advertisement
There is no 'right' solution, especially as you've not said what your requirements are. There are good solutions and bad solutions. The degree of 'goodness' depends on the metrics you're using to measure the solution: execution speed, development time, maintainabilty, etc. Generally, designing a system involes these steps:

1) Functional Design - what you want it to do
2) Technical Design - how it's going to do it
3) Implementation
4) Test & Debug

In reality, you'll loop through 2,3,4 several times as you come up with better ways to implement the required functionality or as item 1 changes. With experiance you'll decrease the number of times you loop through the development process avoiding the dead-end implementations before starting on them.

Implementing solutions and evaluating them is the only way to become a good programmer, skipping straight to 'right' solutions doesn't teach you about what to avoid in future.

Skizz
Moved to For Beginners.
ok ill try and list my requirements abit better, i understand i wont get it 100% right the first time i work on it, but there is a deadline to this project and i would like to be able to achive it without getting stuck in too many dead ends


basically

it needs to be a map with at least 10 locations, navigated by using a verb followed by a noun (possibly with functionality for longer strings).

need to be able to pick up and drop items from the locations and store the picked items in a bag ( so assuming i would need a class for a generic object then inherit from that).

also needs to have a number of npc enemies each with different properties of how to kill / be kill (assuming this also would inherit off a base object).

ive got a fair idea how this is going together, but was just looking for some opinions off of some people with alot of experience with the STL and rpg's

thanks
http://stowelly.co.uk/
I dont consider myself an expert on anything, but it sounds to me like the std::map object can become useful.
I used it once to implement a tree like environment for a text based RPG called Norris
It basically shows how the std::map and its find function can be used to solve your first requirement.

Maybe you have figured out this much already...
There are two general aproaches when developing software: "Do it right" and "Do it now". History has proven that they are incompatible with each other.

Since you have a deadline, you won't get it "right" the first time, better focus on getting it done.

The problem here is, that design has nothing to do with STL - STL is just implementation of common patterns that emerge. Just like you cannot design a game using streams - although you will use them.

For your purpose the only STL related things you'll need are containers.

For an RPG STL would allow you to create some elaborate entity representations, but that quickly falls beyond the scope of such project, unless such flexibility is required, and warranted (will your project benefit from it).
ah, thank you both some very usefull replies


pulpfist: ill be sure to look into stl map, sounds just what i need to be using

Antheus: yeh the project doesnt neccessarily need to be completely extensible, but a part of the assignment criteria is that i use alot of different aspects of the stl and have a decent rationale for picking the ones i have picked
http://stowelly.co.uk/
about 75 % of the time this " would really like to get this right the first time " is easier said than done. And the 25 % that you can do it perfect the first time you will need to change it to accomodate changes in your game. So there is no perfect in programming :-)
-durfy
Edit: Woops misunderstood the question lol

This topic is closed to new replies.

Advertisement