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.
Moderators - Reputation: 7262
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.
Crossbones+ - Reputation: 10458
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.
Crossbones+ - Reputation: 7173
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.
Crossbones+ - Reputation: 2025
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.
Members - Reputation: 1070
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??)
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....
Members - Reputation: 855
Posted 08 February 2014 - 03:41 AM