Passer au contenu principal
Version: bleeding-edge 🩸

Création & et importation des assets

Apprenez à créer et à importer des ressources personnalisées dans nanos world

Prerequisites

Avant de continuer, assurez-vous d’avoir suivi les premières étapes et d’avoir installé Unreal Engine ainsi que téléchargé le projet Assets Development Kit.

Il est également recommandé d’avoir lu le Assets Guide afin de comprendre certains concepts qui seront abordés ici.

Commencer

La première étape pour commencer à créer vos propres assets est d’ouvrir le projet ADK. Une fois cela fait, vous remarquerez que nous avons deux dossiers dans le répertoire racine Content/ : NanosWorld/ et MyAssetPack/ :

Dossiers ADK

Comme indiqué précédemment, ne modifiez aucun fichier dans NanosWorld/, car toute modification ne sera ni exportée ni importée dans nanos world.

Contenu du jeu ou du plugin

Les Asset Packs peuvent être créés à partir du Game Content ou du Plugin Content.

Utiliser le Game Content signifie que vous allez créer vos assets directement dans le dossier Content/ de votre projet Unreal. C’est la méthode la plus simple pour créer des assets.

Alternativement, vous pouvez créer des Content Plugins afin d’obtenir une meilleure organisation et une meilleure séparation de vos assets.

C’est à vous de décider si vous souhaitez utiliser le Game Content ou le Plugin Content. Si vous n’êtes pas sûr, commencez par créer vos assets en utilisant le Game Content :

Option A : Utilisation du Game Content

Pour le Game Content, tout dossier que vous créez dans le répertoire Content/ peut être travaillé et monté comme un Asset Pack dans nanos world.

tip

Choisissez des noms uniques pour les dossiers que vous créez dans Content/ afin d’éviter les conflits de noms avec d’autres Asset Packs.

Par exemple, si vous créez un dossier nommé Content/Weapons/ et qu’un autre Asset Pack possède également un dossier Content/Weapons/, ils entreront en conflit et ne pourront pas être chargés ensemble.

Dans le projet ADK, nous avons déjà un dossier nommé Content/MyAssetPack/ comme exemple de dossier de Game Content. Renommez-le comme vous le souhaitez ou créez vos propres dossiers à côté de celui-ci.

Option B : Utilisation du Plugin Content

Pour le Plugin Content, vous devez créer un Plugin dans Unreal Engine et créer vos assets à l’intérieur du dossier Content du plugin. De cette façon, vous pouvez obtenir une meilleure organisation et une meilleure séparation de vos assets, et vous pouvez également partager facilement votre plugin avec d’autres personnes sans devoir partager tout le projet Unreal.

La première étape consiste à créer un plugin, ouvrez donc l’onglet des plugins dans Edit ⬇️ Plugins :

Et dans le coin supérieur gauche, cliquez sur + Add :

Renseignez le nom du dossier pour créer le plugin, aucun autre champ n’est requis :

Une fois créé, activez l’option Show Plugin Content dans les paramètres du Content Drawer :

Ensuite, sur le côté gauche, vous trouverez le dossier du plugin que vous venez de créer. Ce dossier sera votre dossier Asset Pack :

Importation d’assets externes

Tous les assets que vous créez ou importez doivent être contenus dans les dossiers que vous avez créés (le dossier Plugin Content Plugins/MyAwesomeAssetPack Content/ ou les dossiers Game Content, par exemple Content/MyAssetPack/). N’hésitez pas à créer des sous-dossiers et à organiser vos assets comme vous le souhaitez.

Vous pouvez glisser-déposer n’importe quel fichier depuis votre ordinateur dans ces dossiers, par exemple des meshes FBX ou des sons WAV.

Consultez la barre de navigation pour des guides et exemples plus spécifiques sur la manière d’importer certains assets (Skeletal Meshes, Maps, etc.). Vous pouvez les consulter, puis revenir ici pour terminer l’exportation :

Importation des Static Meshesassets-modding/creating-assets/static-meshes Importation des Meshes de personnagesassets-modding/creating-assets/skeletal-meshes/characters-meshes Importation des meshes de véhiculesassets-modding/creating-assets/skeletal-meshes/vehicles-meshes Importation des meshes d’armesassets-modding/creating-assets/skeletal-meshes/weapons-meshes Importation des cartesassets-modding/creating-assets/maps-and-levels/importing-maps

Exportation & et créations de vos assets

