"Bounty Hunter" Huawei Battle Platform, Beginner Deployment Guide!

97e2d147192c1901b6df6cc1c9ad737c.gif

"Bounty Hunter" is a casual online battle game that is currently available on the Cocos Store resource mall for free.

01b082f7088492733858dcac0f803861.png

This article focuses on how to integrate Huawei’s online battle capabilities into this game.

development environment

  • Cocos Creator:Cocos Creator 3.7.2

  • Android:Android Studio 3.6.1

  • WeChat Mini Games: Basic library using 2.32.2

Project directory

4118387579a17580d22252cc7823be65.png 【Click to enlarge】
  • scene : game scene, in the Cocos Creator engine, the scene is the starting entry. selectThis is our entrance scene.

  • res : Art resource directory, which includes UI pictures, opening animations, special effects, fonts, models, etc.

  • resources : audio, configuration, particle effects prefabs, UI interface prefabs.

  • script : Project script directory, classified by modules involving UI, game logic, basic framework, and three-party libraries (Huawei Battle Engine).

Project configuration

01 Huawei online battle service

"Bounty Hunter" is based on Huawei's online battle function. Please log in to Huawei first AppGallery Connect, create a project, and complete 联机对战relevant configurations.

739e59229c9656bb3f64bf18daa8ed8c.png
  • https://developer.huawei.com/consumer/cn/service/josp/agc/index.html

Log in to AppGallery Connect Click 我的项目.

224482b7dee2fc84fce1c08f72daf038.png

In the AppGallery Connect project list, add or find an existing project, as shown below:965cbd4140de56fa9b5705459f9894e7.png

Note that when using Huawei's online battle service in the Cocos Creator engine, please select Webthe type of project.

b488f3a3188304fdaf634636bf9f1e0a.png

Select "Build > Online Battle Service" in the left navigation bar, enter the online battle service page, and start the service.f1fbc646f75a3ba42885d5541cc05d05.png

02 Client JS-SDK

If we want to provide online battle capabilities in our games, we also need to download Huawei's JS SDKscripts and integrate them into the project.8d8d8782f1dd05667e5a7c2163a4ffd4.png

Store the GOBE.d.ts2 GOBE.jsfiles in script/libsthe folder (the "Bounty Hunter" project already has these two files, no need to operate anymore).

67715c4190e1d513bea9d05eed89c7bc.png

New projects need to note that they must be set as plug-in scripts in the Cocos Creator engine GOBE.js.b325a4447a370bcb40c8ad4105725d9e.png

and place the certificate endpoint-cert.cerunder resourcesthe folder.72017798af1a41ddbde0410541c66bb1.png

Finally, in the "Bounty Hunter" project code, you also need to fill in the , , gobeUtil.tsfor Huawei Battle Service . See below:CLIENT_IDAPP_IDCLIENT_SECRET9d630a54c27a3abcf33af49de6c33d97.png

You can find the above content in Huawei AppGallery Connect background project settings > SDK configuration > SDK code snippets.08ec746ced3be2aab767fc02eed95ca3.png

03 Real-time server code configuration

After the client is configured, you still need to configure server-related content.

Enter the online battle service, expand the real-time server option, click Hosted real-time server, and click the label on the right side of the list 上传代码.6ac74ac2fa8ac8f6e77008c850aab3c1.png

Give the service a random name and click Browse Files to prepare the server files to be uploaded.604ca2c66d6d20c30296562457ff8d0b.png

Browse to the "Bounty Hunter" project and goberts/index.jsselect Upload.ce2f582e34ddc367b665abc0b6fcb121.png

Notice! ! ! Before uploading the file, the value index.jsin line 83 needs to be the appId of your current application.appId

a279b314ef508d1df9fe9574eab6d5a8.png

Now that all configurations are complete, you can start the game in the Cocos Creator engine and invite the girls next to you to happily grab gold coins with you!

c951716b92f71c1478c9f95da13c7ff2.png

Download

"Bounty Hunter - Huawei Battle Platform" has been put on the Cocos Store, and the game source code can be downloaded for free!

616c1e7067761e0ea9fa19f04fc98ce8.png

If you haven't used the Cocos Creator engine yet, you can refer to the video tutorial below.

According to Huawei, the online battle service will not be commercialized for a short period of time. It is completely free to use and free prostitution is welcome. And there will be more technical support and benefits for users of the Cocos engine.

e66c2e4cbff56ba01f3bed2fe79ba6a2.png

Finally, partners are welcome to join the Huawei PGS developer service group and come to communicate and learn with us!

Past highlights

Guess you like

Origin blog.csdn.net/6346289/article/details/132222270