ID:132501
 
Recently, I've been playing with the zsnes emulator's network feature and noticed something interesting. The emulator works by synchronizing input over the network, and supports TCP as well as UDP. The TCP mode is about as laggy as BYOND, whereas the UDP mode makes realtime games very playable with a ping of around 0.3 seconds.

Now, considering the following points:
- the main task of TCP is to ensure data integrity and order..
- input synchronization requires the above two, so zsnes rebuilt these TCP features on top of UDP
- UDP is >still< faster for them
- BYOND doesn't share game logic with its client, so it does >not< need the above two

Judging from this, it would make very much sense for BYOND to use UDP.

I have no idea of BYOND's internals, and I'm not even sure whether it already uses UDP, but so far I've only had to forward TCP ports, so I assume not.

Still, I lack a bit of information, so more input on this will be appreciated.
When you press up arrow it sends info to server that you used verb .north. Then server does the stuff (in most cases moves you, and sends packet to each client in view 'this' atom moved). Client itself can't do anything at all, server tells what to display on map, what verbs to show, which mob is yours, it can't even move on itself, arrows keys are just default verbs.
TCP/IP is basically UDP/IP with special settings so the two ends can keep an established connection. A TCP/IP connection has a state, and is meant to send and receive packets in the order they were intended. It also has error correction and the ability to request lost packets built in.

UDP has none of those things. UDP is basically where you send off a packet and forget about it. If you're using it, you basically have to deal with issues of keeping things in sync and figuring out if you've lost packets on your own.

BYOND is built entirely around a stateful protocol; it needs the concept of persistent connections that can keep track of which data is in which order. Raw UDP would be completely unusable for BYOND, and the code required to make it stateful would basically negate any difference between it and TCP.

UDP can have some advantages, but it has fewer than you think. It's really only suited for certain kinds of applications.

Lummox JR