Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: State machine pattern in game architecture

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default State machine pattern in game architecture

    Hello guys,
    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.

    Perhaps 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
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: State machine pattern in game architecture

    This thread has been cross posted here:

    http://www.java-forums.org/java-gaming/71378-state-machine-pattern-games.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting


  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: State machine pattern in game architecture

    Ok, I understand those arguments against cross posting, but the problem here is that this topic doesn't demand simple and definite answers, but instead some opinions. Anyway, I want to apologise for my misbehavior.

Similar Threads

  1. Architecture to be followed
    By Kumardev in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 15th, 2013, 02:12 AM
  2. Slot Machine game in Java. using Net Beans.
    By leo24 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 28th, 2012, 10:32 PM
  3. Regular Expression pattern - complex pattern syntax
    By SmartAndy in forum Algorithms & Recursion
    Replies: 3
    Last Post: June 7th, 2011, 04:40 AM
  4. a new pattern with a new architecture
    By mcgrow in forum Web Frameworks
    Replies: 0
    Last Post: August 4th, 2010, 02:28 PM
  5. Moving MySql Database from one machine to another machine
    By vaishali in forum JDBC & Databases
    Replies: 5
    Last Post: July 21st, 2010, 01:21 AM

Tags for this Thread