Skip to content

Engine Separation ​

1. Overview ​

As minigame platforms have evolved, they have imposed higher requirements on package size, startup speed, and runtime performance. Traditional packaging typically bundles engine code together with business code, which brings the following problems:

  • Large package size, which makes downloading harder for users
  • Engine code is loaded repeatedly, reducing loading efficiency
  • High update cost: upgrading the engine requires republishing the entire game

For these reasons, the engine separation approach was introduced to decouple the engine from the game business logic, becoming an important optimization technique. Using engine separation in Runtime requires no additional integration work.

2. What Is Engine Separation ​

The engine code is provided as a plugin that developers configure.

The overall structure is as follows:

text
**Traditional structure:**

├── main.js (business code)
├── engine.js (engine code)
├── assets/
├── manifest.json
└── ...

**After engine separation:**

├── main.js (business code)
├── assets/
├── manifest.json
└── ...

3. Core Advantages ​

3.1 Smaller Main Package ​

Once the engine code is stripped out of the main package, the main package size drops significantly, making it easier to meet minigame platform limits.

3.2 Improved Loading Performance ​

  • The engine can be cached
  • Multiple games can reuse the same engine resource
  • After the first load, subsequent startups are faster

4. OpenPaaS Game Startup Flow ​

  1. Download and install the engine plugin
  2. Start main.js
  3. Initialize the game engine
  4. Load game resources
  5. Start the game logic