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

Started by
6 comments, last by Wooh 10 years, 2 months ago

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.

Advertisement

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 };

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.

Sean Middleditch – Game Systems Engineer – Join my team!

I think he's specifically talking about TCP broadcast


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

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).

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.

Everything is better with Metal.

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....

--------------------------------------------[size="1"]Ratings are Opinion, not Fact
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.

This topic is closed to new replies.

Advertisement