Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Discovering hosts on a LAN?  (Read 1347 times)
0 Members and 1 Guest are viewing this topic.
Offline javawillie

Junior Member




Hola, Paco.


« Posted 2004-04-24 17:34:09 »

Hi guys,

I'm working on a multiplayer game that will support LAN play.  I would like to know the best way to implement host discovery on the LAN.

I think I know part of what needs to be done, though I would appreciate your thoughts.  If a player decides to host a game, I assume I need to have that host do an IP broadcast to the LAN.  If the player dissolves the game, then again I would guess that host needs to broadcast the fact to the LAN.  (Can I do that using TCP, or do such broadcasts have to be UDP?)

The part where I'm not sure what to do is this.  Suppose there are already games being staged on the LAN, and a new player joins the LAN.  What is the best way for that player to be made aware of the games?  Does the host need to issue periodic broadcasts, so that the new player learns of the game?  If so, what is a good time interval?  Or is there a better way to do it altogether?

Thanks,
Willie
Offline javawillie

Junior Member




Hola, Paco.


« Reply #1 - Posted 2004-04-24 17:36:25 »

p.s. Also, in case it's not obvious from my previous post, there is no dedicated server on the LAN.  Any player is a potential game host.  So there is no central authority to query for available games.
Offline javawillie

Junior Member




Hola, Paco.


« Reply #2 - Posted 2004-04-24 17:54:53 »

Hm, after writing that I came up with an idea.  What if when the new player joins the LAN, his client broadcasts a query to the LAN like "who has a game?"  That prompts a response from any host on the LAN.  (I guess that response doesn't need to be broadcasted though.)  I'm pretty sure that would work.

Is there a better or more standard way of doing this?

Thanks,
Willie
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline vrm

Junior Member




where I should sign ?


« Reply #3 - Posted 2004-04-24 18:38:15 »

perhaps use an UDP broadcast ?
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #4 - Posted 2004-04-24 18:48:33 »

Quote
Hm, after writing that I came up with an idea.  What if when the new player joins the LAN, his client broadcasts a query to the LAN like "who has a game?"  That prompts a response from any host on the LAN.  (I guess that response doesn't need to be broadcasted though.)  I'm pretty sure that would work.

Is there a better or more standard way of doing this?

Thanks,
Willie


this is fairly standard; the main reason is that if no-one ever joins then no extraneous packets are sent out. As opposed to your origingal proposal which involves sending out packets pointlessly (potentially).

malloc will be first against the wall when the revolution comes...
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (14 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (33 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (19 views)
2014-08-16 06:20:21

Tekkerue (29 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (42 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!