Modding:Asset System: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Vintage Story loads most of its game content from so called assets. Those can be found inside the <code>assets</code> directory inside your [[Vintagestory folder]]. Things such as blocks, items, world generation, recipes, etc. are all loaded from assets during startup.
<languages/>
<translate>
<!--T:1-->
{{GameVersion|1.12}}
__FORCETOC__


These assets are easily modifiable and using the integrated mod system you can easily add your own stuff without having to mess with coding. You can also read some [[Basic Modding Examples|examples]] to learn about what you can do with it.
<!--T:2-->
Vintage Story loads most of its game content from asset JSONs. Many examples of these can be found inside the <code>assets</code> directory inside your [[Vintagestory folder]]. Things such as blocks, items, world generation, recipes, etc. are all loaded from assets during startup.


== Categories ==
== Finding the assets folder == <!--T:3-->


Here is an overview of categories:
<!--T:4-->
All the functioning assets for Vintage Story are visible in the game's folder, allowing you to peruse them and learn to write your own. You can find these files using the following methods for each type of OS you're running Vintage Story on. If you're looking for source code (ie C# classes) your best option is to dive into the '''[https://github.com/anegostudios Vintage Story Github]''' and peruse the '''vsapi''', '''vssurvivalmod''', '''vsessentialsmod''' and '''vscreativemod''' repositories for class references.
 
=== Windows === <!--T:5-->
If you're running Vintage Story on Windows you can navigate to this folder by typing %appdata% in desktop search bar, which will take you to your computer's roaming folder. Find the <code>Vintagestory</code> folder here and you'll immediately come across the assets folder, which contains assets for "creative", "game" and "survival".
* '''creative''' contains assets for creative mode only. 
* '''game''' contains many universal assets, such as lang files, the player entity shape, and other essential assets to the game.
* '''survival''' contains the bulk of the actual content most players will come across, and contains all the resources Vintage Story uses, such as textures sounds and world generation.
 
== List of Asset Types == <!--T:6-->
 
<!--T:7-->
The following are the categories of assets you can expect to use while modding for Vintage Story. Each are easily modifiable and can be used to easily add your own content or changes without having to do any advanced coding. You can also read some [[Modding:Basic Modding Examples|examples]] to learn about what you can do with it.
 
<!--T:8-->
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
<table id="treeviewtable" class="table table-bordered tt-table" style='table-layout: fixed'>
   <tr style=''>
   <tr style=''>
Line 66: Line 85:
     <td>universal</td>
     <td>universal</td>
     <td>Contains the 3d models for all the items, blocks and creatures</td>
     <td>Contains the 3d models for all the items, blocks and creatures</td>
  </tr>
  <tr>
    <td scope="row"><div class="tt" data-tt-id="p_dialog" data-tt-parent="root">config</div></td>
    <td>true</td>
    <td>universal</td>
    <td>Used for generic data that does not fit into the other categories.</td>
   </tr>
   </tr>
   <tr>
   <tr>
Line 211: Line 236:
     <td>Contains some of the dialog layouts</td>
     <td>Contains some of the dialog layouts</td>
   </tr>
   </tr>
<!--T:9-->
</table>
</table>


= Domains = <!--T:10-->


= Domains =
<!--T:11-->
 
Domains are used to separate mod added content from the original one. Basically a domain is a prefix for any given code (identifier for item, block, etc.) or path (textures, sounds, etc.). VintageStory itself has its own prefix <code>game</code>.
Domains are used to separate mod added content from the original one. Basically a domain is a prefix for any given code (identifier for item, block, etc.) or path (textures, sounds, etc.). VintageStory itself has its own prefix <code>game</code>.


<!--T:12-->
When [[Mod Packaging|packaging a mod]] you specify a domain by placing a directory inside the mod <code>assets</code> directory with all your mod assets inside. The name of your domain directory will be the "current domain" for all assets inside it. If no domain has been specified in an asset code the game will assume it is in the current domain, meaning you only have to add a domain prefix if you want to refer to something outside the current domain.
When [[Mod Packaging|packaging a mod]] you specify a domain by placing a directory inside the mod <code>assets</code> directory with all your mod assets inside. The name of your domain directory will be the "current domain" for all assets inside it. If no domain has been specified in an asset code the game will assume it is in the current domain, meaning you only have to add a domain prefix if you want to refer to something outside the current domain.


<!--T:13-->
For example, if you want to create a new block which uses the original leather texture, you would have to specify the domain (since your block has a different one). Instead of using  <code>assets/textures/blocks/leather.png</code>, you would have add the prefix for the domain <code>game:assets/textures/blocks/leather.png</code>.
For example, if you want to create a new block which uses the original leather texture, you would have to specify the domain (since your block has a different one). Instead of using  <code>assets/textures/blocks/leather.png</code>, you would have add the prefix for the domain <code>game:assets/textures/blocks/leather.png</code>.




== Overwriting assets ==
== Overwriting assets == <!--T:14-->


<!--T:15-->
There are no limitations to the system. So you can overwrite assets from Vintagestory itself by using the <code>game</code> domain folder.
There are no limitations to the system. So you can overwrite assets from Vintagestory itself by using the <code>game</code> domain folder.


<!--T:16-->
To overwrite the bed blocktype you can put your own json flie inside your mod zip archive with the following path: <code>assets/game/blocktypes/bed.json</code>. So Vintagestory will load your json file instead of the original one.
To overwrite the bed blocktype you can put your own json flie inside your mod zip archive with the following path: <code>assets/game/blocktypes/bed.json</code>. So Vintagestory will load your json file instead of the original one.


<!--T:17-->
Theme packs can only override assets that do not effect game mechanics, the other mod types can override any asset.
Theme packs can only override assets that do not effect game mechanics, the other mod types can override any asset.


== Accessing assets in code == <!--T:18-->
<!--T:19-->
To access assets in a code mod, you can use the [[Modding:AssetManager| AssetManager]].
= Moving Forward = <!--T:20-->
<!--T:21-->
Once you have an idea of what assets are and how they're organized, it's time to move onto your first content mod. Head over to the '''[[Modding:Basic Block | Basic Block ]]''' page to learn how to make your first block, or go to the '''[[Modding:Basic Item |Basic Item]]''' page if you'd like to start by making an item. Both are great ways to learn how to make your first mod.
<!--T:22-->
{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}
</translate>