Jump to content

  • Log In with Google      Sign In   
  • Create Account


LAN: Is it bad practice to use broadcasting to send all data?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Wooh   Members   -  Reputation: 617

Like
0Likes
Like

Posted 16 January 2014 - 10:08 AM

On a LAN game is it considered bad practice to send all information as broadcasts? Sending the same information to all clients would mean more traffic on the wire but using broadcasting would mean more work for the innocent computers that doesn't play the game.



Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5185

Like
3Likes
Like

Posted 16 January 2014 - 10:31 AM

is it considered bad practice to send all information as broadcasts?


Not necessarily. However, if there is a server involved (to break ties for "who picked up the healthpack first,") then the information another client would see from other players wouldn't be very useful.

Broadcast also actually uses more bandwidth even for the players that participate, because each individual packet has overhead on the wire from the switch to the computer. With broadcast, N small packets have to go to (N-1) computers. With client/server, (N-1) small packets go to the server one from each player, and (N-1) large (aggregated) packets go from the server, one to each other player.

My advice: If you use a server, don't use broadcast.
enum Bool { True, False, FileNotFound };

#3 SeanMiddleditch   Members   -  Reputation: 5296

Like
0Likes
Like

Posted 16 January 2014 - 04:57 PM

I think he's specifically talking about TCP broadcast

 

Short version: heck no, don't use TCP broadcast.  Multicast is another story.

 

A consideration is network topology; sending to individual clients is going to work on far more networks (including the wide, wild Internet) where broadcast is going to limit you to LANs, and then only _simple_ LANs.  Multicast is going to give you a lot of trouble on the Internet though it could be made to work in more complicated LANs.



#4 hplus0603   Moderators   -  Reputation: 5185

Like
3Likes
Like

Posted 16 January 2014 - 06:20 PM

I think he's specifically talking about TCP broadcast


There is no such thing as TCP broadcast.
enum Bool { True, False, FileNotFound };

#5 Nypyren   Crossbones+   -  Reputation: 4214

Like
2Likes
Like

Posted 16 January 2014 - 06:23 PM

The only thing I ever use broadcast for is for LAN announcement to find active servers.  I stop broadcasting once I get the list of LAN servers.  I then connect directly to the server and run things like a normal client-server setup (since my network code uses the same connection process for internet games).


Edited by Nypyren, 16 January 2014 - 06:25 PM.


#6 0BZEN   Crossbones+   -  Reputation: 2013

Like
0Likes
Like

Posted 03 February 2014 - 03:23 AM

Yeah, like Nypren says. I restrict the use of broadcast to LAN host discovery. After that, there is just no need to use a broadcast socket. clients.

 

You could theoretically use broadcast to advertise LAN hosts, and possibly clients too, but I prefer the other way around. Less noise and less traffic. 


Edited by papalazaru, 03 February 2014 - 03:24 AM.

Everything is better with Metal.


#7 wodinoneeye   Members   -  Reputation: 768

Like
0Likes
Like

Posted 08 February 2014 - 03:10 AM

Generally most games dont sent huge amounts of data changing/sent so that 100Mb network hardware  well exceeds  what is needed.

 

(interesting is how (now more commonly used) WiFi LAN might shift this a little??)

 

BUT ...

 

Maybe some games (future games) which have massive gameworld updates where replicating it all to each client might cause issues.

 

Is Minecraft  an example (or might be as it is growing ever more dynamic) or is the data of that game still too simple/small even if 1/3 of the world goes boom its transmitted in seconds....


--------------------------------------------Ratings are Opinion, not Fact

#8 Wooh   Members   -  Reputation: 617

Like
1Likes
Like

Posted 08 February 2014 - 03:41 AM

Thank you for all your opinions. I have decided to use UDP broadcasting only to find the other players. I think this will allow me to reuse a lot of code if I choose to implement playing over the Internet in the future. Only the code to find and connect to other players would have to be different.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS