This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Game Development and the fly likes Questions about basic game architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Game Development
Bookmark "Questions about basic game architecture" Watch "Questions about basic game architecture" New topic

Questions about basic game architecture

Daniel Zuckermann
Ranch Hand

Joined: May 14, 2012
Posts: 50
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.
I agree. Here's the link:
subject: Questions about basic game architecture
jQuery in Action, 3rd edition