Assets Quick Start¶
nanos world provides fully capabilities of modifying, including and customizing the game. In this section we will explain how to include custom Assets in your server.
Assets can be included in a folder called
Assets/ in the root server folder. All files in there will be sent to the clients and will be able to be referenced in your scripting code.
NanosWorldServer.exe Packages/ Assets/ | My_Asset_Pack_01/ | | My_Asset_01.uasset | | My_Asset_02.uasset | | My_Big_Map.umap | | ... | | Assets.toml | Awesome_Weapons/ | | Big_Fucking_Gun.uasset | | AwesomeWeaponBundle.pak | | ... | | Assets.toml
Creating your own Assets¶
If you are already familiar with Unreal Engine 4, creating and using custom assets in nanos world is very straightforward. For that, it’s only necessary to follow some steps.
All custom Assets must be cooked and packed through Unreal Engine 4. It is not (yet?) possible to import custom assets (meshes, images, sounds) directly to the game, so you will need Unreal Engine 4 installed just to import your assets and export them in the proper format. This guide will teach you how to download the most light version of Unreal Engine 4 and the steps needed to export and use your assets properly.
Installing Unreal Engine 4¶
Download and Install Epic Games Launcher (follow the steps for agreeing to Unreal Engine terms).
Install Unreal Engine from inside Epic Games Launcher -> Unreal Engine tab -> Library ->
+Engine Version (We are always using the latest version ;)). Before starting the download, select Options in the dropdown menu and deselect all items, so your installation will be lean with no unecessary stuff.
Please refer to Unreal Official Documentation for more information and tutorials. For the sake of this tutorial, we are not covering further details on Unreal’s peculiarities.
Using the Assets Development Kit - ADK¶
nanos world provides an Assets Development Kit - ADK which helps integrating assets and making the process faster. This is an Unreal Project with useful assets and placeholders which can be used to help your assets and mapping creation. You can and must download and use it to continue this tutorial.
Exporting Assets from Unreal Engine¶
For this tutorial, we are going to use a simple Cube (Static Mesh) and a Material (applied to the cube) for our Assets. We’ve also created and placed them in a folder called MyPack which will help us afterwards.
For exporting them in a recognizable way by nanos world, you need to “Package the Project” (i.e. cooking and packaging it), for that just select the following option and select any folder in your computer and wait it finishes, it may take some minutes:
After finishing, you will get a folder like that:
Importing and Using Assets in your Server¶
After packaging your project, we will manually copy the exported folder from it, the one we are looking for probably will be located at
assets-development-kit/Content/. As we created a folder called
MyPack, our exported assets will be at
It is important to keep your main Asset Folder (in this case
MyPack) with the same name when copying to, otherwise internal references will not work.
And thats it! You must now just copy
MyPack/ folder inside your Server’s
Assets/ folder and create a configuration file called
MyPack/ folder with the pattern described in #assets-configuration-file. For each Asset you have in your Pack, you must add an entry in the configuration file.
For our Cube mesh, we just need to add an entry with the Path of the cube relative to our Assets folder in the pattern
[ASSET_NAME] = "[ASSET_PATH]":
# Static Meshes [assets.static_meshes] SM_Cube = "SM_Cube"
Then it is possible to spawn our Cube like
Prop(Vector(0, 0, 0), Rotator(0, 0, 0), "MyPack::SM_Cube"):
Please do NOT rename or change any file or folder in your exported folder after you Packaged it, it will break all internal references used by your assets.
Assets Configuration File¶
nanos world Config files use TOML (Tom’s Obvious, Minimal Language), please refer to https://github.com/toml-lang/toml for more information and syntax.
The Assets Configuration file
Assets.toml is generated automatically when an Asset Pack is loaded for the first time. This file will always be overriden with the proper pattern after it’s loaded.
It is extremely important to setup your
Assets.toml file, in there you will need to list every asset contained in your Pack, as well the type of them, besides that, this is where Scripters can look into to find the assets they want to use.
# Asset Pack Configurations [asset_pack] # Asset Pack Name name = "My Pack" # Author author = "Incredible Asset Creator" # Version version = "1.1.0" # Assets Files [assets] # Maps [assets.maps] AwesomeAndBigMap = "Maps/BigMap_01" # Static Meshes [assets.static_meshes] # SM_Flower_01 = "MyFolder/SM_Awesome_Flower_01" # ... # Skeletal Meshes [assets.skeletal_meshes] # SK_Better_Man = "Characters/SK_BetterMan_3" # ... [assets.sounds] # A_RingSound = "Audios/A_RingSound" # ... # Animations [assets.animations] # A_Character_Jump = "Animations/A_Character_Jump" # ... # Other Assets (for not yet categorized ones) [assets.others] # A_Audio_Rifle_Fire = "Audios/A_Audio_Rifle_Fire_03" # ...
As seen above, Assets can be set in a
key = "value" pattern, the key being how Scripters reference it in their code, and the value being the path where the game will look for it. Note: all paths are relative to the Asset Pack folder. So for example, if Characters is a folder inside MyPack Asset Pack folder then the relative path would be: “Characters/Your_Asset_Name”.
Referencing Assets in Code¶
The correct way of referencing assets in code is using the pattern:
ASSET_PACK_NAME::ASSET_FILE_NAME. So for example, if I want to reference to AwesomeAndBigMap as the above example, I would use:
ASSET_PACK_NAME is the Asset Pack’s folder name.