Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Posts
    62
    Rep Power
    0

    Default State machine pattern in games

    Hi forum,
    I want to implement a basic game by using the state machine pattern. It should contain at least the following states: running, paused and
    stopped.

    However, more states could make sense, but I don't know which behaviors should be modeled as single 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.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: State machine pattern in games


  3. #3
    Join Date
    Aug 2011
    Posts
    62
    Rep Power
    0

    Default Re: State machine pattern in games

    Sorry for that, but my intention was just to collect several opinions, because this topic is very vague.

Similar Threads

  1. State Design Pattern
    By blackbird in forum New To Java
    Replies: 3
    Last Post: 07-19-2011, 05:05 AM
  2. Replies: 2
    Last Post: 02-14-2011, 02:27 PM
  3. Replies: 6
    Last Post: 02-05-2010, 04:53 PM
  4. Replies: 0
    Last Post: 06-10-2008, 07:37 AM
  5. Concurrent Hierarchical State Machine 4.3
    By levent in forum Java Software
    Replies: 0
    Last Post: 08-03-2007, 04:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •