# Project structure

# Design and development of game resources: assets

Game resources directly understood by developers are developed and stored under the assets directory. Some resource developers can develop directly, such as typescript code. Some can use visualization tools for editing. Such as scenes, prefabs and other content. When using a mini game, these resources will be quickly compiled into a format that the mini game can understand. For example, typescript is compiled into javascript, and hlsl is compiled into glsl. These resources will be stored in the __temp folder under the corresponding folder of miniprogramRoot (such as minigame in the template project).

# Fast running and debugging in play mode: minigame/__temp

In the minigame/__temp directory, in the mini game, you can preview and edit scenes, particle effects, etc., and even quickly run and debug. The loaded resources are the resources under __temp. The resources under __temp will be ignored when the simulator is running, and when the package is uploaded.

# Build and package: minigame/assets

In the packaging and construction process of the mini game, in order to improve the efficiency of the real machine, we will process the resources. Such as compressing textures, merging resources, and automatically subcontracting work. Finally, it is generated in the assets folder under the corresponding folder of miniprogramRoot (such as minigame in the template project). The simulator will understand the built content to run, and will be released to the real device during preview/upload.

# Directory definition

# assets/

Local resource files, including scenes, models, codes, etc. There are also some special folders -assets/openDataContext is a designated directory for developing open data domain codes. -assets/workers is a designated directory for multi-threaded worker code. -node_modules npm package, the d.ts of the small game framework that comes with it. It will be used by developers when importing engine for code prompting. Developers can also add the npm packages they wish to use. It will be automatically packaged into the release directory through the small program npm construction ability. -Editor, any folder named Editor in the assets directory is treated as a special directory for storing tool plug-ins, and the contents inside will not be processed by the construction. -isolateScript, the code in any folder named isolateScript in the assets directory will run in an isolated environment for developers to customize the build logic.

# minigame/

The directory to store the real machine running products of the built mini game, use [miniprgramRoot](https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig. in the project.config.json file in the project root directory. html) attribute to configure.

  1. minigame/__temp/-Temporary resource directory, used to store compiled resources, used for editing and playing state. Developers don't need to understand, this file will be ignored in the final package upload.

  2. minigame/assets/-resource directory. Both IDEBuildIn and IDEPack directories are packaged resource files. IDEBuildIn will be uploaded to the main package. IDEPack is uploaded to the remote server by the developer. The address of each package is written in register.json, which can be changed manually or the prefix can be set through the configuration interface during construction.

  3. minigame/assets/game.js-Build the generated startup file js. After this file is required, the entry scene will be started.

  4. minigame/game.js-The entry file of the mini game defined by the developer. In this file require('assets/game.js')

  5. minigame/game.json-The game.json file in the root directory of the mini game is used to The mini game performs global configuration and determines related interface rendering and property settings. It can also be configured through the Project Setting window.

# typings/

The d.ts of the official api of the applet. Used for typescript development. Will be used by the developer's ide for code prompting.

# project.config.json

The project can be configured using the project.config.json file in the project root directory. Check Project Configuration File.

# tsconfig.json

Used for typescript development, configuration recognized by editors such as vscode, and configuration of compiled code.

# engine.ide.json

Record some configuration information needed when the mini game is opened.