Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm making a text-based "Arena" game where the player is the owner of 5 creatures that battle other teams for loot, experience and glory. The game is very simple, using Python and a curses emulator.

I have a static ASCII map of an "overworld" of sorts. My character, represented by a glyph, can move about this static map. There are locations all over the map that the character can visit, that break down into two types:

1) Towns, which are a series of menus that will allow the player to buy equipment for his team, hire new recruits or do other things.

2) Arenas, where the player's team will have a "battle" interface with actions he can perform, messages about the fight, etc. Maybe later, an ASCII representation of the fight but for now, just screens of information with action prompts.

My main problem is what kind of design or structure I should use to implement this?

Right now, the game goes through a master loop which waits for keyboard input and then moves the player about the screen. My current thinking is this:

1) Upon keyboard input, the Player coordinates are checked against a list of Location objects and if the Player coords match the Location coords then...

2) ???

I'm not sure if I should then call a seperate function to initiate a "menu" or "combat" mode. Or should I create some kind of new GameMode object that contains a method itself for drawing the screen, printing the necessary info? How do I pass my player's team data into this object?

My main concern is passing around the program flow into all these objects. Should I be calling straight functions for different parts of my game, and objects to represent "things" within my game?

I was reading about the MVC pattern and how this kind of problem might benefit - decouple the GUI from the game logic and user input but I have no idea how this applies to my game.

share|improve this question
Just use a state machine? – Tili Feb 22 '12 at 8:35

You make a base class called GameState, or GameLevel. Store it as a reference or pointer. When game need to go into a battle (as in final fantasy style), you put your gamelevel type into a stack, and put the battle screen as the current gamelevel.

When you finish the battle, switch the references again. Of course, each type of level (town, over-world, battle) are (is a) sub-classes of GameLevel.

Also, remember to pause the stored GameLevels if necessary. With this system you could implement easily a system with a lot of submenus and exit from each one by pressing the escape key.

share|improve this answer describes a way of implementing GameStates in order to accomplish such things, but it's for XNA. – Superbest Feb 23 '12 at 14:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.