Publish to Baidu Mini Games
Cocos Creator officially supports the release of games to the Baidu Mini Games.
The runtime environment of the Baidu Mini Game is an extension of the Baidu Smart Mini Program. This provides a WebGL interface encapsulation based on the mini program environment. This greatly improves the rendering capabilities and performance. However, since these interfaces are encapsulated by the Baidu team, they are not equivalent to the browser environment.
On the engine side, in order to make the developers’ workload as easy as possible, our main tasks for developers include the following:
- The engine framework adapts to the Baidu Mini Game API, pure game logic level, developers do not need any additional modifications.
- The Cocos Creator editor provides a fast packaging process, released directly as a Baidu Mini Game, and automatically evokes the Baidu DevTools.
Please refer to the Baidu Mini Game Developer Documentation [cn] documentation to review the game submission, the review, and the release process for a Baidu Mini Game.
- Download and install Baidu DevTools in the documentation.
- Download and install the Baidu App in the app store of your phone.
Log in to the Baidu Smart Mini Program Platform [cn] and find App ID.
Release process
Select the Baidu Mini Game in the Platform of the Build panel, fill in the appid, and then click Build.
After a build is completed, a folder will be generated in the project’s build directory (the name of the folder is based on the Build Task Name), which already contains the configuration files
game.json
andproject.swan.json
of the Baidu Mini Games environment.Use the Baidu DevTools to open the folder to preview and debug the game. Please refer to the Baidu DevTools documentation for details. About how to use Baidu DevTools, please refer to Baidu DevTools Documentation for details.
asset Management for Baidu Mini Game Environment
Baidu Mini Game is similar to WeChat Mini Game. There are restrictions on the package size. Assets more than 4MB must be downloaded via a network request.
It is recommended to only save script files in the mini-game packages, while other assets are uploaded to the remote server, and downloaded from the remote server as needed. The download, cache, and version management of remote assets, Cocos Creator has already done it for you. The specific implementation logic is similar to the WeChat Mini Game. Please refer to the asset Management for WeChat Mini Game Environment documentation for details.
Specifically, developers need to do the following:
- When building, check the MD5 Cache in the Build panel.
- Set Remote server address in the Build panel and then click Build.
- After the build is complete, upload the
build/baidu-mini-game/res
folder to the server. - Delete the folder under the local release package directory.
The subpackage loading method of Baidu Mini Game is similar to WeChat, with the following package restrictions:
- The size of a single subpackage/main package can not exceed 4MB.
Please refer to the documentation for details.
Platform SDK Access
In addition to pure game content, the Baidu Mini Game environment also provides a very powerful native SDK interface. These interfaces only exist in Baidu Mini Game environment, equivalent to the third-party SDK interface of other platforms. The porting of such SDK interfaces still needs to be handled by developers at this stage. Here are some of the powerful SDK capabilities offered by Baidu Mini Game:
- User interface: login, authorization, user information, etc.
- Baidu cashier payment
- Forwarding information
- File upload and download
- Other: images, locations, ads, device information, etc.
Currently, the adaptation work of Baidu Mini Game is not completely finished, and the following components are not supported for the time being:
- VideoPlayer
- WebView
If needed, you can directly call Baidu’s as needed.