29 votes
Accepted

The Mysts of Altair - text-based adventure game

There's a lot to comment on here, so I'll try to cover everything while being brief. Encapsulation ...
  • 18.3k
28 votes
Accepted

Amateur RPG Fun

Your code is very big but this is not the real issue. The real issue is that your code is not made out of little reusable/understandable/testable/maintainable components (functions, classes, modules, ...
  • 28.7k
22 votes

A small GOTO text adventure game

The goto debate is ancient, from the year 1966 when Edgar Dijkstra came up with a famous paper called "Go To Statement Considered Harmful". This was ...
  • 4,435
21 votes
Accepted

Zork-like text adventure w/ Python

An interesting beginning to your game. I'd be interested to seeing how it turns out. Text adventure games are usually data-driven. This means you would have a game engine (program) that would read ...
  • 32.1k
21 votes

A small GOTO text adventure game

The code you've written is more or less a state machine, written the way that one might be constructed in assembly language. A technique like that technically works, but it doesn't scale well and you ...
  • 789
17 votes
Accepted

How to Train Your Dragon

This is smelly: class Dragon { Race race = Race.DRAGON; You see, why does a Dragon need an enum field to re-state that it is a "Dragon". This is error-prone:...
  • 110k
15 votes

The Mysts of Altair - text-based adventure game

Your code is all code. So you are writting specific code for each situation. A better style is called "Data Driven" coding. This is where you use generic code that can be used for all situations. But ...
  • 91.9k
14 votes
Accepted

Cactus Reborn - A game engine for text-based adventure games

Is it appropriate to require the user to specify argument names with *? Yes! I think this is excellent practice, and in my opinion a far underused feature of Python 3. It greatly enhances the ...
  • 8,475
13 votes

Text Adventure Game in Python

Bugs In CountCoins: print ... has no effect. The same applies to other parts of your code where you used this. If you meant ...
  • 4,490
12 votes

RPG game shop system

You can divide main() into lots of smaller functions and use appropriate enums to deal with choices. I have used ...
  • 3,484
12 votes

How to Train Your Dragon

StringBuilder vs plain String concatenation I'm wondering if it would make more sense to make Stringbuilder and use append ...
  • 19.1k
11 votes
Accepted

Amateur RPG fun - follow-up

Basic style/layout stuff: Python has a style guide - e.g. Shop_Keeper should be ShopKeeper, ...
  • 13.8k
11 votes
Accepted

Story-based adventure with functions and relationships

Style Before diving in the actual code, some general style considerations first. Python comes with an official Style Guide. The most relevant parts for your code would be the sections on how to ...
  • 7,184
11 votes

One of my first Python projects - an adventure game

Too much code duplication. Consider: ...
  • 32.1k
10 votes
Accepted

Simple adventure game

Prompt A few mistakes made while prompting the user for an action: You use an intermediate variable but don't make anything out of it before returning it; Your ...
10 votes

Adventure Game (text based) in C++

typedef struct weapons { int dagger = 2, sword = 3, axe = 4, mace = 5, bow = 3, arrows = 2; } weapons; The ...
  • 19.1k
9 votes
Accepted

Zork-style text-based game engine Python3

There's a very serious architectural problem with your code. There's essentially no separation of concerns. The logic of the game is intertwined with user interactions and the game configuration. It ...
  • 5,570
9 votes

A small GOTO text adventure game

Lack of Error Checking on User Input The function getdir() should check for valid input, perhaps is should receive an array of valid directions. When an invalid ...
  • 19.5k
9 votes

A small GOTO text adventure game

I'm looking at the goto usage in this program, and I'm going to be controversal here and say it's not that bad. I've seen much worse. Here is a list of things this ...
  • 196
8 votes

Top-down movement

The first thing I noticed is that you're lacking separation of concerns. Why does you Player class implement KeyListener? It ...
8 votes

Making user menus in a text-based game

Python allows for object oriented programming. Using this would simplify your program immensely. So let's walk through remaking this. Let's think about what your game consists of. You have locations, ...
8 votes

How to Train Your Dragon

For the Main.battle() you could refactor a lot: Magic numbers for the mana check conditions, recovery and costs in Main.battle()...
8 votes

The Mysts of Altair - text-based adventure game

There many things here that can be improved. First off, let's tackle some best practices. Generally, doing stuff like this with system isn't very good: ...
8 votes

Story-based adventure with functions and relationships

I'm on my phone, so it's hard to really see this code as a whole and really take the full context of everything. I'm just going to flip through and mention things as I notice them. At the top, you ...
8 votes

A small GOTO text adventure game

Quuxplusone's answer briefly mentioned making this data-driven, and I've fleshed out the idea here. The key realization is that each room varies based only on a few pieces of information: a numeric ...
  • 181
8 votes

One of my first Python projects - an adventure game

Since you don't wait between prints, you can join some of them. Use triple quotes to extend a string on multiple lines (can be used for comments too) and \n to make a line break. ...
7 votes

Tiny text adventure

For inputs, instead of saying ['y','Y','Yes','YES','yes'] etc, you could just do if ch2.lower() in ['y','yes']: The ...
  • 143
7 votes

Run loop for a text-based adventure game

Avoid wildcard imports. Import from rooms just what you need, named explicitly. while 1 is an unnatural way of writing ...
  • 110k
7 votes

Text-based adventure survival horror game

I see you've ignored the advice from your previous question. To avoid duplication, I'm going to quote them: From this answer: Goto At a first approximation, never use ...
7 votes

Text Adventure Game in Python

preface - OOP background please note that i'm from an OOP background and my answers will necessarily reflect that bias. i have no experience with python or any functional languages, so please keep in ...
  • 1,011

Only top scored, non community-wiki answers of a minimum length are eligible