> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/cn/virtual-machine/best-practice/running-a-moba-game-on-virtual-machines.md).

# 在虚拟机上运行 MOBA 游戏

## 背景信息

MOBA（多人在线战斗竞技场）基于竞技场的游戏场景，是一种具有实时战斗和高延迟要求特征的多人在线实时策略游戏。因此，大多数战斗环境的部署需要靠近玩家，并要求全球不同**地域**之间进行相互通信。

在 MOBA 等实时战斗游戏的全球覆盖过程中，采用了一种由边缘战斗节点负责边缘覆盖，核心节点负责中心部署的架构。边缘战斗节点负责用户战斗过程中的实时互动，而核心节点则处理游戏用户认证、登录和充值等功能。

通过使用 Zenlayer 的虚拟机，可以在全球范围内快速部署接近用户侧的边缘战斗节点，并根据用户量和业务规模弹性扩缩。

<img src="/files/0yxKy8okYE0kqVyjd2tD" alt="MOBA 游戏部署示例" class="gitbook-drawing">

## 前提条件

* 在这个示例中，我们将使用 Zenlayer 虚拟机。假设您在公有云 AWS 上部署核心节点，并在香港（HKG）、圣保罗（SAO）和法兰克福（FRA）的 Zenlayer 云上部署战斗节点。
* 部署的基本步骤参见 [**虚拟机创建**](/welcome/cn/virtual-machine/get-started/virtual-machine-instance/create-an-instance.md)。具体配置如下。

## 实例配置

首先，在 [**zenConsole**](https://console.zenlayer.com/) 上创建您的虚拟机。

### **计费模式**

对于长期使用的节点，例如香港战斗节点（HKG），选择性价比高的订阅**计费模式**；对于弹性战斗节点法兰克福（FRA），选择灵活的按需**计费模式**。

<div align="left"><figure><img src="/files/luZoqp3mU5ZFyGeh2pqO" alt="" width="375"><figcaption><p>计费模式</p></figcaption></figure></div>

### 实例型号

为了实现更好的游戏体验，建议选择通用型或高性能型（8 核 vCPU，32 GB 内存）的实例型号。

<div align="left"><figure><img src="/files/JwwFwPWejUMtcxQlndMN" alt=""><figcaption><p>实例型号</p></figcaption></figure></div>

### 实例镜像

选择稳定且游戏友好的镜像。通常，由于其广泛的兼容性和支持，Windows 操作系统是最常用的选择。确保在虚拟机上安装最新的操作系统更新和驱动程序，以确保最佳性能和兼容性。您也可以 [**创建自定义镜像**](/welcome/cn/virtual-machine/get-started/virtual-machine-instance/create-an-image.md)。

<div align="left"><figure><img src="/files/P5XO9UZWNr5ZPV4XOerj" alt=""><figcaption><p>实例镜像</p></figcaption></figure></div>

### 实例存储

建议配置 200 GB 的系统盘。如果需要更多存储空间，可以添加额外的数据盘。

<div align="left"><figure><img src="/files/YreH0nf28alv6gFcSvv2" alt=""><figcaption><p>实例存储</p></figcaption></figure></div>

### 结果

这里我们得到了三台虚拟机。

<div align="left"><figure><img src="/files/fXtpaRfBjdRnH5Lzr1eU" alt=""><figcaption></figcaption></figure></div>

## 网络规划

确保虚拟机与网络之间的稳定连接，并配置适当的网络设置。

如何在公有云上部署游戏，参见 [**AWS 文档**](https://aws.amazon.com/solutions/games/?nc=sn\&loc=1\&dn=ga)。

通过公共网络连接核心节点和战斗节点。您可以配置 [**安全组**](/welcome/cn/virtual-machine/get-started/network-and-security/create-a-security-group.md) 以控制实例的入站和出站流量。这有助于保护虚拟机免受潜在的安全威胁。

## 概要

请注意，设置 MOBA 虚拟机游戏环境的最佳实践可能会因具体游戏和虚拟化环境的不同而有所变化。了解游戏的需求和虚拟化软件的具体设置将有助于您构建一个符合您需求的环境。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/virtual-machine/best-practice/running-a-moba-game-on-virtual-machines.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
