Custom Asset Importing: Difference between revisions

From Ardenfall Wiki
Jump to navigation Jump to search
Created page with "At some point you may want to import a new model, texture, sound, etc. This can be done one of two ways - manually via scripting, or by using the built in mod asset importer feature. I suggest the latter, unless you want to do something funky. === Asset Manifest === Every mod can have an asset manifest file defined. This lists out all assets you want to import. TODO === Supported Importers === <u>SimpleModel:</u> Imports a GLTF file as a gameobject. You can define a..."
 
No edit summary
Line 6: Line 6:
Every mod can have an asset manifest file defined. This lists out all assets you want to import.
Every mod can have an asset manifest file defined. This lists out all assets you want to import.


TODO
Create a file called manifest.txt in your mod directory.
 
''Example Asset Manifest''<syntaxhighlight lang="json">
{
  "assets": [
    {
      "assetId": "testmod.dog",
      "type": "texture",
      "properties": [
        {
          "name": "path",
          "value": "Assets/dog.png"
        }
      ]
    }
  ]
}
</syntaxhighlight>


=== Supported Importers ===
=== Supported Importers ===
<u>SimpleModel:</u> Imports a GLTF file as a gameobject. You can define a built in material to use, and it will automatically apply said material + hook up included textures.


<u>Texture:</u> Imports a .png or .jpeg as a Texture2D
==== SimpleModel ====
Imports a GLTF file as a GameObject. Ideal for weapons, items, simple objects. You can define a built in material to use, and it will automatically apply said material + hook up included textures.


<u>AudioClip:</u> Imports a .mp3, .wav, or .ogg as an ArdenAudioClip
==== Texture ====
Imports a .png or .jpeg as a Texture2D
 
==== <u>AudioClip</u> ====
Imports a .mp3, .wav, or .ogg as an ArdenAudioClip


=== Custom Importers ===
=== Custom Importers ===
Mods can define their own importers. Perhaps you built a tool that can easily create item data assets from a json file. You can register your own importer to read this file, and then you can easily import them as assets! Other mods can also rely on other's importers.
Mods can define their own importers. Perhaps you built a tool that can easily create item data assets from a json file. You can register your own importer to read this file, and then you can easily import them as assets! Other mods can also rely on other's importers.
Note an Importer doesn't need to only import a single path (this is why 'path' is a property). Perhaps a single importer takes in a model_path and a data_path, for example.


TODO
TODO

Revision as of 21:12, 21 May 2026

At some point you may want to import a new model, texture, sound, etc.

This can be done one of two ways - manually via scripting, or by using the built in mod asset importer feature. I suggest the latter, unless you want to do something funky.

Asset Manifest

Every mod can have an asset manifest file defined. This lists out all assets you want to import.

Create a file called manifest.txt in your mod directory.

Example Asset Manifest

{
  "assets": [
    {
      "assetId": "testmod.dog",
      "type": "texture",
      "properties": [
        {
          "name": "path",
          "value": "Assets/dog.png"
        }
      ]
    }
  ]
}

Supported Importers

SimpleModel

Imports a GLTF file as a GameObject. Ideal for weapons, items, simple objects. You can define a built in material to use, and it will automatically apply said material + hook up included textures.

Texture

Imports a .png or .jpeg as a Texture2D

AudioClip

Imports a .mp3, .wav, or .ogg as an ArdenAudioClip

Custom Importers

Mods can define their own importers. Perhaps you built a tool that can easily create item data assets from a json file. You can register your own importer to read this file, and then you can easily import them as assets! Other mods can also rely on other's importers.

Note an Importer doesn't need to only import a single path (this is why 'path' is a property). Perhaps a single importer takes in a model_path and a data_path, for example.

TODO

Example: A Custom Weapon

TODO