3

I have been thinking about making a point'n'click adventure game. The problem I have been running into is representing the game logic and state in a generic(and not butt ugly) way.

Game State:
You took an item from a room, it's no longer supposed to be there(could be done easily) You talked to a character who went to do something that affects another room/screen, how to save in what state the room and character are

Game Logic:
You talk to a character, he does some animation and changes some stuff in the world state, how would you set this without hardcoding it into the game?

I guess the questions are related because figuring out how to represent the state will go a long way to figuring out how to define "actions."

Afiefh
  • 920
  • 1
  • 7
  • 15
  • 5
    Just so you know, if you were to ask this at http://gamedev.stackexchange.com, you might get responses that apply better to how to do this in a game. – cHao Dec 27 '10 at 11:23

2 Answers2

4

One of the prettier options would be to use a scripting language, like Lua. You hardcode into the game only the properties that a given room or item or character might have, how they might relate to each other (e. g. item is in the room), and all the real stuff will be done by a script. This has an advantage of easier debugging, if you do it right (you won't need to recompile your game, actually, done right, you won't even need to restart it), but disadvantage of adding some complexity.

Also you may want to consider using some of the already available game engines for point and click adventures, like AGS or Wintermute. If you want to make a game, you will want to avoid programming as much as possible to jump straight to game design. I know that may be hard to accept for a programmer :)

Septagram
  • 9,425
  • 13
  • 50
  • 81
3

Unless your game engine includes a scripting language of some sort, you'll have to hard-code something. Eliminating hard-coding tends to push the responsibility of defining actions to runtime, and the runtime environment will need some way to define those actions. If you don't have one already, look into an embeddable language like Lua or Python, or possibly even Javascript.

cHao
  • 84,970
  • 20
  • 145
  • 172