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 8149365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:50:10+00:00 2026-06-06T14:50:10+00:00

I am writing a simple multiplayer 2d game, 4 player Pong to be exact.

  • 0

I am writing a simple multiplayer 2d game, 4 player Pong to be exact.

When the game starts There is a start Menu where you can choose to host or join a game.
one of the 4 players has to host, the other 3 will join. I can yell across the room to my other 3 buddies and tell them my ip and port number, but I am wondering if there is a way to search for the host instead. To me it sounds impossible, there are millions of computers on the internet, how can I possibly find the one computer who is waiting for my call. I know StarCraft Used to do it in the mid 90’s.

I have one theory on how I can achieve this. That is using a database like sql to keep track of who is currently Hosting. This would be the only use of the database since I am not keeping user stats or anything.

Is there a better way to do this?

  • 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-06T14:50:11+00:00Added an answer on June 6, 2026 at 2:50 pm

    Assuming you’re on a LAN, you can use UDP to discover clients.

    If a client is acting as a host, it listens for UDP datagrams. If it receives one containing a discovery request, it responds with its IP, port and any other information that the client needs. (You can include number of connected players, etc.)

    If a client is acting as, well, a client, it sends discovery datagrams while on the “join a game” screen. As hosts respond, they are added to the selection list.

    When the user selects a server, connect over IP as you’re already doing using the IP and port that you received in the discovery response.

    The Lidgren network library provides some nice Discovery functionality that may be of use.

    If you’re not on a LAN, you’ll need some sort of central directory that’s globally accessible- probably on a website. When someone starts a new game, their client would register their IP, etc. with the directory. Clients would then poll that site to get a list of servers, which would then be used to populate the “Join a game” screen.

    It’s worth noting that the server/directory approach works just as well in a LAN environment as it does over the Internet. UDP is more flexible in that it doesn’t require that a client have any knowledge of a directory provider, since it basically “yells across the room” for you.

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

Sidebar

Related Questions

I'm writing a simple I/O class in order to use at a multiplayer game.
I am writing simple game on flex. In the game there are 2 objects
I'm writing a simple online multiplayer game. It involves sending a few http requests
I'm writing a fairly simple 2D multiplayer-over-network game. Right now, I find it nearly
I'm writing a simple game and I'm going to have the mouse control the
I'm writing a simple program. There is only one class in it. There is
I've successfully installed M$ VC2010 and start writing simple programs using it. I am
I'm writing a 2D space RTS game in C#. Single player works. Now I
Writing a simple program that will find exact duplicate files on my computer, but
I've been recently writing simple game in C++ with SFML. Here's my question: In

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.