Want to set up a mobile game emulator on a Hong Kong server and experience the thrill of cloud gaming? This article will guide you step by step to deploy an Android emulator environment from scratch and enjoy a vast array of mobile games. Whether you are a game developer, tester, or mobile game enthusiast, you can benefit from it.

Choosing the Right Emulator

There are many excellent Android emulators on the market. For server environments, we need to choose an emulator that has:

  • Exceptional performance
  • Low resource usage
  • High stability
  • Support for scripting and automation

After a comprehensive comparison, the author recommends Genymotion. Not only does it meet the above requirements, but it also provides a cloud deployment solution that can be seamlessly integrated with server environments.

Installing Genymotion

First, SSH into your Hong Kong server and download the Linux version of Genymotion. You can find the download link on the official download page.

wget https://dl.genymotion.com/releases/genymotion-3.2.1/genymotion-3.2.1-linux_x64.bin

Grant execute permissions:

chmod +x genymotion-3.2.1-linux_x64.bin

Run the installer and follow the prompts to complete the installation:

./genymotion-3.2.1-linux_x64.bin

After installation, you can find Genymotion in the /opt/genymobile/genymotion/ directory.

Creating a Virtual Device

Use the gmtool command-line tool to create a new Android virtual device:

/opt/genymobile/genymotion/tools/gmtool admin create DeviceName -p "phoneId" -u "androidVersion"

Here, phoneId is the ID of the device model, and androidVersion is the Android system version. You can use the gmtool devices list command to view supported devices and system versions.

For example, to create a Samsung S10 with Android 9.0 virtual device:

/opt/genymobile/genymotion/tools/gmtool admin create Samsung_S10 -p "181a99b0-1d42-4a52-b378-c60ee1f4f4de" -u "9.0"

Starting the Virtual Device

Use the following command to start the virtual device:

/opt/genymobile/genymotion/tools/gmtool admin start DeviceName

The device startup takes some time. You can use the devices list command to check the device status. When the device status becomes ONLINE, it’s ready to use.

/opt/genymobile/genymotion/tools/gmtool devices list

Connecting to the Virtual Device

Genymotion provides the VNC protocol for remote connection to virtual devices. The default VNC port is 5900. You can use any VNC-supported client to connect, and VNC Viewer is recommended.

In VNC Viewer, use the following address to connect to the virtual device:

Server IP:5900

After connecting, you will see the interface of the virtual device. Just like operating a real Android phone, you can install apps, games, simulate various operations, and explore to your heart’s content.

Automation and Scripting

Genymotion virtual devices are fully compatible with Android’s adb tool. By connecting adb to the virtual device’s 5555 port, you can use scripts to automate app installation, perform UI testing, and more.

adb connect Server IP:5555

For example, to install an apk file:

adb install example.apk  

Or to perform UI automation testing (requires pre-installing Appium on the virtual device):

adb shell am instrument -w io.appium.android.apis/.ApiDemos

Combined with CI/CD processes, game testing can be fully automated, significantly improving testing efficiency.

Genymotion also supports controlling virtual devices via APIs, allowing for deep integration with your management platform. Combined with elastic scaling in the cloud, a complete cloud gaming solution can be achieved. Detailed API documentation can be found in the official documentation.

Setting up a mobile game emulator on a Hong Kong server not only allows you to play region-restricted games but also enjoy lower network latency, making it particularly suitable for multiplayer real-time combat games. With just a few simple deployment steps, you have a readily available game testing machine that you can share with friends to catch monsters and fight together!