完成度: 20%
- 请帮助改进本文。
- 参考风格指南编写正确的版本。
- 在完成翻译后移除该模板。
如果你想建立多人网络游戏,你需要在你的计算机上建立一个OpenTTD 服务器。如果所有玩家将连接至您的家庭网络,请跳至"开启服务器"一节。
Contents |
如果你使用防火墙
为了您的安全,千万不要完全禁用防火墙。相反,将其配置为允许 UDP 和 TCP 连接到端口3979 ("开放端口")。如果你希望你的服务器在公共服务器列表(en)可见(推荐),还需要打开3978端口到仅限UDP连接。
如果您通过路由器连接到互联网
你需要设置路由器将来自公网玩家的游戏数据转发到路由器内网内的 OpenTTD 服务器上。不这样做,数据就只会被丢弃,永远都无法发送到服务器上。这就是一个经典的使用端口转发的例子;在这种情况中,你需要设置 3979 端口能够转发 UDP 和 TCP 连接的数据,即设置端口 3979 能够进行端口转发(包括 TCP 和 UDP)。(如果你因为某些情况无法使用 3979 端口,你可以在游戏控制台输入"server_port <端口号>"让 OpenTTD 使用其他端口号)
因为每个人使用的路由器型号都不同,你需要查看路由器的说明书手册,或在网上搜索如何开启路由器的端口转发。不幸的是,不是所有的路由器都有端口转发功能;如果是那种情况的话,那你只能花钱买个新的支持端口转发的路由器了,或者,如果你的路由器使用的是非官方固件,可以试着使用官方固件,看是否有端口转发功能。
最后就是确保你的路由器能够正确发送游戏数据到正确的电脑上。如果你想要你的服务器能够在公共服务器列表中可见 (推荐这样做),你还需要设置端口3978能够转发UDP连接数据。
开启服务器
1 From the Main Menu, click Multiplayer
2 Click Start Server
3 Pick a name for your game to help others identify it, and enter it into the Game name box
4 Configure the additional settings:
- Set Password sets a password for the server so that only users who know the password can join your game.
- Connection specifies whether the server is for local/private use only, or advertises itself to the master server so it is visible in the internet server list.
- Language Spoken is for requesting that users speak a certain language on your server.
- Max clients limits the total number of clients (players and spectators) that can connect.
- Max companies limits the number of companies at game.
- Max spectators limits the number of clients who can connect to watch but not play (not-players).
5 Click New Game (to generate random new game), or Load Game (to continue an saved game), or Play Scenario, or Play Heightmap, or Cancel.
连接到服务器
Players connected to your home network should immediately see your server on the server list and be able to connect easily.
If some players are connecting via the public Internet, however, your server will only appear if you have chosen "Internet (advertise)" under "Connection" (there may be a delay of several minutes before it is visible). Otherwise, they will need to know your router's IP address, or your computer's if you aren't using a router. This can be obtained by visiting https://www.whatismyip.com/.
专用服务器
If you are expecting many players and aren't going to be using the computer running the server to play yourself, you can start OpenTTD as a Dedicated server (en) instead of the usual interactive graphical version.
If you run your server on ubuntu/debian and you want to automatically start/stop and save your game, check out the init.d scripts at https://bitbucket.org/frodus/openttd-init
管理员端口
If you want to remotely control your OpenTTD server using a stand-alone program/script, the recommended way is to use the Admin Port.