Skip to content

Minigame Running Mechanism ​

During startup, running, and destruction, a minigame follows a specific state-switching logic.

Foreground and Background States ​

  • Foreground state: after the minigame starts, its interface is displayed to the user.
  • Background state: when the user taps the capsule button in the top-right corner to close the minigame, or presses the device Home key to leave the platform, the minigame does not fully terminate; instead it enters the background state.
  • Running restriction: after entering the background, the minigame can keep running for a short period.

Startup Methods ​

Depending on whether the minigame has already been destroyed, startup falls into two cases:

Startup MethodDefinition and Description
Cold StartThe user opens the minigame for the first time, or reopens it after it was destroyed. In this case it must be reloaded and started.
Hot StartThe user has already opened a minigame and reopens it within a certain period; the minigame moves from the background to the foreground.

Destruction Timing ​

A minigame does not stay resident in memory indefinitely. It is destroyed in the following situations:

  1. Long stay in the background: it remains in the background for a certain period without being reopened.
  2. System resource reclamation: when system memory is tight or the minigame consumes excessive resources.
  3. iOS memory warning: on iOS, if system memory warnings are received consecutively, the minigame is proactively destroyed.

Logic Rules for Reopening ​

There are two categories of user expectations when opening a minigame, described as scenes:

Scene Categories ​

  • Scene A: opening the home page. The scene values are as follows:
Scene TypeDescription
1Minigame main entry
2Android system desktop icon
3Returning from another minigame
  • Scene B: opening a specific page designated by the minigame, with a scene value other than those of Scene A. When reopening a minigame, the logic is as follows:
Previous SceneCurrent Opening SceneFinal Behavior
Scene AScene ARetain the original state (continue from last progress)
Scene BScene AClear the page stack and reopen the home page (reStart)
Scene A or BScene BClear the page stack and open the specified page (reStart)