Text Based RPG in Python, Framework Only
Post #1
CecilSunkure
Oct 21 2010, 11:07 pm
|
So here I have it. An unfinished text based RPG for Windows written in Python!!
![]() Here is a link to download the .exe. Keep in mind that you need all the other files in the directory to run MiniRPG.exe. Well, go ahead and try it out! It runs within DOS, well cmd.exe actually. At the moment, I have an easy to use framework for adding in additional enemies, weapons, items, maps, and characters. So really, all this is missing is some code for special boss fights, some code for special environment changes (like hitting a switch to open a large hallway), and the content! Content includes levels, dialog, storyline, etc. How to Play (hit enter after each key)w - Move up a - Move Left s - Move down d - Move Right e - Action button. Use this while standing next to something. i - Inventory. Read all the text in the inventory, or you may miss an important operation (like how to discard an item, or equip an item). Character key: O - This is your character. / - This is a wall. Your character cannot move over it {"} - This is a treasure chest. {_} - This is an unopened treasure chest. [/] - This is a door. S - This is the store. & - This is CecilSunkure!! Source code ~ 850 lines (open with --> notepad in order to view) This post was edited 8 times, last edit by CecilSunkure: Oct 24 2010, 4:15 am. |
Post #2
CecilSunkure
Oct 21 2010, 11:45 pm
Post #4
CecilSunkure
Oct 21 2010, 11:57 pm
|
How to Code Items
Also, I would like to have more weapons! If you want to submit a weapon, here is the format: Weapon FormatITEM_NAME = item('ITEM_NAME_STRING', [x, y], 'ITEM_SIZE', PRICE) ITEM_NAME - This is just the identifier I use in my code for your item. This does not have to be the same as ITEM_NAME_STRING. ITEM_NAME_STRING is the string that will actually show up in game for the name of your item. x and y are damage parameters. You can have 0 damage, up to I believe 255. ITEM_SIZE must be one of the following: Small; Medium; or Large. This affects your chance of hitting or missing in a battle. PRICE is the price of the item if it were to be bought or sold. Example Weapon CodeDAGGER = item('Small Dagger', [1, 4], 'Small', 5) This dagger would deal anywhere fomr 1-4 damage, and is a small weapon meaning it will not miss often. It costs only 5 gold. On top of this, I also need ideas for other 1 use items! Potions have the following item format: PotionPOTION = item('Potion', [0, 0], '1 use', 5) If you want to design other types of '1 use' items, please do so and post your ideas here! This post was edited 1 time, last edit by CecilSunkure: Oct 22 2010, 12:02 am. |
Post #5
HCM™Aristocrat
Oct 22 2010, 12:11 am
|
✁ - - - - - - - - -
|
Hm, the code you have doesn't look very extensible, unfortunately. If you want to expand this beyond what it is capable of right now, there will be substantial switching costs when you need to recode the way rooms and items are implemented. If it's just a small project that you won't revisit much, I'll be glad to help contribute some ideas.
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Post #6
CecilSunkure
Oct 22 2010, 12:18 am
|
With the way rooms are coded, changing rooms by adding in additional integer definitions is really easy.
The way items are implemented uses classes, so, that's not going to be hard to change either. In order to allow for switches to reveal addition portions of the map, you just use two sets of integers for each type of character that can be displayed on the map. One set won't show when the switch is off, the other will when the switch is on. I'd also need a specific integer for a wall that converts to an empty space. Though, I actually really want more rooms and items, mainly rooms. |
Post #8
HCM™ImagoDeo
Oct 22 2010, 5:38 pm
|
[************] Don't feed the mage.
|
MapsMAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 0, 0, 0, 0, 0, 6, 1, 3], [1, 0, 1, 1, 1, 1, 1, 1, 3], [1, 0, 1, 0, 0, 0, 0, 1, 3], [1, 0, 1, 0, 1, 1, 0, 1, 3], [1, 0, 1, 0, 7, 1, 0, 1, 3], [1, 0, 1, 1, 1, 1, 0, 1, 3], [1, 0, 0, 0, 0, 0, 0, 1, 3], [1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 3], [1, 6, 1, 1, 0, 0, 0, 1, 6, 1, 1, 3], [1, 0, 1, 1, 0, 7, 0, 1, 0, 0, 1, 3], [1, 0, 0, 0, 0, 0, 0, 1, 0, 7, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 6, 0, 0, 1, 0, 0, 0, 1, 0, 0, 7, 1, 3], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 3], [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 3], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 3], [1, 0, 0, 0, 0, 0, 7, 0, 1, 0, 0, 0, 1, 3], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 3], [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 3], [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 3], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3], [1, 7, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 0, 0, 0, 0, 0, 1, 7, 1, 5, 1, 6, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 6, 1, 7, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] ] How's that? ![]() ![]() ![]() ![]() ![]() ![]() "We live, as we dream - alone..."
-Marlow, Heart of Darkness |
Post #9
CecilSunkure
Oct 22 2010, 5:41 pm
|
I'll be paying 20 minerals per three quality maps!
Maps should have max dimensions of 75x25 (width x height). I will not pay for a group of maps if I do not like one of them, and I will only pay for groups of three! Edit: Those look great Imago, thanks. This post was edited 6 times, last edit by CecilSunkure: Oct 22 2010, 6:03 pm. |
Post #10
HCM™ImagoDeo
Oct 22 2010, 6:01 pm
|
[************] Don't feed the mage.
|
Template Code
I figured it'd be easier for people to pick a size to start with and fill it in. These templates have walls on all four sides and are totally blank inside. More to come. This post was edited 2 times, last edit by ImagoDeo: Oct 22 2010, 7:10 pm. ![]() ![]() ![]() ![]() ![]() ![]() "We live, as we dream - alone..."
-Marlow, Heart of Darkness |
Post #12
CecilSunkure
Oct 22 2010, 6:55 pm
|
Here are some more maps I made:
MapsMAP = [ [1, 1, 1, 1, 3], [1, 6, 0, 1, 3], [1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 3], [1, 1, 0, 1, 0, 0, 0, 1, 1, 6, 1, 3], [0, 1, 7, 1, 0, 0, 0, 1, 0, 0, 1, 3], [0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 3], [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 3], [0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 7, 1, 3], [0, 0, 0, 1, 6, 1, 0, 0, 1, 1, 1, 1, 1, 3], [0, 0, 1, 1, 0, 1, 1, 1, 3], [0, 0, 1, 0, 0, 0, 0, 1, 3], [0, 0, 1, 0, 0, 0, 6, 1, 3], [0, 0, 1, 1, 1, 1, 1, 1, 3] ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 3], [1, 0, 6, 1, 0, 0, 0, 1, 0, 1, 3], [1, 0, 1, 0, 0, 0, 1, 7, 0, 1, 3], [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 3], [1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 3], [1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 3], [1, 0, 1, 0, 0, 0, 0, 1, 7, 1, 3], [1, 7, 1, 6, 0, 0, 0, 0, 1, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 6, 0, 0, 0, 0, 0, 0, 6, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 7, 0, 0, 0, 0, 6, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 3], ] MAP = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 6, 0, 1, 0, 0, 0, 1, 0, 0, 7, 1, 3], [1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 3], [1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 3], [1, 0, 0, 1, 7, 0, 0, 1, 0, 0, 0, 0, 1, 3], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 3], [1, 0, 0, 0, 0, 1, 0, 0, 0, 7, 1, 0, 1, 3], [1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 3], [1, 0, 0, 0, 0, 1, 0, 1, 7, 0, 0, 0, 1, 3], [1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 3], [1, 0, 7, 1, 6, 0, 0, 1, 6, 0, 0, 0, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] ] |
Post #13
CecilSunkure
Oct 22 2010, 7:04 pm
Post #14
Apos
Oct 22 2010, 9:46 pm
|
Today is the tomorrow you worried about yesterday.
|
Are you going to make the game bigger? Make it become graphical? Make a multiplayer mode? Could it turn out to be the new most played open source game?
Edit: (May as well contributed) MAP1 = [ [1, 1, 1, 1, 1, 1, 1, 1, 1, 3], [1, 0, 0, 0,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 0, 1, 3], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 3], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] ] Edit2: This post was edited 2 times, last edit by Apos: Oct 22 2010, 10:17 pm. ![]() ![]() ![]() ![]() ![]() ![]() How to Ask Questions the Smart Way --- This is my website
![]() ![]() "A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away." - Antoine de Saint-Exupéry Ever wondered how to pronounce my usernames? Wonder no more! |
Post #15
CecilSunkure
Oct 22 2010, 9:49 pm
|
No, I've stopped using python and switched over to C/C++.
I'm finishing this up in single player for the heck of it, while running through a coding book on C. I've switched to C because I'll be attending DigiPen next year (not this year due to personal reasons), and since games are almost only coded in C, and since DigiPen teaches in C/C++, it's best I stick with it. If I get good enough in time, I'll code a game in DOS before I attend DigiPen ^_^ |
Post #16
FoxWolf1
Oct 22 2010, 10:22 pm
|
Have you played DoomRL? It's pretty entertaining, so it might be something to check out as an example if you're interested in making text-based games.
Also, if you want to see an example of the genre with graphics added on, but keeping the distinctive "feel" of these games, Omega would be worth a look. ![]() ![]() ![]() ![]() ![]() ![]() |
Post #18
CecilSunkure
Oct 23 2010, 4:32 am
0 members in this topic (italic members are currently writing a reply): None
+ guest(s)
+ guest(s)
[03:29 am]
[03:23 am]
[03:23 am]







99999 dmg D:.



![[close]](/images/up.gif)