Thursday, June 17, 2010

Left 4 Dead 2 LAN (Offline)

Those who like to play the original Left 4 Dead with their friends locally, ergo without an Internet connection, may also want to play the sequel Left 4 Dead 2 on a local area network (LAN) as well. I've created a guide on how to host and join a local game session without relying on Steam or any other online game matchmakers.


Update (February 7, 2012)

Almost two years have passed since I created this guide and a lot of game updates have been pushed through by Valve since then. As a possible fix to recent multiplayer connection problems, create a shortcut for Left 4 Dead 2.

Open the shortcut’s properties, proceed to Shortcut tab and add the following at the end of the Target field: –insecure. Click Apply/OK to save the new setting.

CaptureEvery time you run Left 4 Dead 2, you should do so by using this modified shortcut. The guide below will not work if you don’t use the shortcut.

After following the steps above, run the game. You will then need to enable the developer console. Optionally, you can also enable automatic detection of LAN games for convenience to those who will join your hosted game. Here's how:

How to enable Developer Console:

1. At the game main menu, click Options.
2. Click Keyboard/Mouse.
3. Click Allow Developer Console and select Enabled.

Left 4 Dead 2 main menu with console open.
Click image to enlarge.
How to automatically detect LAN games:

1. At the game main menu, click Options.
2. Click Multiplayer.
3. Click Automatically Discover LAN Games and select Enabled.

With all the necessary settings set up, it's now time to host a game.

How to create or host a Left 4 Dead 2 local (LAN) game:

1. Open the Developer Console by pressing ` on your keyboard. (It is the key below Esc.)
2. Type sv_lan 1 then press Enter.
3. Type sv_allow_lobby_connect_only 0 then press Enter.
4. In the console, type map then press Space.
5. Right after you press Space all the playable maps will be displayed.
6. Use your keyboard arrows to scroll to your desired map.
7. Press Enter.

Basically the command to create a local game is this:
map nameOfMapHere gameType

An example of a map is this c5m1_waterfront. c5 stands for campaign five, m1 for chapter/map one, and waterfront the corresponding name. Those with The Passing campaign, the campaign code assignment is c6.

List of all Left 4 Dead 2 maps:

Dead Center:
c1m1_hotel   c1m2_streets
c1m3_mall    c1m4_atrium

The Passing:
c6m1_riverbank   c6m2_bedlam   c6m1_port

Dark Carnival:
c2m1_highway   c2m2_fairgrounds   c2m3_coaster
c2m4_barns     c2m5_concert

Swamp Fever:
c3m1_plankcountry   c3m2_swamp
c3m3_shantytown     c3m4_plantation

Hard Rain:
c4m1_milltown_a   c4m2_sugarmill_a   c4m3_sugarmill_b
c4m4_milltown_b   c4m5_milltown_escape

The Parish:
c5m1_waterfront   c5m2_park c5m3_cemetery
c5m4_quarter      c5m5_bridge

List of all game modes:

campaign   scavenge   realism
survival   versus     mutation

If the gameType is left blank, the hosted game will default to a campaign game with normal difficulty. To choose another mode, just type in the console the game mode after the map name.

Example: map c1m4_atrium realism

How to join a LAN game:

When the game is created, the remaining thing to do is to let other players join the game. If Automatically Discover LAN Games is enabled, Steam Group Servers may appear in the main menu which players can use to join your game.

Alternately, the console command to join is connect hostIPAdresshere.

Example: connect
Steam Group Servers (at the bottom center) appears when it detects a game.
Click image to enlarge.
When clicked, you will then proceed to this window that lists all available games.
Click image to enlarge.
Determining the host's IP address:

Determining your local IP address can be tricky when you're connected to the Internet, so it's best to stay offline when hosting a game. Anyway, the game host must type net_status in the developer console. Some data will appear afterwards. You will need to look for a phrase similar to this: "Net status for host" The numbers that appear on that phrase is the host's IP address.

Other notes and info:

This offline LAN game guide does not require Hamachi, Garena, or Steam. However, I suppose the version of the game installed on all computers must be the same.

Make sure Left 4 Dead 2 is added to the firewall exemption.

If set, players may only join this server from matchmaking lobby, and may not connect directly.

sv_lan ( def. "0" )
If set, server is a lan server ( no heartbeat, no authentication, no non-class C addresses ).