5
\$\begingroup\$

I'm developing a little simon-like game and I'd like to know what the best approach is when it comes down to game states.

What would be the best approach?

  • Creating different states/screens for 1-player and 2-player game sessions.
  • Creating just one state/screen with validation from a variable that holds the selection made by the player on the title screen.
\$\endgroup\$
  • \$\begingroup\$ Is the single player the same game but against the computer or does the actual game differ? \$\endgroup\$ – Bart van Heukelom Jul 28 '10 at 20:07
  • 1
    \$\begingroup\$ I viewed this question just to find out what a "one half player game" is. I'm still wondering. \$\endgroup\$ – AShelly Aug 6 '10 at 21:31
  • \$\begingroup\$ Well, it was intended to be 1 or 2. =) \$\endgroup\$ – reefaktor Aug 15 '10 at 13:12
4
\$\begingroup\$

You want your 1 player and 2 player game to be the same class with a 1/2 player toggle. Otherwise your code base is going to be unnecessarily forked.

\$\endgroup\$
  • \$\begingroup\$ He could inherit the same objects for both states, I guess. \$\endgroup\$ – zaratustra Jul 22 '10 at 18:47
  • \$\begingroup\$ @zarawesome if he did inherit both from a base class he might well find himself adding functionality in one subclass that he later needs in the other, leading to lots of refactoring. \$\endgroup\$ – Iain Jul 26 '10 at 21:28
5
\$\begingroup\$

Generally the game is only "multiplayer" when the game is in the actual gameplay mode--ie state 3. It is fairly common to just allow one player to "drive" in all other states. This is why you are often asked to "Press [button] to continue": to determine which controller/player is "driving". Then, when the main gameplay state is reached, the screen is split based on how many controller or players are actually connected.

\$\endgroup\$
  • 2
    \$\begingroup\$ In addition, this is one reason it's very common to have an intermediate "choose your profile" (or sometimes "choose your character") screen - so the game can figure out which controllers are "live" and which are merely connected but unused. \$\endgroup\$ – ZorbaTHut Jul 18 '10 at 15:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.