Après avoir importé et créé vos assets, les exporter depuis Unreal Engine est très simple.

Pour cela, sélectionnez Platforms ➡ Cook Content ➡ Cook Content :

Cela lancera le processus de Cooking & et de Packaging, qui peut prendre un certain temps selon que les assets ont déjà été chargés ou non. Cela ne prend généralement plus de temps que lors de la première exécution.

tip

Par défaut, Unreal va cuire tout le contenu de votre projet. Si vous avez trop d’assets, vous pouvez réduire le temps de cuisson en sélectionnant uniquement les dossiers ou les maps que vous souhaitez cuire dans les Project Settings.

Une fois terminé, rendez-vous dans le dossier Cooked de votre projet ADK :

assets-development-kit/Saved/Cooked/Windows/NanosWorldADK/

attention

Attention à ne pas confondre le dossier des assets cooked avec les fichiers Content du projet. Make sure you are in the Saved/Cooked/ one!

  • Using Game Content: you can find the cooked folders inside Content/.
  • Using Plugin Content: you can find the cooked folders inside Plugins/.

Inside this folder, you can find all your cooked assets. Example of a Game Content result:

After finding the Cooked folders with your assets, we can create our Asset Pack to import them into nanos world in the next section:

Creating your Asset Pack

You can create your Asset Pack manually or use the CLI to do that easy and automatically, but we recommend doing it manually the first time to understand how it works:

Create a new Asset Pack folder

The first step is to create a new folder for your Asset Pack inside your nanos-world-server/Assets/.

E.g. nanos-world-server/Assets/my-asset-pack/

Note: it must be in kebab-case, as it's a mandatory standard for nanos world Assets & Packages names.

Copy the Cooked Assets

Then copy all the Cooked folders (i.e. the ones inside Content/ or Plugins/) into your new Asset Pack folder.

For example, if you are using Game Content and you have two folders in there Content/MyAssetPack/ and Content/MyOtherAssetPack/, copy both of them into your new my-asset-pack/ folder.

If you are using Plugin Content, copy the whole Plugin folder (e.g. Plugins/MyAwesomeAssetPack/), you will notice it has a Content/ folder inside it, which is correct, so just copy the whole Plugin folder into your new my-asset-pack/ folder.

Create the Assets.toml file

Lastly, you will create the Assets.toml file in the root of your Asset Pack folder, which is the configuration file for your Asset Pack. You can copy and paste the template from Assets Pack Configuration and then fill in the correct values in the next section

Final results

You will end up with a folder like this:

Server Folder
NanosWorldServer.exe
Assets/
├── my-asset-pack/
├── MyAssetPack/
├── MyAsset_01.uasset
├── MyAsset_01.ubulk
├── MyAsset_01.uexp
├── MyAsset_02.uasset
├── MyBigMap.umap
└── ...
├── MyOtherAssetPack/
├── MyOtherAsset_01.uasset
├── MyOtherAsset_02.uasset
└── ...
└── Assets.toml
Config.toml
NanosWorldServer.exe

Configuring your Assets.toml

After you created your Assets.toml in the root folder of your Asset Pack. There are some important configuration to be set.

Open the Assets.toml in a text editor and configure unreal_folders, unreal_version and is_plugin_content to the correct values:

Assets.toml
# unreal engine configurations
[unreal]
# unreal engine folders to mount - the exact name of the root folders inside Content/ or Plugin/ used in Unreal
unreal_folders = [
"MyAssetPack",
"MyOtherAssetPack"
]
# unreal engine version - unreal version this asset pack was compiled on
unreal_version = "5.7.0"
# whether this asset pack was created as a plugin content
is_plugin_content = false

Another important section to configure is the [assets] one, in which you define the list of exported assets to be referenced through scripting.

For example if you export a StaticMesh SM_Cube in a sub-folder, define them like that in your Assets.toml:

Assets.toml
# assets files
[assets]
# ...

# static meshes
[assets.static_meshes]
# Key = Path
SM_Cube = "MyAssetPack/MySubFolder/SM_Cube"
# ...

This way scripters can spawn your Cube Mesh like that:

Server/Index.lua
Prop(Vector(0, 0, 0), Rotator(0, 0, 0), "my-asset-pack::SM_Cube")
tip

You can use the ADK Assets.toml Generator Tool to generate your Assets.toml automatically!

Final Considerations

attention

