diff --git a/docs/04-game-asset-structure/01-default-assets-structure.md b/docs/04-game-asset-structure/01-default-assets-structure.md index 28969b3..aa40284 100644 --- a/docs/04-game-asset-structure/01-default-assets-structure.md +++ b/docs/04-game-asset-structure/01-default-assets-structure.md @@ -196,6 +196,8 @@ Main game assets are stored in the `main-game` folder, organized by platform and When a feature is activated, its assets are loaded directly, bypassing the main game asset folders. ::: +--- + #### Feature Game Asset ##### Overview @@ -229,28 +231,132 @@ Feature game assets (e.g., free-game, pickup, bonus, gamble) are stored in a fol |:-----------:|:-----------------:|:---------------:| | ![Feature Game](./img/feature-assets.png) | ![Desktop Asset Structure](./img/feature-assets-desktop.png) | ![Mobile Asset Structure](./img/feature-assets-mobile.png) | -#### Localizes Asset +--- -`localizes/` là nơi lưu trữ assets của các ngôn ngữ khác nhau như : ZH, TH, ID..v.v +#### Localized Assets + +The `localizes/` folder contains assets tailored for different languages (e.g., ZH, TH, ID). This ensures that fonts and textures can be displayed appropriately for each supported locale. + +##### Folder structure: ```plaintext assets/ └── game-assets/ ├── fonts/ - │ ├── localizes/ # Localized font files - │ └── preloads/ # Fonts loaded at startup + │ ├── localizes/ # Fonts for each language + │ └── preloads/ # Default fonts (usually English) loaded at startup └── textures/ ├── desktop/ - │ ├── localizes/ # Localized textures for desktop - │ ├── postloads/ # Desktop textures loaded after startup - │ └── preloads/ # Desktop textures loaded at startup + │ ├── localizes/ # Desktop textures for each language + │ ├── postloads/ # Desktop textures loaded after startup (default: en) + │ └── preloads/ # Desktop textures loaded at startup (default: en) └── mobile/ - ├── localizes/ # Localized textures for mobile - ├── postloads/ # Mobile textures loaded after startup - └── preloads/ # Mobile textures loaded at startup + ├── localizes/ # Mobile textures for each language + ├── postloads/ # Mobile textures loaded after startup (default: en) + └── preloads/ # Mobile textures loaded at startup (default: en) ``` -sprite trong `preloads`, `postloads`: defaut là en + +- Assets in `localizes/` are organized by language code (e.g., `zh`, `th`, `id`). +- Sprites in `preloads/` and `postloads/` use English (`en`) as the default language. ![Location](./img/localizes-assets.png) +--- + +#### Meta JSON Merger (Cocos Creator Editor Extension) + +##### Purpose + +Merges multiple JSON metadata files from `library/imports/` into one consolidated file (`fullMetaData.json`) to streamline asset management and build optimization. + +![Purpose](./img/merge-json-assets.png) + +##### Features + +- Recursively collects `.json` files (excluding `fullMetaData.json`) +- Filters out: + - `cc.SceneAsset` + - `cc.Prefab` + +##### Example + +- **Input**: `{Project}/library/imports/**/*.json` +- **Output**: `{Project}/library/imports/fullMetaData.json` + +```json +{ + "asset1.json": { /* metadata */ }, + "asset2.json": { /* metadata */ } +} +``` +--- + +#### Texture Compression Tool (Cocos Creator Extension) + +##### Purpose + +This editor extension manages texture compression settings for game assets to optimize performance and build size. + +![Compression](./img/compress-over.png) + +##### Compression Settings +| Description | Action Compress Texture | +|:----------- |:----------------------:| +| Compresses all textures in:
- `assets/Core`
- `assets/game` | ![Compression](./img/compress-texture.png) | +| Compresses all textures in:
- `assets/game` only | ![Compression](./img/compress-texture1.png) | +| Removes all compression settings | ![Compression](./img/compress-texture2.png) | + +**Example:** +Compression settings for PNG and JPG formats: + +![Compression Settings](./img/compress-setting.png) + +##### Workflow + +1. **Query** texture assets by UUID +2. **Apply** compression settings to their meta data +3. **Save** updated meta files +4. **Log** progress and handle errors in console + +##### Benefits + +* Reduces texture file sizes +* Speeds up builds and runtime loading +* Supports platform-specific formats +* Batch processing for efficiency + +--- + +#### Remove Packable Texture – Cocos Creator Tool + +##### Overview + +This editor extension removes the `packable` flag from all texture assets in your project, preventing them from being packed into texture atlases. + +![Remove Packable](./img/remove-packable-texture.png) + + +##### Why Remove Packable + +Removing the `packable` flag gives you: +- **Better memory management** – load/unload textures individually +- **Prevents automatic atlas generation** – useful for large or dynamic textures + +###### Use Cases +- Large background images +- Special effects (particles, dynamic textures) +- Render textures +- Dynamically loaded assets +- High-res UI elements with custom compression needs + +##### Query Texture + +- Scans `db://assets/**/*` for all texture assets. + +**Example:** + +Compression settings for PNG and JPG formats: +![Remove Packable](./img/remove-packable.png) + +--- diff --git a/docs/04-game-asset-structure/img/compress-over.png b/docs/04-game-asset-structure/img/compress-over.png new file mode 100644 index 0000000..3c41444 Binary files /dev/null and b/docs/04-game-asset-structure/img/compress-over.png differ diff --git a/docs/04-game-asset-structure/img/compress-setting.png b/docs/04-game-asset-structure/img/compress-setting.png new file mode 100644 index 0000000..5405b8c Binary files /dev/null and b/docs/04-game-asset-structure/img/compress-setting.png differ diff --git a/docs/04-game-asset-structure/img/compress-texture.png b/docs/04-game-asset-structure/img/compress-texture.png new file mode 100644 index 0000000..ff3fb7d Binary files /dev/null and b/docs/04-game-asset-structure/img/compress-texture.png differ diff --git a/docs/04-game-asset-structure/img/compress-texture1.png b/docs/04-game-asset-structure/img/compress-texture1.png new file mode 100644 index 0000000..09dc4aa Binary files /dev/null and b/docs/04-game-asset-structure/img/compress-texture1.png differ diff --git a/docs/04-game-asset-structure/img/compress-texture2.png b/docs/04-game-asset-structure/img/compress-texture2.png new file mode 100644 index 0000000..eb9e9f9 Binary files /dev/null and b/docs/04-game-asset-structure/img/compress-texture2.png differ diff --git a/docs/04-game-asset-structure/img/merge-json-assets.png b/docs/04-game-asset-structure/img/merge-json-assets.png new file mode 100644 index 0000000..1f954be Binary files /dev/null and b/docs/04-game-asset-structure/img/merge-json-assets.png differ diff --git a/docs/04-game-asset-structure/img/remove-packable-texture.png b/docs/04-game-asset-structure/img/remove-packable-texture.png new file mode 100644 index 0000000..0647ae1 Binary files /dev/null and b/docs/04-game-asset-structure/img/remove-packable-texture.png differ diff --git a/docs/04-game-asset-structure/img/remove-packable.png b/docs/04-game-asset-structure/img/remove-packable.png new file mode 100644 index 0000000..ff8aad0 Binary files /dev/null and b/docs/04-game-asset-structure/img/remove-packable.png differ