Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:07:40+00:00 2026-06-04T08:07:40+00:00

Is there any tutorial or sample on how to create a local multiplayer in

  • 0

Is there any tutorial or sample on how to create a local multiplayer in an XNA game(Windows)?

I often see tutorials for networking game but never on how to enter a second player. How to ask the second player to sign in, to use the same object but with different controller…

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:07:41+00:00Added an answer on June 4, 2026 at 8:07 am

    I’ve not come across any tutorials, but I can outline some basic ideas for you.

    If all of your players will be identical:

    Modify your ‘player’ objects constructor to have a parameter for some playerIndex. When checking for input inside the player class, use this index. That way, you can create a bunch of ‘players’ without needing to write individual classes for each. You can then write general-purpose code like:

        if (inputManager.IsMoveRight(playerIndex))
        { 
            // do some stuff etc.
        }
    

    This will require some modifications to your input management structure. You should be aiming to generalise the code you already have.

    If each player will have completely different implementations:

    You’ll need to take advantage of polymorphism in this case. If each player should select their character in a menu screen, you’ll need to have some attribute in the player class that holds their chosen character (Note: If each player should be a preset default, i.e player 1 is always mario, player 2 is always sonic, it would probably be best to subclass your player class for each player). This attribute could be moved up a layer and stored in a ‘controller’ class if you wanted.

    Menu logic:

    Handling player sign-ins is really best done before any levels are loaded. I’m going to assume that you don’t need players to drop in/out during the game. Basic outline:

    • When the game is in a character selection screen (or just the main menus) check for input from all controllers. If a controller presses ‘start’, sign them in. This could involve simply adding a playerIndex to an array for example. Then, when the game loads, check the array for active players and spawn any that are found.

    • Character selection can be implemented in very much the same way, although you’d probably want a specific menu sign-in screen. Check for input from active players during the sign in screen and allow them to scroll through and select a character. Store the result somewhere (player or controller class for example).

    Other things to consider:

    • Are getting input from the keyboard as well as gamepads? If this is the case, it might be easier to default the keyboard to player one, and only allow sign in/out from gamepads.

    • I mentioned this before, but you will need to generalise your input management to prevent a major case of spaghetti code. In order for any of this to work, you should not be checking previous/current controller states from directly within your player class. The MSDN Game State Management sample is worth examining as it uses a similar system.

    This isn’t a very comprehensive guide, but hopefully I’ve raised some points for you to consider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

are there any tutorials out there on how to create a sandbox using C#?
is there any tutorial for uploling video in youtube using GData API. i want
I need to convert from sqlite2 db to sqlite3, is there any tutorial that
Is there any good tutorial or code snippet out there on how to use
Is there any good tutorial for creating WPF controls entirely at runtime? Thanks
Is there any recommended Java application profiling tutorial? I am now using JProfiler and
Is there any book or links that I can read some tutorial about the
Is there any help, resources, example or a tutorial available for putting fragments inside
Are there any tutorials or guides out there that anyone knows of that will
Are there any tutorials or examples on how to play WAV files on Mac

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.