locked
Multiplayer game: How to search game server?

    Question

  • Hi!

    I'm currently writing a multi player game. Communication is done via StreamSockets. Everything works as expected.

    However one thing is not perfect. Starting a multi player game works as following:

    1. The first player starts a multi player game

    2. The second player connects to the started multi player game, however he needs the host name of the first player

    My question:

    Is there a way, to automatically detect the host name of the first player? Maybe using a specific broadcast method?

    Thanks!

    Jürgen


    Saturday, February 22, 2014 10:50 AM

Answers

  • I'd create a second socket that broadcasts the game info to all on the network. (multicast, udp, etc.)

    Then, the second user's game can just listen on the broadcast address for host information when they choose to join.

    On the host, do this when a game is created, and until a connection is made.  (You can connect multiple people this way too by keeping the broadcast socket open.


    Darin R.

    • Marked as answer by Big 3 Software Saturday, February 22, 2014 10:34 PM
    Saturday, February 22, 2014 9:47 PM

All replies

  • I'd create a second socket that broadcasts the game info to all on the network. (multicast, udp, etc.)

    Then, the second user's game can just listen on the broadcast address for host information when they choose to join.

    On the host, do this when a game is created, and until a connection is made.  (You can connect multiple people this way too by keeping the broadcast socket open.


    Darin R.

    • Marked as answer by Big 3 Software Saturday, February 22, 2014 10:34 PM
    Saturday, February 22, 2014 9:47 PM
  • Thanks! I'll give it a try.

    Saturday, February 22, 2014 10:34 PM
  • Take a look at this video; it explains how multicast in Windows 8 works.  And the goal is your exact scenario: finding a peer machine on a local subnet.

    http://channel9.msdn.com/posts/Multicast-LAN-Discovery


    Network Developer Experience Team (Microsoft)

    Monday, February 24, 2014 10:31 PM