game network tencent
game network tencent
Development Guide
Product Documentation
Copyright Notice
Copyright in this document is exclusively owned by Tencent Cloud. You must not reproduce, modify,
copy or distribute in any way, in whole or in part, the contents of this document without Tencent
Cloud's the prior written consent.
Trademark Notice
All trademarks associated with Tencent Cloud and its services are owned by Tencent Cloud
Computing (Beijing) Company Limited and its affiliated companies. Trademarks of third parties
referred to in this document are owned by their respective proprietors.
Service Statement
This document is intended to provide users with general information about Tencent Cloud's products
and services only and does not form part of Tencent Cloud's terms and conditions. Tencent Cloud's
products or services are subject to change. Specific products and services and the standards
applicable to them are exclusively provided for in Tencent Cloud's applicable terms and conditions.
Contents
Development Guide
Overall Process
Integrating Server with gRPC Framework
gRPC C++ Tutorial
gRPC C# Tutorial
gRPC Go Tutorial
gRPC Java Tutorial
gRPC Lua Tutorial
gRPC Node.js Tutorial
gRPC Unity Tutorial
Getting Server Address
TencentCloud API Calling Method
Creating Game Server Session
Placing Game Server Session
GSE Local
Latency Test Tool
Game Process Launch Configuration
Development Guide
Overall Process
Last updated:2020-09-08 15:27:29
Overall Flowchart
Integration Steps
For more information on how to call TencentCloud APIs, please see Creating Game Server Session.
For more information on how to call the TencentCloud APIs, please see Placing Game Server Session.
Workflow
Installing gRPC
1. Prerequisites: install CMake.
Linux
MAC OS
Note
For more information on the installation process, see Installing CMake, Installing gRPC C++,
and Installing Protocol Buffers.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be called
remotely by using parameters and return types.
Note
We provide the .proto files for service definition. You can directly download them with no need
to generate them by yourself.
Others
When the game process uses gRPC to call a game server active API, you need to add two fields to
meta of the gRPC request.
1. Generally, after the server is initialized, the process will check itself to see whether it can provide
services, and the game server will call the ProcessReady API to notify GSE that the process is
ready to host a game server session. After receiving the notification, GSE will change the status of
the server instance to "Active".
ClientContext context;
AddMetadata(context);
2. After the process is ready, GSE will call the OnHealthCheck API to perform a health check on the
game server every minute. If the health check fails three consecutive times, the process will be
considered to be unhealthy, and no game server sessions will be assigned to it.
3. Because the client calls the CreateGameServerSession API to create a game server session and
assigns it to a process, GSE will be triggered to call the onStartGameServerSession API for the
process and change the status of GameServerSession to "Activating".
return Status::OK;
}
4. After the game server receives onStartGameServerSession , you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the
ActivateGameServerSession API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
ClientContext context;
AddMetadata(context);
5. After the client calls the JoinGameServerSession API for the player to join, the game server will call
the AcceptPlayerSession API to verify the validity of the player. If the connection is accepted, the
status of PlayerSession will be set to "Active". If the client receives no response within 60
seconds after calling the JoinGameServerSession API, it will change the status of PlayerSession to
"Timeout" and then call JoinGameServerSession again.
6. After the game ends or the player exits, the game server will call the RemovePlayerSession API to
remove the player, change the status of playersession to "Completed", and reserve the player slot
in the game server session.
7. After a game server session (a game battle or a service) ends, the game server will call the
TerminateGameServerSession API to end the GameServerSession and change its status to
Terminated .
8. In case of health check failure or reduction, GSE will call the OnProcessTerminate API to end the
game process. The reduction will be triggered according to the protection policy configured in the
GSE console.
return Status::OK;
}
9. The game server calls the ProcessEnding API to end the process immediately, change the server
process status to "Terminated", and repossess the resources.
// Active call: a game battle corresponds to a process. The `ProcessEnding` API will be active
ly called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the `Proces
sEnding` API will be called passively according to the protection policy. If a full protection
or time-period protection policy is configured, it is required to determine whether there are
any players in the game server session before the passive call can be made
Status GseManager::ProcessEnding(GseResponse& reply)
{
GConsoleLog->PrintOut(true, "start to ProcessEnding\n");
ProcessEndingRequest request;
ClientContext context;
AddMetadata(context);
10. The game server calls the DescribePlayerSessions API to get the information of the player in the
game server session (which is optional based on your actual business needs).
1. The game server calls the UpdatePlayerSessionCreationPolicy API to update the player session
creation policy and set whether to accept new players, i.e., whether to allow new players to join a
game session (which is optional based on your actual business needs).
12. The game server calls the ReportCustomData API to notify GSE of the custom data that can be
viewed during game server session query (which is optional based on your actual business needs).
ClientContext context;
AddMetadata(context);
void GseManager::InitStub()
{
auto channel = grpc::CreateChannel("127.0.0.1:5758", grpc::InsecureChannelCredentials());
stub_ = GseGrpcSdkService::NewStub(channel);
}
mkdir build
cmake ..
make
iv. Package the cpp-demo executable file as an asset package and configure the launch path as
cpp-demo with no launch parameter needed.
v. Create a server fleet and deploy the asset package on it. After that, you can perform various
operations such as scaling.
gRPC C# Tutorial
Last updated:2021-11-17 18:06:09
Installing gRPC
1. To use gRPC C#, you need to install .Net Core 3.1 SDK first. Taking CentOS as an example, the
version must be v7, v8 or above.
Add the signature key
2. In addition, you can also use gRPC C# in the following runtime environments/IDEs:
Windows: .NET Framework 4.5 or higher, Visual Studio 2013 or higher, Visual Studio Code.
Linux: Mono 4 or higher, Visual Studio Code.
macOS X: Mono 4 or higher, Visual Studio Code, Visual Studio for Mac.
Note
For more information on the installation process, please see Installing gRPC C#.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be called
remotely by using parameters and return types.
Note:
We provide the .proto files for service definition. You can click here to directly download them
with no need to generate them by yourself.
1. After defining the service, you can use protoc (protocol buffer compiler) to generate the client and
server code (in any language supported by gRPC).
2. The generated code includes the client stub and the abstract APIs to be implemented by the
server.
3. Steps for generating gRPC code:
Download the code. In the csharp-demo directory, run
dotnet run
Others
When the game process uses gRPC to call a game server active API, you need to add two fields to
meta of the gRPC request.
1. Generally, after the server is initialized, the process will check itself to see whether it can provide
services, and the game server will call the ProcessReady API to notify GSE that the process is
ready to host a game server session. After receiving the notification, GSE will change the status of
the server instance to "Active".
// Log path
req.LogPathsToUpload.Add(logPath); // After being parsed by `pb`, the `repeated` type is read-
only and needs to be added by running `Add`
// Ready to provide services
return GrpcClient.GseClient.ProcessReady(req, meta);
}
2. After the process is ready, GSE will call the OnHealthCheck API to perform a health check on the
game server every minute. If the health check fails three consecutive times, the process will be
considered to be unhealthy, and no game server sessions will be assigned to it.
3. Because the client calls the CreateGameServerSession API to create a game server session and
assigns it to a process, GSE will be triggered to call the onStartGameServerSession API for the
process and change the status of GameServerSession to "Activating".
4. After the game server receives onStartGameServerSession , you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the
ActivateGameServerSession API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
{
logger.Println($"Activating game server session, GameServerSessionId: {gameServerSessionId}, M
axPlayers: {maxPlayers}");
var req = new ActivateGameServerSessionRequest{
GameServerSessionId = gameServerSessionId,
MaxPlayers = maxPlayers,
};
return GrpcClient.GseClient.ActivateGameServerSession(req, meta);
}
5. After the client calls the JoinGameServerSession API for the player to join, the game server will call
the AcceptPlayerSession API to verify the validity of the player. If the connection is accepted, the
status of PlayerSession will be set to "Active". If the client receives no response within 60
seconds after calling the JoinGameServerSession API, it will change the status of PlayerSession to
"Timeout" and then call JoinGameServerSession again.
6. After the game ends or the player exits, the game server will call the RemovePlayerSession API to
remove the player, change the status of playersession to "Completed", and reserve the player
slot in the game server session.
7. After a game server session (a game battle or a service) ends, the game server will call the
TerminateGameServerSession API to end the GameServerSession and change its status to
Terminated .
8. In case of health check failure or reduction, GSE will call the OnProcessTerminate API to end the
game process. The reduction will be triggered according to the protection policy configured in the
GSE console.
9. The game server calls the ProcessEnding API to end the process immediately, change the server
process status to "Terminated", and repossess the resources.
// Active call: a game battle corresponds to a process. The `ProcessEnding` API will be active
ly called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the `Proces
sEnding` API will be called passively according to the protection policy. If a full protection
or time-period protection policy is configured, it is required to determine whether there are
any players in the game server session before the passive call can be made
public static GseResponse ProcessEnding()
{
logger.Println($"Process ending, pid: {pid}");
var req = new ProcessEndingRequest();
return GrpcClient.GseClient.ProcessEnding(req, meta);
}
0. The game server calls the DescribePlayerSessions API to get the information of the player in the
game server session (which is optional based on your actual business needs).
1. The game server calls the UpdatePlayerSessionCreationPolicy API to update the player session
creation policy and set whether to accept new players, i.e., whether to allow new players to join a
game session (which is optional based on your actual business needs).
NewPlayerSessionCreationPolicy = newPolicy,
};
return GrpcClient.GseClient.UpdatePlayerSessionCreationPolicy(req, meta);
}
2. The game server calls the ReportCustomData API to notify GSE of the custom data (which is
optional based on your actual business needs).
// HTTP port
options.ListenAnyIP(ClientPort);
});
webBuilder.UseStartup<startup>();
});
}
Demo for C#
1. Click here to download the code of the Demo for C#.
2. Generate the gRPC code.
As the gRPC code has already been generated in the proto/csharp-demo directory of the Demo for
C#, you do not need to generate it again.
3. Launch the server for GSE to call.
The above operation will generate all the dependent files needed to generate and package the
asset package in the csharp-demo/bin/Release/netcoreapp3.1/linux-x64 directory, which contains
the executable file csharpdemo used to run the service.
Copy the pre-request script install.sh
cd csharp-demo/bin/Release/netcoreapp3.1/linux-x64
zip -r csharpdemo.zip *
The packaged csharpdemo.zip is the asset package needed by GSE. Configure the launch path
as csharpdemo with no launch parameter needed.
Create a server fleet and deploy the asset package on it. After that, you can perform various
operations such as scaling.
gRPC Go Tutorial
Last updated:2021-11-17 18:06:09
Installing gRPC
1. To use gRPC Go, you need to install the latest major release of Go first.
2. Install the protocol buffer compiler protoc3.
3. Install the Go plugin in the protocol buffer compiler.
Run the following command to install the protocol buffer compiler plugin for Go (protoc-gen-go):
Update the path so that the protocol buffer compiler can find the Go plugin:
Note
For more information on the installation process, see Installing Go and Installing Protocol Buffer
Compiler.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be called
remotely by using parameters and return types.
Note
We provide the .proto files for service definition. You can click here to directly download them
with no need to generate them by yourself.
1. After defining the service, you can use protoc (protocol buffer compiler) to generate the client and
server code (in any language supported by gRPC).
2. The generated code includes the client stub and the abstract APIs to be implemented by the
server.
to automatically generate the go_package path that contains proto. You can modify the
go_package path as needed but not the package.
m data |
#### Others
When the game process uses gRPC to call a game server active API, you need to add two fields t
o `meta` of the gRPC request.
| Field | Description | Type |
| --------- | ----------------------------------------- | ------ |
| pid | `pid` of the current game process | string |
| requestId | `requestId` of the current request, which is used to uniquely identify a request
| string |
1. Generally, after the server is initialized, the process will check itself to see whether it
can provide services, and the game server will call the `ProcessReady` API to notify GSE that
the process is ready to host a game server session. After receiving the notification, GSE will
change the status of the server instance to "Active".
Go
zap.Int32("grpcPort", grpcPort))
req := &grpcsdk.ProcessReadyRequest{
// Log path
LogPathsToUpload: logPath,
// Set the ports
ClientPort: clientPort,
GrpcPort: grpcPort,
return nil
}
2. After the process is ready, GSE will call the `OnHealthCheck` API to perform a health check
on the game server every minute. If the health check fails three consecutive times, the proces
s will be considered to be unhealthy, and no game server sessions will be assigned to it.
Go
}
if interceptor == nil {
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tencentcloud.gse.grpcsdk.GameServerGrpcSdkService/OnHealthCheck",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
}
return interceptor(ctx, in, info, handler)
}
ill be triggered to call the `onStartGameServerSession` API for the process and change the sta
tus of `GameServerSession` to "Activating".
Go
}
if interceptor == nil {
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tencentcloud.gse.grpcsdk.GameServerGrpcSdkService/OnStartGameServerSession",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
}
return interceptor(ctx, in, info, handler)
}
4. After the game server receives `onStartGameServerSession`, you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the `Act
ivateGameServerSession` API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
Go
zap.Int32("maxPlayers", maxPlayers))
req := &grpcsdk.ActivateGameServerSessionRequest{
GameServerSessionId: gameServerSessionId,
MaxPlayers: maxPlayers,
logger.Info("ActivateGameServerSession success")
return nil
}
GameServerSessionId: g.gameServerSession.GameServerSessionId,
PlayerSessionId: playerSessionId,
6. After the game ends or the player exits, the game server will call the `RemovePlayerSession
` API to remove the player, change the status of `playersession` to "Completed", and reserve t
he player slot in the game server session.
Go
GameServerSessionId: g.gameServerSession.GameServerSessionId,
PlayerSessionId: playerSessionId,
7. After a game server session (a game battle or a service) ends, the game server will call th
e `TerminateGameServerSession` API to end the `GameServerSession` and change its status to `Te
rminated`.
Go
GameServerSessionId: g.gameServerSession.GameServerSessionId,
8. In case of health check failure or reduction, GSE will call the `OnProcessTerminate` API to
end the game process. The reduction will be triggered according to the [protection policy](htt
ps://intl.cloud.tencent.com/document/product/1055/36675) configured in the GSE console.
Go
}
if interceptor == nil {
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/tencentcloud.gse.grpcsdk.GameServerGrpcSdkService/OnProcessTerminate",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
}
return interceptor(ctx, in, info, handler)
9. The game server calls the `ProcessEnding` API to end the process immediately, change the se
rver process status to "Terminated", and repossess the resources.
Go
// Active call: a game battle corresponds to a process. The ProcessEnding API will be actively
called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the ProcessEnding
API will be called passively according to the protection policy. If a full protection or time-period
protection policy is configured, it is required to determine whether there are any players in the
game server session before the passive call can be made
func (g gsemanager) ProcessEnding() (grpcsdk.GseResponse, error) {
logger.Info("start to ProcessEnding")
req := &grpcsdk.ProcessEndingRequest{
}
10. The game server calls the `DescribePlayerSessions` API to get the information of the playe
r in the game server session (which is optional based on your actual business needs).
Go
req := &grpcsdk.DescribePlayerSessionsRequest{
GameServerSessionId: gameServerSessionId,
PlayerId: playerId,
PlayerSessionId: playerSessionId,
PlayerSessionStatusFilter: playerSessionStatusFilter,
NextToken: nextToken,
Limit: limit,
11. The game server calls the `UpdatePlayerSessionCreationPolicy` API to update the player ses
sion creation policy and set whether to accept new players, i.e., whether to allow new players
to join a game session (which is optional based on your actual business needs).
Go
GameServerSessionId: g.gameServerSession.GameServerSessionId,
NewPlayerSessionCreationPolicy: newPolicy,
12. The game server calls the `ReportCustomData` API to notify GSE of the custom data (which i
s optional based on your actual business needs).
Go
zap.Int32("maxCustomCount", maxCustomCount))
req := &grpcsdk.ReportCustomDataRequest{
CurrentCustomCount: currentCustomCount,
MaxCustomCount: maxCustomCount,
Go
addr := listen.Addr().String()
portStr := strings.Split(addr, ":")[1]
s.grpcPort, err = strconv.Atoi(portStr)
if err != nil {
grpcServer := grpc.NewServer()
grpcsdk.RegisterGameServerGrpcSdkServiceServer(grpcServer, s)
logger.Info("start grpc server success")
go grpcServer.Serve(listen)
}
Go
const (
localhost = "127.0.0.1"
agentPort = 5758
)
type gsemanager struct {
pid string
gameServerSession *grpcsdk.GameServerSession
terminationTime int64
rpcClient grpcsdk.GseGrpcSdkServiceClient
## Demo for Go
1. [Click here](https://gsegrpcdemo-1301007756.cos.ap-guangzhou.myqcloud.com/go-demo.zip) to d
ownload the code of the Demo for Go.
2. Generate the gRPC code.
As the gRPC code has already been generated in the `go-demo/grpcsdk` directory of the Demo for
Go, you do not need to generate it again.
3. Launch the server for GSE to call.
- Implement the server.
`grpcserver.go` in the `go-demo/api` directory implements three server APIs.
- Run the server.
`grpcserver.go` in the `go-demo/api` directory launches `GrpcServer`.
4. Connect the client to the gRPC server of GSE.
- Implement the client.
`gsemanager.go` in the `go-demo/gsemanager` directory implements nine client APIs.
- Connect to the server.
Create a gRPC channel, specify the host name and server port to connect to, and use this chann
el to create a stub instance.
5. Compile and run the project.
1. In the `go-demo` directory, run
go mod vendor
Installing gRPC
1. gRPC Java does not require other tools except JDK.
2. Install the gRPC Java SNAPSHOT library locally, including the code generation plugin.
Note:
For more information on the installation process, please see Installing gRPC Java.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be
called remotely by using parameters and return types.
Note
We provide the .proto files for service definition. You can click here to directly download them
with no need to generate them by yourself.
sh gen_pb.sh
Method 2. Use the Maven tool to generate gRPC code by adding a Maven plugin for compiling
gRPC code to Maven. For more information, please see here.
<build>
<extensions>
<extension>
<groupid>kr.motd.maven</groupid>
<artifactid>os-maven-plugin</artifactid>
<version>1.6.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupid>org.xolstice.maven.plugins</groupid>
<artifactid>protobuf-maven-plugin</artifactid>
<version>0.6.1</version>
<configuration>
<protocartifact>com.google.protobuf:protoc:3.12.0:exe:${os.detected.classifier}</protocartif
act>
<pluginid>grpc-java</pluginid>
<pluginartifact>io.grpc:protoc-gen-grpc-java:1.30.2:exe:${os.detected.classifier}</pluginart
ifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Others
When the game process uses gRPC to call a game server active API, you need to add two fields to
meta of the gRPC request.
1. Generally, after the server is initialized, the process will check itself to see whether it can provide
services, and the game server will call the ProcessReady API to notify GSE that the process is
ready to host a game server session. After receiving the notification, GSE will change the status of
the server instance to "Active".
.addAllLogPathsToUpload(request.getLogPathsToUploadList()).build();
GseGrpcSdkServiceOuterClass.GseResponse rpcResponse;
try {
rpcResponse = getGseGrpcSdkServiceClient().processReady(rpcRequest);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
return createRpcFailedResponseBo(e.getStatus());
}
// Ready to provide services.
logger.info("processReady response=" + rpcResponse.toString());
return createResponseBoByRpcResponse(rpcResponse);
}
2. After the process is ready, GSE will call the OnHealthCheck API to perform a health check on the
game server every minute. If the health check fails three consecutive times, the process will be
considered to be unhealthy, and no game server sessions will be assigned to it.
3. Because the client calls the CreateGameServerSession API to create a game server session and
assigns it to a process, GSE will be triggered to call the onStartGameServerSession API for the
process and change the status of GameServerSession to "Activating".
4. After the game server receives onStartGameServerSession , you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the
ActivateGameServerSession API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
5. After the client calls the JoinGameServerSession API for the player to join, the game server will call
the AcceptPlayerSession API to verify the validity of the player. If the connection is accepted, the
status of PlayerSession will be set to "Active". If the client receives no response within 60
seconds after calling the JoinGameServerSession API, it will change the status of PlayerSession to
"Timeout" and then call JoinGameServerSession again.
.newBuilder().setGameServerSessionId(gameServerSessionBo.getGameServerSessionId())
.setPlayerSessionId(request.getPlayerSessionId()).build();
GseGrpcSdkServiceOuterClass.GseResponse rpcResponse;
try {
rpcResponse = getGseGrpcSdkServiceClient().acceptPlayerSession(rpcRequest);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
return createRpcFailedResponseBo(e.getStatus());
}
logger.info("acceptPlayerSession response=" + rpcResponse.toString());
return createResponseBoByRpcResponse(rpcResponse);
}
6. After the game ends or the player exits, the game server will call the RemovePlayerSession API to
remove the player, change the status of playersession to "Completed", and reserve the player
slot in the game server session.
7. After a game server session (a game battle or a service) ends, the game server will call the
TerminateGameServerSession API to end the GameServerSession and change its status to
Terminated .
8. In case of health check failure or reduction, GSE will call the OnProcessTerminate API to end the
game process. The reduction will be triggered according to the protection policy configured in the
GSE console.
9. The game server calls the ProcessEnding API to end the process immediately, change the server
process status to "Terminated", and repossess the resources.
// Active call: a game battle corresponds to a process. The `ProcessEnding` API will be active
ly called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the `Proces
sEnding` API will be called passively according to the protection policy. If a full protection
or time-period protection policy is configured, it is required to determine whether there are
any players in the game server session before the passive call can be made
public GseResponseBo processEnding() {
logger.info("processEnding begin");
GseResponseBo responseBo = new GseResponseBo();
GseGrpcSdkServiceOuterClass.ProcessEndingRequest rpcRequest = GseGrpcSdkServiceOuterClass.Proc
essEndingRequest
.newBuilder().build();
GseGrpcSdkServiceOuterClass.GseResponse rpcResponse;
try {
rpcResponse = getGseGrpcSdkServiceClient().processEnding(rpcRequest);
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
return createRpcFailedResponseBo(e.getStatus());
}
logger.info("processEnding response=" + rpcResponse.toString());
return createResponseBoByRpcResponse(rpcResponse);
}
0. The game server calls the DescribePlayerSessions API to get the information of the player in the
game server session (which is optional based on your actual business needs).
return toPlayerSessionsResponseBo(rpcResponse);
}
1. The game server calls the UpdatePlayerSessionCreationPolicy API to update the player session
creation policy and set whether to accept new players, i.e., whether to allow new players to join a
game session (which is optional based on your actual business needs).
2. The game server calls the ReportCustomData API to notify GSE of the custom data (which is
optional based on your actual business needs).
} catch (StatusRuntimeException e) {
logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
return createRpcFailedResponseBo(e.getStatus());
}
logger.info("reportCustomData response=" + rpcResponse.toString());
return createResponseBoByRpcResponse(rpcResponse);
}
}
return blockingStub;
}
Download the code, use Maven to build and generate gse-gameserver-demo.jar in the java-
demo directory, and run the following command to launch it:
Package the executable file gse-gameserver-demo.jar as an asset package and configure the
launch path as java and the launch parameter as jar gse-gameserver-demo.jar .
Create a server fleet and deploy the asset package on it. After that, you can perform various
operations such as scaling.
Installing gRPC
1. Install gRPC. The installation will generate an executable program grpc_cpp_plugin , which will be
needed for generating gRPC code.
2. Install protocol buffers.
Note
For more information on the installation process, see Installing gRPC Lua and Installing Protocol
Buffers.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be called
remotely by using parameters and return types.
Note
We provide the .proto files for service definition. You can click here to directly download them
with no need to generate them by yourself.
Others
When the game process uses gRPC to call a game server active API, you need to add two fields to
meta of the gRPC request.
1. Generally, after the server is initialized, the process will check itself to see whether it can provide
services, and the game server will call the ProcessReady API to notify GSE that the process is
ready to host a game server session. After receiving the notification, GSE will change the status of
the server instance to "Active".
}
return true;
}
2. After the process is ready, GSE will call the OnHealthCheck API to perform a health check on the
game server every minute. If the health check fails three consecutive times, the process will be
considered to be unhealthy, and no game server sessions will be assigned to it.
3. Because the client calls the CreateGameServerSession API to create a game server session and
assigns it to a process, GSE will be triggered to call the onStartGameServerSession API for the
process and change the status of GameServerSession to "Activating".
4. After the game server receives onStartGameServerSession , you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the
ActivateGameServerSession API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
GseResponse reply;
Status status = GGseManager->ActivateGameServerSession(gameServerSessionId, maxPlayers, repl
y);
GSESDK()->setReplyStatus(status);
if (!status.ok()) {
return false;
}
return true;
}
5. After the client calls the JoinGameServerSession API for the player to join, the game server will call
the AcceptPlayerSession API to verify the validity of the player. If the connection is accepted, the
status of PlayerSession will be set to "Active". If the client receives no response within 60
seconds after calling the JoinGameServerSession API, it will change the status of PlayerSession to
"Timeout" and then call JoinGameServerSession again.
6. After the game ends or the player exits, the game server will call the RemovePlayerSession API to
remove the player, change the status of playersession to "Completed", and reserve the player
slot in the game server session.
7. After a game server session (a game battle or a service) ends, the game server will call the
TerminateGameServerSession API to end the GameServerSession and change its status to
Terminated .
8. In case of health check failure or reduction, GSE will call the OnProcessTerminate API to end the
game process. The reduction will be triggered according to the protection policy configured in the
GSE console.
9. The game server calls the ProcessEnding API to end the process immediately, change the server
process status to "Terminated", and repossess the resources.
// Active call: a game battle corresponds to a process. The `ProcessEnding` API will be active
ly called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the `Proces
sEnding` API will be called passively according to the protection policy. If a full protection
or time-period protection policy is configured, it is required to determine whether there are
any players in the game server session before the passive call can be made
static bool luaProcessEnding() {
GseResponse reply;
Status status = GGseManager->ProcessEnding(reply);
GSESDK()->setReplyStatus(status);
if (!status.ok()) {
return false;
}
return true;
}
0. The game server calls the DescribePlayerSessions API to get the information of the player in the
game server session (which is optional based on your actual business needs).
1. The game server calls the UpdatePlayerSessionCreationPolicy API to update the player session
creation policy and set whether to accept new players, i.e., whether to allow new players to join a
game session (which is optional based on your actual business needs).
2. The game server calls the ReportCustomData API to notify GSE of the custom data (which is
optional based on your actual business needs).
void GseManager::InitStub() {
auto channel = grpc::CreateChannel("127.0.0.1:5758", grpc::InsecureChannelCredentials());
stub_ = GseGrpcSdkService::NewStub(channel);
}
Download the code and run the following command in the lua-demo directory:
mkdir build
cd build
cmake ..
make
cp ../source/lua/gse.lua .
The corresponding lua-demo executable file will be generated. Run ./lua-demo to launch it.
Package the executable file lua-demo.cpp as an asset package and configure the launch path
as lua-demo with no launch parameter needed.
Create a server fleet and deploy the asset package on it. After that, you can perform various
operations such as scaling.
Installing gRPC
1. Install gRPC. The installation will generate an executable program grpc_cpp_plugin , which will be
needed for generating gRPC code.
2. Install protocol buffers.
Note
For more information on the installation process, see Installing gRPC Lua and Installing Protocol
Buffers.
Defining Service
gRPC uses Protocol Buffers to define a service: an RPC service specifies methods that can be called
remotely by using parameters and return types.
Note
We provide the .proto files for service definition. You can click here to directly download them
with no need to generate them by yourself.
1. After defining the service, you can use protoc (protocol buffer compiler) to generate the client and
server code (in any language supported by gRPC).
2. The generated code includes the client stub and the abstract APIs to be implemented by the
server.
i. The Demo for Lua relies on the C++ framework. Just like with the Demo for C++, in the proto
directory, run:
iv. Move the eight generated files to an appropriate location in the project.
Others
When the game process uses gRPC to call a game server active API, you need to add two fields to
meta of the gRPC request.
1. Generally, after the server is initialized, the process will check itself to see whether it can provide
services, and the game server will call the ProcessReady API to notify GSE that the process is
ready to host a game server session. After receiving the notification, GSE will change the status of
the server instance to "Active".
}
return true;
}
2. After the process is ready, GSE will call the OnHealthCheck API to perform a health check on the
game server every minute. If the health check fails three consecutive times, the process will be
considered to be unhealthy, and no game server sessions will be assigned to it.
3. Because the client calls the CreateGameServerSession API to create a game server session and
assigns it to a process, GSE will be triggered to call the onStartGameServerSession API for the
process and change the status of GameServerSession to "Activating".
4. After the game server receives onStartGameServerSession , you need to handle the logic or
resource allocation by yourself. After everything is ready, the game server will call the
ActivateGameServerSession API to notify GSE that the game server session has been assigned to a
process and is ready to receive player requests and will change the server status to "Active".
GseResponse reply;
Status status = GGseManager->ActivateGameServerSession(gameServerSessionId, maxPlayers, repl
y);
GSESDK()->setReplyStatus(status);
if (!status.ok()) {
return false;
}
return true;
}
5. After the client calls the JoinGameServerSession API for the player to join, the game server will call
the AcceptPlayerSession API to verify the validity of the player. If the connection is accepted, the
status of PlayerSession will be set to "Active". If the client receives no response within 60
seconds after calling the JoinGameServerSession API, it will change the status of PlayerSession to
"Timeout" and then call JoinGameServerSession again.
6. After the game ends or the player exits, the game server will call the RemovePlayerSession API to
remove the player, change the status of playersession to "Completed", and reserve the player
slot in the game server session.
7. After a game server session (a game battle or a service) ends, the game server will call the
TerminateGameServerSession API to end the GameServerSession and change its status to
Terminated .
8. In case of health check failure or reduction, GSE will call the OnProcessTerminate API to end the
game process. The reduction will be triggered according to the protection policy configured in the
GSE console.
9. The game server calls the ProcessEnding API to end the process immediately, change the server
process status to "Terminated", and repossess the resources.
// Active call: a game battle corresponds to a process. The `ProcessEnding` API will be active
ly called after the game battle ends
// Passive call: in case of reduction, process exception, or health check failure, the `Proces
sEnding` API will be called passively according to the protection policy. If a full protection
or time-period protection policy is configured, it is required to determine whether there are
any players in the game server session before the passive call can be made
static bool luaProcessEnding() {
GseResponse reply;
Status status = GGseManager->ProcessEnding(reply);
GSESDK()->setReplyStatus(status);
if (!status.ok()) {
return false;
}
return true;
}
0. The game server calls the DescribePlayerSessions API to get the information of the player in the
game server session (which is optional based on your actual business needs).
1. The game server calls the UpdatePlayerSessionCreationPolicy API to update the player session
creation policy and set whether to accept new players, i.e., whether to allow new players to join a
game session (which is optional based on your actual business needs).
2. The game server calls the ReportCustomData API to notify GSE of the custom data (which is
optional based on your actual business needs).
void GseManager::InitStub() {
auto channel = grpc::CreateChannel("127.0.0.1:5758", grpc::InsecureChannelCredentials());
stub_ = GseGrpcSdkService::NewStub(channel);
}
Download the code and run the following command in the lua-demo directory:
mkdir build
cd build
cmake ..
make
cp ../source/lua/gse.lua .
The corresponding lua-demo executable file will be generated. Run ./lua-demo to launch it.
Package the executable file lua-demo.cpp as an asset package and configure the launch path
as lua-demo with no launch parameter needed.
Create a server fleet and deploy the asset package on it. After that, you can perform various
operations such as scaling.
This document describes how to integrate Unity with GSE SDK. The overall process mainly consists of
two tasks:
Prerequisites
You have already installed Unity Hub and Unity IDE.
Note:
This document uses 2018.3.5f1 or 2019.4.9f1 Unity engine and MacOS as an example.
Because gRPC APIs are only available for .NET 4.5+ , it is necessary to create a Unity project
equivalent to .NET 4.x at Edit > Project Setting > Player > Configuration > Scripting
Runtime Version.
Unity Editor will fetch files and automatically add them to the project for your use of gRPC and
Protobuf in codes. If Unity Editor prompts an error, see FAQs for troubleshooting.
1. Access the grpc_unity_package.VERSION.zip page again to download the gRPC protoc Plugin
package compatible with your operating system.
2. Decompress the package to obtain the protoc and grpc_csharp_plugin executable programs.
3. Copy protoc and grpc_csharp_plugin executable programs to the same directory as the Protobuf
file. Run the following two commands according to the operating system to generate C# codes:
Four .cs code files are generated as shown in the following figure.
Copy the four .cs files generated in the Step 2 to the Unity project (to a separate folder under the
Assets/Scripts/ directory) and use GSE SDK for the development. For more information, see Unity
DEMO.
{
return new Logs();
}
}
// Health checks
public override Task<HealthCheckResponse> OnHealthCheck(HealthCheckRequest request, ServerCall
Context context)
{
logger.Println($"OnHealthCheck, HealthStatus: {GseManager.HealthStatus}");
logger.Println($"OnHealthCheck, GameServerSession: {GseManager.GetGameServerSession()}");
return Task.FromResult(new HealthCheckResponse
{
HealthStatus = GseManager.HealthStatus
});
}
// Receive game sessions
public override Task<GseResponse> OnStartGameServerSession(StartGameServerSessionRequest reque
st, ServerCallContext context)
{
logger.Println($"OnStartGameServerSession, request: {request}");
GseManager.SetGameServerSession(request.GameServerSession);
var resp = GseManager.ActivateGameServerSession(request.GameServerSession.GameServerSessionId,
request.GameServerSession.MaxPlayers);
logger.Println($"OnStartGameServerSession, resp: {resp}");
return Task.FromResult(resp);
}
// End the game process
public override Task<GseResponse> OnProcessTerminate(ProcessTerminateRequest request, ServerCa
llContext context)
{
logger.Println($"OnProcessTerminate, request: {request}");
// Set the process termination time
GseManager.SetTerminationTime(request.TerminationTime);
// Terminate game server sessions
GseManager.TerminateGameServerSession();
// Exit the process
GseManager.ProcessEnding();
return Task.FromResult(new GseResponse());
}
}
}
}
Unity DEMO
1. Click here to download the code of the Demo for Unity.
2. Import grpc unity package.
Decompress grpc_unity_package in the Step 2 to the unity-demo/Assets directory of the Demo
project.
3. Generate C# codes based on the Protobuf file.
4. Launch the server for GSE to call.
Implement the server: implement the three server APIs in the GrpcServer.cs file under the
unity-demo/Assets/Scripts/Api directory.
Run the server: create gRPC Server and StartServers.cs in the MyGrpcServer.cs file under the
unity-demo/Assets/Scripts directory to launch gRPC Server .
5. Connect the client to the gRPC server of GSE.
Implement the client: implement the nine client APIs in the Gsemanager.cs file under the unity-
demo/Assets/Scripts/Gsemanager directory.
Connect to the server: create a gRPC channel, specify the host name and server port to connect
to, and use this channel to create a stub instance.
6. Compile and run the program
Use Unity Editor to encapsulate the executable program of the target system into an asset
package, and configure the actual name of the executable program at the launch path.
A client API is provided as a TencentCloud API and can be called in the following ways:
1. SDK Call
You can use Tencent Cloud Software Development Kit (SDK) v3.0 to call a client TencentCloud API.
The SDK supports various programming languages such as PHP, Python, Java, Go, .NET, Node.js, and
C++.
Note:
Currently, GSE supports SDK v3.0. For detailed directions, please see the SDK overview.
2. Online Debugging
You can use API Explorer to call a client TencentCloud API. This tool provides various capabilities such
as online call, signature verification, SDK code generation, and quick API search.
Note:
In API 3.0 Explorer, select "GSE" and then select a TencentCloud API under "Console APIs" or
"Service Management APIs" for online debugging.
3. Direct Encapsulation
You can use the HTTP request method of a domain name or an API name to call a client TencentCloud
API.
Note:
TencentCloud APIs of GSE have been upgraded to v3.0. For detailed directions, please see
TencentCloud API calling methods.
Overview
You can use a client TencentCloud API to create a game server session in the following two ways:
Create in a server fleet to implement auto scaling and health check.
Create through an alias to implement zero downtime update.
One game server session is placed in one server process, but the client API calling process varies
by supporting mode of the game server session.
If one game server session supports only one game, you can call a client API in the following steps:
1. Create a game server session through a server fleet or alias. For detailed directions, please see
the API document CreateGameServerSession.
Note:
The following sample code is based on Java:
System.out.println(CreateGameServerSessionRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
2. Join the created game server session. For detailed directions, please see the API document
JoinGameServerSession.
System.out.println(JoinGameServerSessionRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
1. Query the game server session list to check whether there is any game server session. For
detailed directions, please see the API document DescribeGameServerSessions.
System.out.println(DescribeGameServerSessionsRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
You can also search for existing sessions in the game server session list. For detailed directions,
please see the API document SearchGameServerSessions.
System.out.println(SearchGameServerSessionsRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
2. If a game server session exists, you can directly join it. For detailed directions, please see the API
document JoinGameServerSession or the sample code in this document.
3. If no game server sessions exist, you need to create one first. For detailed directions, please see
the API document CreateGameServerSession or the sample code in this document. Then, join the
created session. For detailed directions, please see the API document JoinGameServerSession or
the sample code in this document.
Note:
You can use API 3.0 Explorer for online debugging. You can select TencentCloud APIs under
"Game Server Engine" > "Service Management APIs" on the left sidebar and perform
operations such as "Code Generation" and "Online Call".
Overview
You can use a client TencentCloud API to place a game server session, that is, you can implement
nearby resource scheduling and cross-region disaster recovery through a game server queue.
Note:
The following sample code is based on Java:
System.out.println(DescribeGameServerSessionPlacementRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
2. Start placing the game server session. For detailed directions, please see the API document
StartGameServerSessionPlacement.
System.out.println(StartGameServerSessionPlacementRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
3. Stop placing the game server session. For detailed directions, please see the API document
StopGameServerSessionPlacement.
System.out.println(StopGameServerSessionPlacementRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
Note:
You can use API 3.0 Explorer for online debugging. You can select TencentCloud APIs under
"Game Server Elastic-scaling" > "Service Management APIs" on the left sidebar, and perform
operations such as "Code Generation" and "Online Call".
GSE Local
Last updated:2021-06-28 10:09:36
GSE Local
GSE Local is a command line tool that can independently launch the game server hosting service
GSE. This tool also provides runtime logs including the server initialization, health check, and API
calls and responses.
GSE Local is limited to launch GSE hosting services and test your game integration on a local device,
which will shorten the debugging time and improve efficiency at the iterative development of games.
Otherwise, you have to upload each new game package to GSE and configure the server fleet to host
games.
Your game server correctly integrates the GSE server development kit, properly communicates
with GSE service, and is able to launch new game sessions, accept new players and report the
running status.
Your game client correctly integrates the GSE-related TencentCloud APIs to retrieve existing game
sessions, launch new game sessions, and allow players to join and connect to the game session.
Note:
The following sample code is applicable to Linux and MacOS. For Windows, we recommend to
use the gitbash command line tool to run curl command.
1. During launch, the game server will call the ProcessReady API to inform GSE that the server is
ready to host a game server session.
2. During runtime, the game server will use the onHealthCheck callback to send its running status to
GSE every minute.
3. The game server will respond to requests and trigger the onStartGameServerSession callback (call
the activateGameServerSession API in this process) to launch a new game session.
Open the command prompt window, navigate to the directory of gselocal_windows , gselocal_linux
or gselocal_mac , and run the program. This document uses the Mac program ./gselocal_mac as an
example. After the program is launched, it will automatically connect to GSE Local.
Enter the following command in a terminal window:
./gselocal_mac
If the following information appears in the command prompt window, the launch is successful:
Launch the game process in a programming tool or command line tool. The game process then will
call the ProcessReady API to prepare for hosting a session and print the following logs:
After receiving the ProcessReady request, GSE Local will also print logs and start the health check:
{"level":"info","ts":"2020-10-20T09:29:03.256+0800","msg":"onHealthCheck received","pid":"41688",
"health":true}
{"level":"info","ts":"2020-10-20T09:30:03.261+0800","msg":"onHealthCheck received","pid":"41688",
"health":true}
Step 3: use curl to create a game server session and a player session
Use curl to simulate the client calls. For specific parameters, see APIs.
Run the following command to configure the FleetId parameter. You can set it to any valid strings
(^fleet-\S+) in GSE Local.
The following log message displayed in the command prompt window indicates that GSE Local has
sent the onStartGameServerSession callback to your game server. If a game server session is
successfully created, your game server will call the ActivateGameServerSession API to respond to the
callback. The logs are as follows:
GSE Local uses curl to pass the game server session ID and object. Please note that the status of a
new server session will change from “Activating” to “Active” after the game server calls the
ActivateGameServerSession API. To view the status, run the following curl command to call the
DescribeGameServerSessions API:
{"Response":{"GameServerSessions":[{"AvailabilityStatus":"Enable","CreationTime":"2020-10-20T01:3
7:08Z","CreatorId":"","CurrentCustomCount":0,"CurrentPlayerSessionCount":0,"DnsName":"","FleetId"
:"fleet-1235","GameProperties":[],"GameServerSessionData":"","GameServerSessionId":"qcs::gse:loca
l::gameserversession/fleet-1235/gssess-c648654a-293b-4f1f-b71f-2fa56a09bffe","InstanceType":"loca
lhost","IpAddress":"127.0.0.1","MatchmakerData":"","MaxCustomCount":0,"MaximumPlayerSessionCount"
:5,"Name":"","PlayerSessionCreationPolicy":"ACCEPT_ALL","Port":3237,"Status":"ACTIVE","StatusReas
on":"","TerminationTime":null,"Weight":0}],"NextToken":"","RequestId":"s1603158295201357000"}}
The GSE Local Command Prompt displays the following logs, indicating that the game server has
sent the AcceptPlayerSession request to verify a new player connection.
Call the DescribePlayerSessions to query a player session. The initial status of the player session is
“Reserved”:
If the client successfully connects to the game server within 1 minute, the player session status
will become “Active”.
If the client fails to connect to the game server within 1 minute, the player session status will
become “TIMEDOUT”.
{"Response":{"NextToken":"","PlayerSessions":[{"CreationTime":"2020-10-20T02:03:43Z","DnsName":""
,"FleetId":"fleet-****","GameServerSessionId":"qcs::gse:local::gameserversession/fleet-1235/gsses
s-c648654a-293b-4f1f-b71f-****6a09bffe","IpAddress":"127.*.*.1","PlayerData":"","PlayerId":"ka***
*11","PlayerSessionId":"psess-56dd6f48-08d4-4a11-9330-****09784977","Port":3237,"Status":"TIMEDOU
T","TerminationTime":"1970-01-01T00:00:00Z"}],"RequestId":"s16031596094****2000"}}%
After creating a game session and player session, you can directly use localhost:port to join a
client player to the game session.
The GSE Local Command Prompt will display logs, indicating that the game server has sent the
AcceptPlayerSession request to verify the new player connection. If you use curl to call the
DescribePlayerSessions API, the player session status should be changed from “Reserved” to
“Active”.
To verify that your game server sends the game and player statuses to GSE, ensure your game
server always send these statuses to GSE Local to help GSE Local manage player needs and
correctly report metrics. GSE Local will record the following actions. You may also need curl to
track the status change.
CreateGameServerSession
DescribeGameServerSessions
JoinGameServerSession
JoinGameServerSessionBatch
DescribePlayerSessions
The GSE Local Command Prompt only displays the logs of the CreateGameServerSession API calls. As
shown in the log message, GSE Local prompts the time when your game server launches a game
session (using the onStartGameServerSession callback). After your game server uses the callback,
GSE Local will obtain the ActivateGameServerSession response. You can use curl to view the calling
of other APIs.
Notes
Take notice of the following points when using GSE Local:
1. Different from the GSE Web service, GSE Local does not track the running status or the
onProcessTerminate callback triggering of the server. GSE Local only records the runtime report of
the game server.
2. The FleetId will not be verified during the calling of Tencent Cloud development kid, because this
parameter can be set to any valid strings (^fleet-\S+) .
3. The game session created using GSE Local has a distinct ID structure, which contains local as
shown below:
arn:gse:local::gamesession/fleet-****/gsess-56961f8e-db9c-4173-97e7-****82f0daa6
This document provides the addresses and examples for latency test in different regions. Both HTTPS
and UDP addresses are supported.
https://ap-
Beijing ap-beijing.speed.tencentgse.com
beijing.speed.tencentgse.com
https://ap- ap-
Shanghai
shanghai.speed.tencentgse.com shanghai.speed.tencentgse.com
https://ap- ap-
Guangzhou
guangzhou.speed.tencentgse.com guangzhou.speed.tencentgse.com
https://ap-
Chengdu ap-chengdu.speed.tencentgse.com
chengdu.speed.tencentgse.com
https://ap- ap-
Singapore
singapore.speed.tencentgse.com singapore.speed.tencentgse.com
https://ap-
Mumbai ap-mumbai.speed.tencentgse.com
mumbai.speed.tencentgse.com
https://na- na-
Silicon Valley
siliconvalley.speed.tencentgse.com siliconvalley.speed.tencentgse.com
https://na-
Virginia na-ashburn.speed.tencentgse.com
ashburn.speed.tencentgse.com
https://eu-
Frankfurt eu-frankfurt.speed.tencentgse.com
frankfurt.speed.tencentgse.com
Example
HTTPS
ping ap-guangzhou.speed.tencentgse.com
curl https://ap-guangzhou.speed.tencentgse.com/v1/ping
UDP
1. Add the file gse.yaml to the root directory of the game’s asset package, which means the
decompressed file path will be /local/game/gse.yaml on the game server fleet instance;
2. The content of the file gse.yaml is shown below, indicating that user_00 is added to the users
user group. You cannot configure other users and user groups currently;
User: user_00:users
When the file gse.yaml is added to the asset package, GSE will launch the game process with
user_00:users and set the users and user groups of all files under /local/game as
user_00:users .
1. Create the install.sh script and write the operations to be conducted before launching the game
process in this script;
2. Add the file install.sh under the root directory of the game’s asset package, which means the
decompressed path will be /local/game/install.sh on the game server fleet instance.
#!/bin/bash
# Install the JDK 1.8 environment - y indicates answer yes for all questions
yum install java-1.8.0-openjdk.x86_64 -y
# Put the java command under `/local/game` with a soft link
ln -s /usr/bin/java /local/game/java
2. Put install.sh script under the root directory of the game’s asset package, which means the
decompressed path will be /local/game/install.sh on the game server fleet instance.
3. When creating the game server fleet, enter /local/game/java as the launch path, and enter -jar
jar package specified by user as the launch parameter.
4. After the game process is successfully launched, the content of the path /local/game is shown
below: