Modding:Asset System: Difference between revisions

From Vintage Story Wiki
(Wiped redundant "Overwriting assets" heading.)
(Fixed up the stuff about domains so it is hopefully clearer, and removed some things that belong elsewhere.)
Line 212: Line 212:
   </tr>
   </tr>
</table>
</table>


= Domains =
= Domains =
Line 217: Line 218:
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>.


So 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). So 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>.
When [[Mod Packaging|making 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.
 
If no domain has been specified it will refer to the current domain. Meaning you only have to add a domain prefix if you want to refer to something outside the current domain.
 
= Mods =
 
A mod (most likely a zip file) can be installed by copying the file in your Mods directory inside your [[Vintagestory folder]].


== Creating your own domain ==
So 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). So 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>.


In order to make the game load your own assets, you have to create a zip file, which has to have a similar structure as the assets folder of Vintagestory. The only difference is the domain folder, which is located below the assets directory and allows you to either create a new domain or refer to existing ones.
If you want to create a new block for example you can use your own domain <code>assets/mymoddomain/blocktypes/myblock.json</code>. In this case the folder <code>mymoddomain</code> specifies the domain and therefore the code of the added block will be <code>mymoddomain:myblock</code>.


== Overwriting assets ==
== Overwriting assets ==
Line 237: Line 230:


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.
= Themepacks =
You can install a themepack by copying the file into the Themepacks directory inside your [[Vintagestory folder]].


{{Navbox/modding|Vintage Story}}
{{Navbox/modding|Vintage Story}}

Revision as of 03:14, 6 March 2018

Vintage Story loads most of its game content from so called assets. Those can be found inside the assets directory inside your Vintagestory folder. Things such as blocks, items, world generation, recipes, etc. are all loaded from assets during startup.

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 examples to learn about what you can do with it.

Categories

Here is an overview of categories:

Name Affects Gameplay Side Type Usage
AssetCategory
blocktypes
true universal Blocks
itemtypes
true universal Items
lang
false universal Translation
worldproperties
true universal
abstract
true universal
block
true universal
sounds
false universal Sounds
shapes
false universal Blocks
block
false universal Shapes for blocks
entity
false universal Shapes for entities
item
false universal Shapes for items
recipes
true server only Recipes for all kinds of machinery
alloy
true server only
grid
true server only Recipes for Workbench
smithing
true server only
worldgen
true server only
terrain
true server only
tree
true server only
entity
true server only Entities
shaders
false client only
shaderincludes
false client only
textures
false client only
block
false client only Block textures
item
false client only Item textures
decal
false client only Decaltextures
entities
false client only Entities textures
environment
false client only Environment textures (Sky, Moon, Sun, etc.)
gui
false client only Gui textures
hud
false client only Hud textures
particle
false client only Particle textures
music
false client only
dialog
false client only


Domains

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 game.

When making a mod you specify a domain by placing a directory inside the mod assets 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.

So 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). So instead of using assets/textures/blocks/leather.png, you would have add the prefix for the domain game:assets/textures/blocks/leather.png.


Overwriting assets

There are no limitations to the system. So you can overwrite assets from Vintagestory itself by using the game domain folder.

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

Theme packs can only override assets that do not effect game mechanics, the other mod types can override any asset.

Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.