Publish to ByteDance Mini Games

Note: some platforms only have Chinese documentation available when visiting the platform's website. It may be necessary to use Google Translate in-order to review the documentation.

Cocos Creator officially supports the release of games to the ByteDance Mini Games.

The runtime environment of ByteDance Mini Game is an extension of ByteDance Mini Program, which provides the encapsulation of WebGL interfaces on top of the Mini Program environment, making the rendering ability and performance substantially improved. However, since these interfaces are encapsulated by the ByteDance team through self-developed native implementations, they are not equivalent to the browser environment.

As the engine developer, in order to simplify the workload of developers as much as possible, the main work we have done for developers includes:

  • The engine framework is adapted to the ByteDance API and is purely at the game logic level, so developers do not need any additional modifications
  • Cocos Creator editor provides a quick packaging process to publish directly as a ByteDance
  • Automatically loads emote assets, cached assets and the versioning of cached assets

For details about ByteDance access, please refer to the ByteDance Mini Game Access Guide.

Preparation

  • Download the ByteDance Developer Tools and install it.

  • Refer to the ByteDance Mini Game Access Guide to register, login and apply for mini games on the ByteDance Developer Platform.

  • After the application is approved, you can find the appid in Development Management -> Development Settings of the developer platform.

Publishing Process

Use Cocos Creator to open the project to be published, open the Build... panel from Menu Bar -> Project, select ByteDance Mini Game in Platform, fill in the appid, and click Build.

Parameter Configuration

The specific rules for filling in the relevant parameter configuration are as follows.

  • The Compression Type of the Main Package

    To set the compression type of the main package, please refer to the Asset Bundle - Compression Type documentation.

  • Configure the Main Package as a Remote Package

    This is optional and needs to be used in conjunction with the Resource Server Address option.
    When checked, the main package is configured as a remote package and is built with its associated dependencies to the built-in Asset Bundle -– main in the remote directory of the release package. The developer needs to upload the entire remote folder to the remote server.

  • Initial Scene Subpackage

    This item is optional.
    When checked, the first scene and its related dependencies will be built into the built-in Asset Bundle under the release package directory assets –– start-scene to improve the speed of loading assets for the initial scene. The details can be found in the document Asset Loading for Initial Scenes.

  • Resource Server Address

    This item is optional and is used to fill in the address of the remote server where the resource is stored. Developers need to manually upload the remote folder in the release package directory to the filled resource server address after the build.

  • Code Directory for Open Data Domains

    This item is optional and is used to access the open data domain of ByteDance , please refer to the Access the Open Data Domain of ByteDance Mini Game documentation for the specific publishing process.

Run Preview

  • Click the Open button behind Build Path after the build is finished, the ByteDance mini game project folder bytedance is generated under the build directory of the publish package, which already contains the configuration files of bytedance environment: game.json and project. config.json.

  • Use the ByteDance developer tool to open the bytedance folder generated by the build, open the ByteDance game project and preview the debugging game content. Please refer to the Introduction to ByteDance Developer Tools for details on how to use the developer tools.

Resource Management for ByteDance Mini Game Environment

ByteDance mini games are similar to WeChat mini games in that there is a package size limit, and additional assets over 4MB must be downloaded via network requests.

Cocos Creator has already done the downloading, caching and versioning of remote assets for developers. The specific implementation logic and operation steps are similar to those of WeChat mini games, please refer to the WeChat Mini Game Resource Management documentation.

Subpackage Loading

Cocos Creator supports ByteDance mini game subpackage function since v2.4.4, and the usage is similar to WeChat mini game. Please refer to the Mini Game Subpackage documentation.

ByteDance needs specific versions to support the subpackage functionality. The following table shows these requirements:

Product Android iOS
Douyin v13.6.0 v13.7.0
Toutiao v7.9.9 v7.9.8

The ByteDance Developer Tools require a version greater than or equal to 2.0.6 and less than 3.0.0.

Note: if the product version does not support supackage loading, the engine will load the subpackage as a normal asset bundle.

There are currently the following limits on the size of the mini game subpackages:

  • The size of all subpackages of the whole mini game should not exceed 16 MB.
  • The size of a single subpackage/main package cannot exceed 4 MB.

For details, please refer to the official ByteDance Game Subpackage Loading documentation.

Platform SDK Access

In addition to pure game content, the ByteDance mini game environment also provides very powerful native SDK interfaces, the most important of which are users, social, screen recording, etc. These interfaces only exist in the ByteDance environment and are equivalent to the third-party SDK interfaces of other platforms. The porting of such SDK interfaces needs to be handled by developers at this stage. The following are some powerful SDKs provided by ByteDance:

  1. User interface: login, authorization, user information, etc.
  2. In-game recording and sharing
  3. Forwarding and getting forwarding information
  4. Media: pictures, recordings, camera, etc.
  5. Other: location, device information, code scanning, NFC, etc.

Restrictions of ByteDance Mini Game

The following modules are temporarily not supported by ByteDance Mini Game:

  • VideoPlayer
  • WebView

In addition, the audio assets loaded through the network are played by streaming in ByteDance Mini Game, and the duration of the audio cannot be obtained unless the audio assets are exported to the Asset Bundle.

results matching ""

    No results matching ""