Test run local AMS server using AMS Simulator - Game server integration - (Unity module)
About
For testing your AccelByte Multiplayer Servers (AMS) server locally, AccelByte has provided a simulator called AMS Simulator. This simulator simulates the dedicated server (DS) management and monitoring processes that are done by the Watchdog of AMS. With this AMS Simulator, you are going to validate the AMS implementation without uploading the server build to AMS.
Package Windows dedicated server
To run the game server locally, you need to build the project as Windows dedicated server.
On the new window, select Dedicated Server for the Platform, and choose Windows as the Target Platform. Also, enable the Development Build to display the logs on the server build.
Next, click on the Build button.
On a new pop-up window, name the server build as ByteWars.exe. Then, hit enter on your keyboard to start the build process and wait until it finished.
Test run the dedicated server locally
In this section, you learn how to test your packaged game server locally to check whether it is able to handle the state changes within the lifecycle of AMS.
Log in to the Admin Portal and go to your game namespace dashboard.
Go to Multiplayer Server Configuration > Download Resource. Locate the AMS Simulator for Windows and click the download button to download the amssim.exe file.
Once the download is complete, open Windows PowerShell and run the AMS Simulator executable using the command below.
.\amssim.exe run
Here is the output of AMS Simulator. Notice that it provides an example ID format for your local dedicated server. This example is
ds_018c1f42-5eb6-7ca3-9650-a732ed75ce6a
. Copy it, as you will need it in the next step.AMS simulator url ws://0.0.0.0:5555/watchdog
AMS simulator session id: 01hfaxxvfqhe9gkk2zesfx0b66.
AMS simulator session log path: session\01hfaxxvfqhe9gkk2zesfx0b66.log
Ready to accept local DS
Start the local DS with a valid DS ID that conforms to uuid standards
An example that can be copied and pasted is:
ds_018c1f42-5eb6-7ca3-9650-a732ed75ce6a
==================================Command list=================================================
help show the command list again
info show AMS simulator info
ds
status show status of the ds
ready explicitly set ds into ready state.
claim claim the ds for a game session.
drain drain the ds
exit, quit exit ams simulator
=============================================================================================Run the game server executable using the commands below in Windows PowerShell. Notice that it uses the
ds_018c1f42-5eb6-7ca3-9650-a732ed75ce6a
from the previous step as its local dedicated server ID. Also, adjust the path to point to theByteWars.exe
of your server build..\ByteWars.exe -log -OverrideSDKConfig "{'DsId': 'ds_018c1f42-5eb6-7ca3-9650-a732ed75ce6a'}"
備考- -log is to show game server's log.
- -OverrideSDKConfig is the parameter specifically for Windows server to inject the config parameter, such as the
DsId
. - DsId is the parameter is specifically for Windows Server to define the server identification. You can use the example ID provided by the AMS Simulator. In this case, it is
ds_018c1f42-5eb6-7ca3-9650-a732ed75ce6a
. If the server is hosted on AMS, AMS provides the specific server ID and substitutes it in the command parameter value.
Once your game server runs, the "DS Connected" message appears in your AMS Simulator Windows PowerShell tab to notify you that your local dedicated server has connected to the AMS Simulator.
amssim> DS Connected
Check the dedicated server status using AMS Simulator by executing
ds status
. If the game server successfully registers, it displays the log below. Notice that theDS State
has changed toReady
.ds status
AMS Simulator log:
amssim> ds status
ID: xxxxx
Connected at: 2023-XX-XX 10:00:00
Last Heartbeat: 2023-XX-XX 10:00:00
DS State: ReadyYou can also verify if the game server can handle a drain state by executing
ds drain
. Upon receiving the event, the game server shuts down, and the AMS Simulator displays the log below.ds drain
AMS Simulator log:
amssim> ds status
no connected dedicated serverTo quit AMS Simulator, execute the following command:
quit