I am developing an online multiplayer game. It works well when I test it on the local area network, but before I release it I would like to test how the user-experience works out for someone who has not such a good connection to the server. How can I simulate a bad internet connection with high latency, low bandwidth, jitter and occasional packet loss when in a local environment?
I think Dummynet is what you are looking for. Dummynet is a network emulation tool which can simulate bandwidth limitations, delays, packet losses, and many more. You can easily choose which traffic you want to intercept and configure the limitations, e.g. to limit all incoming TCP traffic to 2Mbit/s you do
ipfw add pipe 2 in proto tcp ipfw pipe 2 config bw 2Mbit/s
You see the traffic selection is done by the known ipfw firewall and the pipes provide the limitation features.
It is available for FreeBSD, Linux and Windows.
Network Link Conditioner
If you're on a Mac, you can use Network Link Conditioner.
You can simulate various cases of bad internet connections, including Edge and 3G.
In addition, you can create your own profiles with your own settings:
It is a free download in Xcode (go to Xcode → Open Developer Tool → More Developer Tools… and download the Hardware IO Tools for Xcode).
If you are on linux you can use netem to simulate all of the possible problems with network like high latency, low bandwidth, packet losses and many others.
There is an option for windows called NetLimiter but I haven't used it so can't vouch for it.
Just found a Mac App called SlowlyApp.
Clumsy, for Windows Vista & 7.
How can I simulate a bad internet connection with high latency, low bandwidth, jitter and occasional packet loss when in a local environment?
If you're on Windows, you can try SoftPerfect Connection Emulator. It's basically a driver that injects itself between your application and the network layer (similar to Wireshark/WinPCAP) for the selected NIC and can simulate limited bandwidth, latency, packet loss, and other things. The UI is simple and straightforward.
It's a commercial product, but the trial lets you do 30-second bursts of "interference" that should be good enough for you to judge whether this tool does what you want.
Another cross-platform option is DummyNet, which behaves in a similar manner (via ipfw) but is a bit less easy-to-use.
I would like to test how the user-experience works out for someone who has not such a good connection to the server.
I think this part of the question could be restated as "how do I deal with network latency in my application?" One commonly-used and effective technique is Dead Reckoning. The linked article explains it better than I can, but the basic idea is that your clients kind of "simulate" where each entity should be and what it should be doing by an algorithm. Whenever an entity deviates from this algorithm (i.e. player input, server-side event, etc), it sends out an update to each client.
I haven't used it in a while, but I've used Charles for testing this. It is an application with various network diagnostics tools, including simulating the problems you mentioned: "a bad internet connection with high latency, low bandwidth, jitter and occasional packet loss"