Implement live comment-based games on PCs as a host
This topic describes how to start and implement a live comment-based game on a PC as a host. The live comment-based game "TinyLoveWar" is used as an example for description.
Modes of a live comment-based game
Two modes are provided: free-trial mode and formal mode. Different modes correspond to different gaming procedures. The following table compares the two modes.
Mode | Whether a game start code is required | Whether connection to the server is required | Applicable scenario |
---|---|---|---|
Free-trial mode | No. You can start a game without a game start code. | No. You can use the live comment and gift features without the need to connect to the server. | Game effect experience scenarios |
Formal mode | Yes. | Yes. You need to connect to the server to actually experience the live comment and gift features. | Actual live streaming scenarios |
The free-trial mode is applicable only to specific games.
Prerequisites
Before you start live streaming for a live comment-based game on a PC as a host, make sure that the following prerequisites are met:
-
The computer hardware of the host satisfies the requirements that are shown in the following table. This is required in both modes. The requirements may differ based on different games.
Item Requirement Operating system Windows 10 or later. Screen resolution 1080P or higher. The 2K or 4K resolution is better. CPU Intel Core i3 with four or more cores. GPU GTX 750 Ti or later with an 8-GB or larger memory. -
A project is created in the ZEGOCLOUD console, and the application ID is obtained. This is optional in free-trial mode. For more information, see How to create project in the "Console" documentation.
-
The server secret of the created project is obtained. This is optional in free-trial mode. For more information, see How to view project information in the "Console" documentation.
-
The ZEGOCLOUD MiniGameEngine service is activated through ZEGOCLOUD technical support, and the required game permissions are granted. This is optional in free-trial mode.
-
The secret and the signature are obtained. This is optional in free-trial mode. For more information, see the "Signature method" section of the Make API requests topic.
Procedure
1. (Server) Connect to the ZEGOCLOUD server
If you want to only try the game effects and pay no attention to stream ingestion and pulling, you can select the free-trial mode and skip this step.
-
Connect to the ZEGOCLOUD MiniGameEngine server.
For more information about how to connect to the ZEGOCLOUD MiniGameEngine server, see Server API - Make API requests. For more information about how to implement game features on your server such as obtaining a game start code, see Obtain a game start code. This way, the host can start a live comment-based game in formal mode.
ZEGOCLOUD provides sample server code for your reference. For your data security, do not use the sample code in a production environment.
-
Connect to the ZEGOCLOUD Cloud Communication Service server.
You can contact ZEGOCLOUD technical support team to obtain the required real-time messaging protocol (RTMP) permissions. Then, you can connect to the ZEGOCLOUD Cloud Communication Service server. For more information, see the Make API requests topic in the "API V2" documentation. In addition, you can implement RTMP-based stream scheduling on your server and obtain an RTMP URL. This way, you can configure the ingest URL based on the obtained RTMP URL during Open Broadcaster Software (OBS) live streaming. For more information, see RTMP stream publishing and pulling scheduling.
2. (Client and Server) Start a game
-
(Client) Obtain and start the game client.
Contact ZEGOCLOUD technical support team or business staff to obtain the game client of the latest version.
Double-click the game client to start a game.

-
(Server) Obtain a game start code.
NoteIf your game is in free-trial mode, skip this step.
The game start code is obtained when you are Connect to the ZEGOCLOUD server. In this case, you need to configure how to use these features on the server as needed and how to send the game start code to the host.
NoteIn addition, you need to specify a portal for the host to obtain the game start code. You can specify a custom portal as needed. For example, the portal can be a webpage or outside your business application.
-
(Client) Start a game.
WarningThe procedure for starting a game is described below by using "TinyLoveWar" as an example. The procedure for starting other games may be different, which depends on the actual interfaces of the games.
You need to perform different operations in different gaming modes. The following table shows the interfaces of the game in different modes.
Mode Start interface Game interface Free-trial mode Formal mode
3. (Client) Start live streaming
-
Download and install OBS.
For more information about how to download and install OBS, visit the OBS official website.
-
Configure a game source.
- Open OBS.
- On the
Sources
tab, click the plus (+) icon. Then, clickCreate new
. TheProperties
dialog appears. - In the dialog, set the
Mode
parameter to "Capture specific window" and select a game.
-
Configure a video image.
NoteThe following parameter settings are merely examples. Set parameters based on the actual game, network configuration, and PC model. You can contact ZEGOCLOUD presales or delivery experts to achieve the expected effects.
- Click
File
. In the menu that appears, selectSettings
. TheSetting
dialog box appears.
- Click

-
In the
Setting
dialog box, perform the following operations:-
Click the "Output" tab. On this tab, set the video bitrate to 7,000 Kbit/s.
-
Click the "Video" tab. On this tab, set the
Base (Canvas) Resolution
parameter and theOutput (Scaled) Resolution
parameter to 720×1080, and set theCommon FPS Values
parameter to 30.
-
-
Configure an ingest URL for OBS live streaming.
NoteIf your game is in free-trial mode, skip this step.
In the Setting
dialog box, click the Stream
tab. Then, set the Server
parameter to the URL that you obtained by removing the stream name from the RTMP URL obtained in Step 1, and set the Stream Key
parameter to the stream name.
Example:
The obtained RTMP URL is in the format of rtmp://xx.xxx.xxx.xxxx:xxx/xxxxxx/ABC
, where ABC indicates the stream name.
In this case, set the Server
parameter to rtmp://xx.xxx.xxx.xxxx:xxx/xxxxxx
.
Set the Stream Key
parameter to ABC
.
