LAN Server: Difference between revisions

From DDraceNetwork
m sry for duplicate, changed format to the same one we have on discord within $configdir
Tags: Visual edit merged edit of another user
m DCLIENT=OFF does not increase build time but decreases it.
 
(2 intermediate revisions by one other user not shown)
Line 45: Line 45:
#*Make sure to choose the UDP setting, and not the TCP or the TCP/UDP setting.
#*Make sure to choose the UDP setting, and not the TCP or the TCP/UDP setting.
#*You can forward a port other than 8303 if you set up the desired port using <code>sv_port</code> in your server autoexecutable. However, the default port is 8303 for DDNet. So, if you're not sure what you're doing, just forward port 8303.
#*You can forward a port other than 8303 if you set up the desired port using <code>sv_port</code> in your server autoexecutable. However, the default port is 8303 for DDNet. So, if you're not sure what you're doing, just forward port 8303.
#If you'd like your server to show up on the Internet tab, use the server setting <code>sv_register 1</code>, either in the f2 console or in the server autoexecutable. Note that this '''will''' make your IP publicly viewable if you host the server from your home network. So, use at your own risk.
#If you'd like your server to show up on the Internet tab, use the server setting <code>sv_register 1</code>, either in the f2 console or in the server autoexecutable. Note that this '''will''' make your IP publicly viewable if you host the server from your home network. So, '''use at your own risk'''.
Some ISPs might not provide you with a full native IPv4 address, but instead use carrier-grade NAT, and will thus not support forwarding ports. In this case you can't make your LAN server available for online play.
Some ISPs might not provide you with a full native IPv4 address, but instead use carrier-grade NAT, and will thus not support forwarding ports. In this case you can't make your LAN server available for online play.


Line 54: Line 54:


