前言

一直很想玩异星工场,但无奈手里的人民币不支持我买啊,直到前几天在谷歌商店看到mindustry。和异星工厂大同小异的玩法,并且更让人兴奋的是,它--多版本互通,并且能联机,免费!!!现在这么良心的游戏真的很少见了,有生之年啊。 。这款游戏我肝了一天,就已经差不多完结了(因为之前玩过异星工厂),新手很容易上手。直到无聊翻了翻他们的网站,发现他们竟然给了服务器端的运行版本。于是,我便折腾起来。

准备

一台服务器,以及所需运行的服务器端软件。

服务器是windows还是linux甚至手机都可以。如果想要在公网上能访问就需要公网IP了,一般打电话给运营商都会给。实在没有就需要内网穿透了,不过好在我有一台在公网的设备。

先去 https://anuke.itch.io/mindustry 下载所需的服务端软件[Server]Mindustry.zip

部署到服务器

这里我以Debian,linux服务器作为演示。登陆服务器,上传刚刚下载的文件到用户根目录。可以用yz命令或者第三方工具上传。我这里使用xftp作为演示。

创建运行服务端的目录

mkdir mindustry-server

解压压缩包到服务端目录

unzip -d mindustry-server mindustry-server.zip

删除压缩包

rm mindustry-server.zip

进入服务端目录

cd mindustry-server

运行启动脚本

./run_server.sh

如果报错那是因为没有java支持,终端输入java可以判断有没有安装java,如果下面一样报错就是没有java

root@ecs-linux:~# java
Command 'java' not found, but can be installed with:

sudo apt install default-jre  
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

没有预装java,根据提示安装就可以了。输入以下命令就可安装

sudo apt install default-jre

再次输入启动命令

./run_server.sh

看到下面这串文字 就成功90%了。

[08-12-2020 | 13:17:02] [I] Server loaded. Type 'help' for help.

以下是命令列表

[08-12-2020 | 13:20:09] [I]    help - Displays this command list.
[08-12-2020 | 13:20:09] [I]    version - Displays server version info.
[08-12-2020 | 13:20:09] [I]    exit - Exit the server application.
[08-12-2020 | 13:20:09] [I]    stop - Stop hosting the server.
[08-12-2020 | 13:20:09] [I]    host [mapname] [mode] - Open the server. Will default to survival and a random map if not specified.
[08-12-2020 | 13:20:09] [I]    maps - Display all available maps.
[08-12-2020 | 13:20:09] [I]    reloadmaps - Reload all maps from disk.
[08-12-2020 | 13:20:09] [I]    status - Display server status.
[08-12-2020 | 13:20:09] [I]    mods - Display all loaded mods.
[08-12-2020 | 13:20:09] [I]    mod  - Display information about a loaded plugin.
[08-12-2020 | 13:20:09] [I]    js  - Run arbitrary Javascript.
[08-12-2020 | 13:20:09] [I]    say  - Send a message to all players.
[08-12-2020 | 13:20:09] [I]    difficulty  - Set game difficulty.
[08-12-2020 | 13:20:09] [I]    rules [remove/add] [name] [value...] - List, remove or add global rules. These will apply regardless of map.
[08-12-2020 | 13:20:09] [I]    fillitems [team] - Fill the core with items.
[08-12-2020 | 13:20:09] [I]    playerlimit [off/somenumber] - Set the server player limit.
[08-12-2020 | 13:20:09] [I]    config [name] [value...] - Configure server settings.
[08-12-2020 | 13:20:09] [I]    subnet-ban [add/remove] [address] - Ban a subnet. This simply rejects all connections with IPs starting with some string.
[08-12-2020 | 13:20:09] [I]    whitelisted - List the entire whitelist.
[08-12-2020 | 13:20:09] [I]    whitelist-add  - Add a player to the whitelist by ID.
[08-12-2020 | 13:20:09] [I]    whitelist-remove  - Remove a player to the whitelist by ID.
[08-12-2020 | 13:20:09] [I]    shuffle [none/all/custom/builtin] - Set map shuffling mode.
[08-12-2020 | 13:20:09] [I]    nextmap  - Set the next map to be played after a game-over. Overrides shuffling.
[08-12-2020 | 13:20:09] [I]    kick  - Kick a person by name.
[08-12-2020 | 13:20:09] [I]    ban   - Ban a person.
[08-12-2020 | 13:20:09] [I]    bans - List all banned IPs and IDs.
[08-12-2020 | 13:20:09] [I]    unban  - Completely unban a person by IP or ID.
[08-12-2020 | 13:20:09] [I]    pardon  - Pardons a votekicked player by ID and allows them to join again.
[08-12-2020 | 13:20:09] [I]    admin   - Make an online user admin
[08-12-2020 | 13:20:09] [I]    admins - List all admins.
[08-12-2020 | 13:20:09] [I]    players - List all players currently in game.
[08-12-2020 | 13:20:09] [I]    runwave - Trigger the next wave.
[08-12-2020 | 13:20:09] [I]    load  - Load a save from a slot.
[08-12-2020 | 13:20:09] [I]    save  - Save game state to a slot.
[08-12-2020 | 13:20:09] [I]    saves - List all saves in the save directory.
[08-12-2020 | 13:20:09] [I]    gameover - Force a game over.
[08-12-2020 | 13:20:09] [I]    info  - Find player info(s). Can optionally check for all names or IPs a player has had.
[08-12-2020 | 13:20:09] [I]    search  - Search players who have used part of a name.
[08-12-2020 | 13:20:09] [I]    gc - Trigger a grabage struct. Testing only.

想要快速开始直接输入host就行了,这时客户端输入服务端的ip就可以连接了。
接下来就是域名指向ip,配合screen命令后台挂起

screen -S mindustry

然后就可以断开终端了,下次登陆终端时输入以下命令就可以回到会话窗口。然后输入exit关闭会话窗口端即客户端了。

screen -r mindustry
测试服
我的服务器域名是mc.anyfan.top,可以提供一个搭建完成的预览(不保证长期开启)
最后修改:2021 年 02 月 26 日 08 : 51 PM
赏口饭吃,行行好吧,客官!