搭建自己的Phira多人联机服务器,成功和好友爽玩

Phira多人联机服务器搭建&使用教程

https://github.com/afoim/phira-mp-autobuild

这里有一些由Github Action自动构建的服务端文件,涵盖以下系统和架构

img

也可以前往[Multiplayer Server | Dmocken的Phira下载站](https://phira.dmocken.top/Multiplayer Server多人游戏服务器)自行寻找

寻找适用于你的系统的文件,下载下来并执行即可。默认服务端将会在你的主机12346端口上开放,如果需要自定义端口,请使用--port参数指定端口。然后即可使用Phira来填写IP/域名:端口来连接

*如果要显示Log,请使用 RUST_LOG=debug ./xxx 去运行,默认日志等级是 WARN

如果这些文件不适用于你正在使用的系统请前往自行构建(高级)继续阅读

自行构建(高级)

由于phira-mp使用Rust编写,若想要自行构建需要在你的操作系统上安装Rust环境

Windows

前往Rust 下载页,下载 Rust

打开后会弹出一个 CMD 窗口,输入 1(Quick Install)回车,等待 Visual Studio 安装(如果此步 Visual Studio 下载很慢也可以手动下载

image-20250711095435813

在 Visual Studio 中,勾选使用 C++ 的桌面开发,然后安装

img

然后请跳过 Linux 教程直接阅读构建 phira-mp

Linux

执行:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

选择 1 回车

执行:source $HOME/.cargo/env

使用Rust构建phira-mp

克隆仓库:git clone https://github.com/TeamFlos/phira-mp.git(不支持IPv6)或git clone https://github.com/afoim/phira-mp-autobuild.git(支持IPv6)

1
cd phira-mp`或`cd phira-mp-autobuild

更新依赖:cargo update

构建:cargo build --release -p phira-mp-server

运行程序并将 log 打印到终端,会显示你监听的端口:RUST_LOG=info target/release/phira-mp-server
(如果你需要指定端口号:RUST_LOG=info target/release/phira-mp-server --port 8080

img

共发表 15 篇Blog · 总计 14.9k 字
© 2025 AirTouch 使用 Stellar 创建
本站总访问量次 本站访客数人次 本文总阅读量