Sign in to follow this  
Stowelly

class design of a text based RPG

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this