After cooking and copying your folder, do not rename or delete any file/folder inside your Cooked Asset Pack folder! It will break all internal references used by your assets and may cause them to appear without materials/textures or even cause crashes.

Additional Tips

Cook only what is needed

Par défaut, Unreal va cuire tout le contenu de votre projet. If you have too many assets, you can reduce the cooking time by selecting only the folders or maps you want to cook in the Project Settings.

Enable Cook only maps setting and specify the list of maps in List of maps to include in a packaged build setting, and only those maps and the assets used by them will be cooked:

Additionally, you can specify Additional Asset Directories to Cook to include other folders you want to cook:

Name your assets properly

We hardly recommend and encourage you to follow Allar's Asset Naming Conventions as a pattern for naming your assets and organizing your project folder.

We've summarized the most common names here:

Type d'assetsPréfixeSuffixe
Skeletal MeshSK_
Static MeshSM_
Physical AssetPHYS_
MaterialM_
Material InstanceMI_
AnimationA_
Animation MontageA_
ParticleP_
Sound WaveA_
Sound CueA__Cue
TextureT__? (see Textures)

Reduce the size of your Assets

Use small assets size and configure textures compression properly (big files are bad for network bandwidth). We recommend max 2048x2048 size for textures, as they will be 5MB each.

Creating Assets Thumbnails

It is a good practice to include thumbnails of your assets into a folder called Thumbnails/ in the root of your Asset Pack. This is a convention as the Sandbox game-mode reads from it to display on Spawn Menu. Add .jpg with the name of the assets all in the Thumbnails folder.

You can use the ADK Thumbnail Generator Tool to generate them!

Using Engine Content

Avoid using Engine Content (i.e. Engine's Materials or Meshes). If you want to use them, we recommend copying them to your Content/YourAssetPack/ folder, otherwise they may not be exported correctly.

tip

There are some Engine Content which are allowed to use, but only from the following folders (these are already included by the base game and are safe to use):

  • /Engine/Functions
  • /Engine/BasicShapes
  • /Engine/ArtTools
  • /Engine/EngineMaterials

Troubleshooting

Common Fixes

Most of the problems can be easily fixed by trying the following steps:

1. Make sure you are not copying Project Assets instead of Cooked Assets

Unreal Project files are not meant to work in runtime, they must be compiled/cooked to load in-game. The cooked assets usually have the extensions: .uasset, .uexport and .ubulk. See more here.

2. Make sure your ADK is updated

Cooking your assets with old ADK can cause incompatibilities between the Game and your Assets.

3. Delete Saved/, Intermediate/ and DerivedDataCache/ from your Project folder

Sometimes it's good to try a full recook, as the Cooked assets can get corrupted by old Unreal versions.

4. Copy all used cooked assets folder into your Asset Pack

If you are trying to load a map and specified that in the Project Settings to cook only that map, probably it generated one or more folders inside your Saved/Cooked/ folder. This means that ALL these folders and files are needed to make the map to load. So you MUST copy each folder in there (of course you shouldn't create an Asset Pack for the NanosWorld/ folder).

5. If you use Git, make sure LFS was enabled

If you use Git (with LFS) to upload your cooked assets and clone them in a VPS (not a great solution), make sure you also enabled LFS in the VPS machine, so it clones the LFS assets locally correctly.

6. Verify your Unreal Engine Installation

It is possible you accidentally modified an Engine asset, which can cause incompatibilities with the game's cooked assets because the project will expect a different version. Verify your Unreal Engine installation in the Epic Games Launcher to ensure it is valid, then try cooking again.

Common Problems

Common problems when importing assets and possible solutions:

Assets without Materials/Textures

If you loaded the assets in-game and they don't have material (they are gray). It can be two problems: you didn't set unreal_folders in your Assets.toml correctly, or you modified/moved/copied the files wrongly from the Cooked folder.

Corrupt data found, please verify your installation

If you see this error as a Popup, please make sure to retry all steps listed here or try cleaning up your local NanosWorld/Server/Assets/ folder and re-downloading the files from the server.

Game Crash during/after loading a custom map or custom assets

This usually happen because of corrupted or bad created assets, please make sure to retry all steps listed here.

Disconnected. Failed to Load Map! Canceled or Failed!

This error usually happens when the game couldn't find your map to load. This can be because of badly configured Assets.toml unreal_folders setting or because you copied Unreal Project files instead of Cooked files into your Asset Pack.