<!--T:14-->
<!--T:14-->
{| class="wikitable" style="width:100%;" -
{| class="wikitable" style="width:100%;"
|<div style=" display: flex; justify-content: space-between;"><div>Method 1 (Compiling server)</div> <div class="mw-customtoggle-methodOne" style="color:#0B0080;"><small>[Show/Hide]</small></div></div>
<td><div style=" display: flex; justify-content: space-between;"><div>Method 1 (Compiling server)</div> <div class="mw-customtoggle-methodOne" style="color:#0B0080;"><small>[Show/Hide]</small></div></div></td>
|- class="mw-collapsible mw-collapsed"
|- class="mw-collapsible mw-collapsed"
|For Building your DDNet Server from source please refer to the Github README
|For Building your DDNet Server from source please refer to the Github README
*[https://github.com/ddnet/ddnet Github]
*[https://github.com/ddnet/ddnet Github]


<!--T:56-->
If you follow the steps you will not only build the Server but also the Client. to disable that specify the following in your cmake command:
If you follow the steps you will not only build the Server but also the Client. to disable that specify the following in your cmake command:


<code>cmake .. -DCLIENT=OFF</code>
<!--T:57-->
<p><code>cmake .. -DCLIENT=OFF</code></p>


This will significantly increase build time and wont build unneccessary files.
<!--T:58-->
This will significantly decrease build time and wont build unneccessary files.
|}
|}


<!--T:35-->
<!--T:35-->
{| class="wikitable" style="width:100%;" -
{| class="wikitable" style="width:100%;"
|<div style=" display: flex; justify-content: space-between;"><div>Method 2 (Using precompiled binaries)</div> <div class="mw-customtoggle-methodTwo" style="color:#0B0080;"><small>[Show/Hide]</small></div></div>
<td><div style=" display: flex; justify-content: space-between;"><div>Method 2 (Using precompiled binaries)</div> <div class="mw-customtoggle-methodTwo" style="color:#0B0080;"><small>[Show/Hide]</small></div></div></td>
|- class="mw-collapsible mw-collapsed"
|- class="mw-collapsible mw-collapsed"
|1. Download binaries from [https://ddnet.org/downloads/ DDNet download page]
|1. Download binaries from [https://ddnet.org/downloads/ DDNet download page]
Line 80: Line 83:


<!--T:38-->
<!--T:38-->
*<code>./DDNet-Server</code>
<li><code>./DDNet-Server</code></li>


<!--T:39-->
<!--T:39-->
Line 105: Line 108:


<!--T:46-->
<!--T:46-->
*'''On Windows:''' Old: <code>%appdata%\Teeworlds</code> New: <code>%appdata%\DDNet</code>
*<b>On Windows:</b> Old: <code>%appdata%\Teeworlds</code> New: <code>%appdata%\DDNet</code>
*'''On Linux:''' Old: <code>~/.teeworlds</code> New: <code>~/.local/share/ddnet</code>  
*<b>On Linux:</b> Old: <code>~/.teeworlds</code> New: <code>~/.local/share/ddnet</code>
*'''On macOS:''' Old: <code>~/Library/Application Support/Teeworlds</code> New: <code>~/Library/Application Support/DDNet</code>
*<b>On macOS:</b> Old: <code>~/Library/Application Support/Teeworlds</code> New: <code>~/Library/Application Support/DDNet</code>




Line 132: Line 135:


<!--T:53-->
<!--T:53-->
Server maps can be found in Teeworlds/maps. To load a map ingame, use the server command <code>sv_map <mapname></code>.
<p>Server maps can be found in Teeworlds/maps. To load a map ingame, use the server command <code>sv_map <mapname></code>.</p>





Latest revision as of 12:11, 27 October 2024

LAN servers are servers run locally by a player on their home network, which the hosting player has full control over.

There are a lot of reasons to host and use a LAN server. They allow you to:

  • Play privately with friends
  • Host maps not found on public servers
  • Test maps with admin commands and tools
  • And much more!

However, there are downsides to hosting a LAN server. They do require specific steps to allow friends to join, and often have unstable connections compared to official servers. Also note that LAN servers will only save ranks locally - if you finish a map on a LAN server, your rank won't translate to any official servers.


Creating and Joining a LAN Server

In the new client, creating a LAN server is very simple.

  1. Navigate to the main menu
  2. Click on "Start Server"
    • A black console window should pop up (this might take a moment). Copy the rcon password from this window.
  3. Navigate to the server browser, and join the new server in the LAN tab
  4. After joining, press f2 to open the in-game server console and enter in your rcon password from earlier to get access to admin commands.
  5. You're done!

However, this only allows players on your local network to join. In other words - nobody else except you can join this LAN server online. To allow players to join online, you'll have to go through more steps.


Setting Up Your LAN Server for Online Play

This next step requires you to port forward, which depends on the brand and type of router you have.

  1. Port forward the UDP port 8303 through your router.
    • The easiest way to do this is to simply search "how to port forward" in your preferred search engine. This process usually requires you to log into your router interface, which, again, varies per household.
    • Make sure to choose the UDP setting, and not the TCP or the TCP/UDP setting.
    • You can forward a port other than 8303 if you set up the desired port using sv_port in your server autoexecutable. However, the default port is 8303 for DDNet. So, if you're not sure what you're doing, just forward port 8303.
  2. If you'd like your server to show up on the Internet tab, use the server setting sv_register 1, either in the f2 console or in the server autoexecutable. Note that this will make your IP publicly viewable if you host the server from your home network. So, use at your own risk.

Some ISPs might not provide you with a full native IPv4 address, but instead use carrier-grade NAT, and will thus not support forwarding ports. In this case you can't make your LAN server available for online play.

Setting Up on Linux Server

Linux

Method 1 (Compiling server)
[Show/Hide]
For Building your DDNet Server from source please refer to the Github README

If you follow the steps you will not only build the Server but also the Client. to disable that specify the following in your cmake command:

cmake .. -DCLIENT=OFF

This will significantly decrease build time and wont build unneccessary files.

Method 2 (Using precompiled binaries)
[Show/Hide]
1. Download binaries from DDNet download page

2. Extract into folder

3. Open Server

  • ./DDNet-Server
  • 4. Forward a port to the server (default is 8303) 5. Connect via Client on the IP
    • Press F1
    • connect "Server-IP"
    6. Play

    More Information about Port forwarding are available at http://portforward.com/

    Server Settings and Maps

    Everything settings and map-wise can be found in your Teeworlds folder.

    • On Windows: Old: %appdata%\Teeworlds New: %appdata%\DDNet
    • On Linux: Old: ~/.teeworlds New: ~/.local/share/ddnet
    • On macOS: Old: ~/Library/Application Support/Teeworlds New: ~/Library/Application Support/DDNet


    Server Autoexecutables

    Server autoexecutables are files containing server settings that are automatically run every time you start your server. For example, this can be helpful if you want to keep a single rcon password to log in with every time.

    To create an autoexecutable, navigate to your Teeworlds folder (not your DDNet folder!), and create a file by the name of "autoexec_server.cfg". Make sure it is a .cfg extension file and not a .txt file or anything similar.

    To add commands, simply edit the autoexec_server.cfg file and add each command on a new line. Here are examples of commonly used commands:

    • sv_rcon_password <rcon password>
    • sv_password <password to join>
    • sv_name <server name>
    • sv_register 1 (shows the server on the Internet tab)
    • sv_test_cmds 1 (allows the use of cheat commands)


    Server Maps

    Server maps can be found in Teeworlds/maps. To load a map ingame, use the server command sv_map <mapname>.


    See also