CAR provides demos for JavaScript, Android, and iOS, as well as a backend demo. This document describes how to quickly configure a demo to run a simple cloud application.
Step 1: Deploy the backend demo
Deploy the backend demo locally or on any server as instructed here. The demo is lightweight and has no special requirements for server configuration. The CAR backend demo demonstrates various features, including application startup and exits as well as user queue. For more information on features and integration, see Technical Integration. Deploying your own backend is a necessary step for using CAR services:
For the security of your assets and services, the SecretId
and SecretKey
of your Tencent Cloud account (which can be obtained on the Manage API Key page in the console) that are needed in order to access the CAR TencentCloud API service must be processed on your backend service. In addition, management of user sessions and other features such as user queue must be implemented on your backend service. For more information, see Basic logic of the business backend and client. Step 2: Deploy the client demo
Demo for JavaScript
The CAR SDK for JavaScript supports various implementation scenarios, including PC and mobile web pages. This document describes how to quickly set up, deploy, and run the demo for the web.
1. Download TCGSDK to C or D drive on the local PC or the Downloads
folder on Mac and keep the path of the folder such as c:/cloudgame-js-sdk
. 3. Replace the following paths/parameters in the demo. For more information, see CAR Demo: |
src="path/to/tcg-sdk"
| TCGSDK path, for example: src="./cloudgame-js-sdk/dist/tcg-sdk/index.js"
|
url = 'http://xxxx/StartProject'
| Replace xxxx with the URL of the business backend demo such as url = 'http://192.168.0.1:3000/StartProject' |
ProjectId: 'project-id'
UserId: 'user-id'
| ProjectId : The ID of the project created in the console.
UserId : The unique ID of the end user currently connected to CAR, which is customized by you and is not understood by CAR. It can be randomly generated with the timestamp and should be kept unchanged during user reconnection.
|
4. For mobile operations, CAR provides the Joystick plugin to map WASD/up, down, left, and right arrow keys. 5. We recommend that you integrate the user queue system to improve the user experience when the number of users requesting your application becomes greater than the maximum number of concurrencies. The queue logic involves the frontend and backend. For the frontend code, see Queue. The signature logic can be added based on your business needs. For the backend implementation, see Queue Feature. 6. Test, debug, and launch your application:
After correctly performing the operations in the console and successfully deploying your backend and client services, you can open the demo HTML file in Chrome (recommended). The rendered application image will be displayed after being loaded successfully, and you can then interact with the application with the mouse/WASD.
You can perform more custom development based on the demo. If you encounter any problems during the testing process, contact us and provide the RequestId. Demo for Android
The demo for Android provides basic CAR capabilities, including simple samples, virtual keyboard, and usage of some common APIs. Your own cloud application can be operated based on the features of the demo. You can quickly configure the demo and run a cloud application as follows:
1. Download the demo project for Android here and import the project to the AndroidStudio tool. 2. Integrate the application as instructed here. Demo for iOS
The demo for iOS provides samples of a virtual keyboard and some common APIs to help you quickly integrate the SDK and start the CAR service. You can implement more features based on the demo to meet your specific needs. You can quickly configure the demo and run a cloud application as follows:
1. Download the demo project for iOS here. 2. Integrate the application as instructed here.
Was this page helpful?