   My First Text Rpg (need help)
  Okay, as you can see from the title, this is my first text rpg. Don't laugh, when I started out I went pong->tetris->pac-man->3d stuff. This is because, well, I have never played a text rpg before now. Now that I have, I love the concept because you can make a very large game without the hassle of doing all the art. So now I need help.You see, most of my programming experience is in Cplusplus.But lately I've gotten interested in Python because of its ease of use and development speed. Several people have told me that it is very good for text rpgs. Is this true? If so, how would I go about doing it? I'm still learning the basics of the language, so any examples would help alot.[Edited by - FullThrottle on June 7, 2006 2:32:08 PM]
  For something like a text RPG, the language really isn't going to matter. Any language would work. Learning Python would be a good idea, however, as it will improve your knowledge of programming in general. I suggest you get Python and try out a few simple tasks to see if you like the language. If you do, then continue learning it and use it to make your text RPG.Good luck!   ;  Python is much better/easier at string processing, which is most of what a text game is.  So yes, Python is a great language to look into.   ;  For a text based game, you really only need a few language constructs. You need a way to input/output text, a way to branch (if/else), and a way to loop (while/for). Pretty much any language is perfectly capable of this. I recommend using Python for the sake of learning a new language. It really won't matter for this project, but knowing several languages is very useful later on.   ;  Thanks everybody! FYI, I had already downloaded Python 2.4 and PyGame a while ago, and am learning at a slow-average pace (for some reason not as fast as I did Cplusplus...Wierd huh?) @Sr_Guapo-> I can do all those thing with Cplusplus, but in Python I can't find how to do user input. Should I just use Cplusplus for the rpg or keep working on Python to use it for its ease of use?P.S.- Ratings up for you guys for helping me!   ;Quote:Original post by FullThrottlein Python I can't find how to do user input.The Python function for getting user input is raw_input().  Here is an example:s = raw_input("Please enter a string:")The string you pass to raw_input is the prompt to be displayed when asking the user for input.  After calling this function, s would contain whatever string the user entered.   ;  Cool, thanks. So at the beginning of the game it would ask the name, and it would look like n=raw_input("What is your name brave warrior: "). But how would you do things like purchasing spells, travelling or combat? I would be very grateful for examples on how to set up these options.   ;Quote:Original post by FullThrottleCool, thanks. So at the beginning of the game it would ask the name, and it would look like n=raw_input("What is your name brave warrior: "). But how would you do things like purchasing spells, travelling or combat? I would be very grateful for examples on how to set up these options.For travelling, you might want to set up a data structure (of some sort; I'm not too well versed in the minutiae of Python lists and dictioaries, check the docs for more info) containing the name of each location, the rooms of that location, monsters, etc.  At the appropriate times, ask the player which direction they want to move, and update their map position accordingly.For shops, you could output a list of available items, have the user type in the item they want, make sure they have available funds, and if so, put the item in their inventory (a Player class would be useful in organizing such information).As for combat, encounters could occur on a random basis each time the player moves on a map.  From there, you could ask the player which action they wanted to perform (like attack, item, run, etc.) and then perform the necessary data modification (subtract/add to health, remove an inventory item, etc.).  Of course, there are multiple ways to implement any feature; these are just some suggestions.Some Python code you will find useful: print"" is used whenever you need to display text (it's a keyword and not a function, so you just enter a string without parenthesis).  The random module (import random) can generate random numbers, classes are very similar to those in C++ (no private or public members, and the class constructor is called __init__), and lists and dictionaries are Python's versions of arrays.  Anytime you need help while working in the Python interpreter, just type help("function or module name") to recieve tons of built-in documentation.  The Python docs included with the SDK will also be a big asset.Best of luck to you!   ;  One thing that is really nice (that PW touched on above) is that the Dictionary type is built into Python.  All of your rooms/spells/etc can be accessed by name in a very simple and logical manner ( Spells["Fire"], Rooms["Dungeon"] or something like that... been a while since I've Pythoned ).Sure, C++ has the map<> type, but it's not nearly as clean and flexible.   ;  Thank you so much guys for all the help. I have one more question that's about combat. I was to hoping to do random.choice(["hit","miss"]) to see if an attack/spell hits, then do random.sample(xrange(10),10) for a weapon like a dagger to calculate how much damage is given. But how would I set it up to make the random number when it chooses hit?   