XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

4 Player games (best practice for controller assignment?)

Last post 04/07/2009 16:46 by x68ST0X20. 4 replies.
  • 04/07/2009 12:59

    4 Player games (best practice for controller assignment?)

    Hi -

    I am implementing support for 3-player and 4-player gameplay.
    I have player 1 assigned to the gamepad that hits A or Start on the title screen, as per the best practices article.

    There's 2 things I'm not sure on:

    1. For players 2, 3 and 4, I need to track if their PlayerIndex has not been determined. I tried to do this by starting the game with their PlayerIndex's set to null - but this is not allowed. I think what I will have to do is add a boolean to my Player class which is false at the start of a game and changed to true when a controller that has player input has been identified.
    Does this sound like a reasonable idea?

    2. For a 3 or 4 player game, players apart from player 1 need to know which player on screen is them.  I think most games handle this via a "load out" or character select screen. My game is simple and will jump straight into gameplay. So I have a problem of dropping 4 players into a new game. My intended solution to this is to wait for input on a controller, then assign that controller to a player and simultaneously highlight the player on screen and rumble their gamepad. Is this a decent approach?
    One problem I foresee is that all players will be starting input within the space of a few seconds, so all players will be highlighted and all controllers rumbled at the same time. To counter this I may need to ensure these controller alerts only occur one-at-a-time
    Dead Meat- Out now on XBLIG!
  • 04/07/2009 16:07 In reply to

    Re: 4 Player games (best practice for controller assignment?)

    1. Sounds good enough.

    2. You can simply display a little arrow above the player's avatar with the text "Player X", where X is equal to their player index. You won't need to do any fancy wait-for-input tricks.
  • 04/07/2009 16:12 In reply to

    Re: 4 Player games (best practice for controller assignment?)

    Other options are to put a colored glow around the Player number (or avatar picture) and a corresponding colored glow around the object they're controlling on the screen when the first drop in. For added bonus you could even make them pulse in time to the rumble so that the player can identify it even quicker (since everyone's rumble and pulse would all just slightly be different unless they hit them at the exact same time).
  • 04/07/2009 16:39 In reply to

    Re: 4 Player games (best practice for controller assignment?)

    1.  you can assign the player index as  -1 and do a check for it,   if you want to keep your number of variables down

                    PlayerIndex p = (PlayerIndex)(-1);
  • 04/07/2009 16:46 In reply to

    Re: 4 Player games (best practice for controller assignment?)

    Harald Maassen:

    2. You can simply display a little arrow above the player's avatar with the text "Player X", where X is equal to their player index. You won't need to do any fancy wait-for-input tricks.


    Good idea. The "XBoxButtonImages" resource has an image of the green ring which I can edit to make 4 copies with each quadrant lit up. I will use this, thanks.
    Dead Meat- Out now on XBLIG!
Page 1 of 1 (5 items) Previous Next