# Lyra 示例

了解如何使用 Edgegap 托管 Unreal Engine 项目，采用以下示例中的技术 [Lyra 示例](https://dev.epicgames.com/documentation/en-us/unreal-engine/lyra-sample-game-in-unreal-engine).

## ✔️ 准备工作

在开始之前，您需要：

* Unreal Engine 5.5 - [使用 Epic Games Launcher 下载](https://www.unrealengine.com/en-US/download),
* Lyra 入门游戏 - [从 Fab 下载](https://www.fab.com/listings/93faede1-4434-47c0-85f1-bf27c0820ad0).

打开您的 Epic Games 启动器，导航到 Unreal Engine / Library / Fab Library。

搜索 “lyra”，然后创建项目。我们建议使用 SSD 以获得更快的构建速度。

## ⚡ 部署并连接

### 1. 在 Edgegap 上部署服务器

☑️ 要开始，您需要 [创建一个 Edgegap 免费帐户](https://app.edgegap.com/auth/register)。无需信用卡。

☑️ [为您的应用创建一个新的应用版本](https://app.edgegap.com/application-management/applications/lyra-sample/versions/create)，选择 Lyra 示例。

☑️ [使用您的 Lyra 示例应用版本部署服务器](https://app.edgegap.com/deployment-management/deployments/list).

☑️ [打开您新部署的详细信息](https://app.edgegap.com/deployment-management/deployments/list).

☑️ 找到您部署的唯一一次性连接信息：

* **主机 URL** 格式为 `780aa4260e83.pr.edgegap.net` ,
* **外部端口** 格式为 `30854`  （5 位数字）。

✅ 现在您可以继续下一步。

### 2. 编辑器中播放 (PIE)

☑️ 导航到您驱动器上新的 Lyra Starter Game 项目根文件夹。

☑️ 使用文本编辑器（例如记事本）编辑文件 Config / DefaultEngine.ini。

☑️ 对于每个 `[section]`  下面的部分，如果存在则添加以下内容，或创建该部分。

```
[ConsoleVariables]
net.IgnoreNetworkChecksumMismatch=1
net.CurrentHandshakeVersion=2
net.MinHandshakeVersion=2
net.VerifyNetSessionID=0
net.VerifyNetClientID=0

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions(DefName="GameNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000000 
MaxInternetClientRate=1000000000
InitialConnectTimeout=120.0

[/Script/BuildSettings.BuildSettings]
DefaultServerTarget=LyraServer
```

☑️ 在 Unreal Engine 中打开您的新项目。

☑️ 按下 ▶️ 播放 按钮以启动您的游戏客户端。

☑️ 按波浪号键 `~`  并输入 `open {host}:{port}`  使用前一步的连接信息。&#x20;

🙌 恭喜您完成在 Edgegap 上的首次部署！

## ✏️ 自定义服务器构建

{% hint style="success" %}
参见 [Unreal Engine](/zh/unreal-engine.md) 用于 Unreal Engine 以 **了解如何构建和自定义服务器**.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.edgegap.com/zh/docs/sample-projects/unreal-engine/lyra-shi-li.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
