Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions about basic game architecture

 
Daniel Zuckermann
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello people,
I am trying to build a very simple and basic 2D game where the main focus lies on good architecture. I would like to implement it as a state machine with at least the following states:
- running
- paused
- stopped

However, more states could make sense, but I don't know which function calls or behaviors should be modeled as new states. Example: While the game is running, the user clicks on the settings panel to change some settings. Do I need a new state here or would the game just switch to the "paused" state? Would it be a better idea to disable the settings panel while the game is running?
Can every GUI view be seen as a new state or would that be overkill?

I am not sure if a concrete state should better be a subclass of an abstract state class or implement a state interface. It could also be interesting to save the game state persistently in a file so that the game can be resumed after rebooting the machine, but I don't know how complicated this is and if there is some kind of helper API out there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic