Changes

Jump to navigation Jump to search
754 bytes added ,  14:35, 6 February 2020
no edit summary
Line 1: Line 1:  +
Furniture packages should be located in subfolders in the "Furniture" folder with the game. A furniture package will inherit its name from the folder name.
 +
 +
== Helpful console commands ==
 +
 +
* '''RELOAD_FURNITURE''' - Reloads all furniture mods immediately
 +
* '''FURNITURE_DEBUG True''' - Adds an in-game overlay to the selected furniture showing its boundary, navigation mesh, interaction points and snap points
 +
* '''FURNITURE_THUMBNAIL X''' - Generates a thumbnail for the the furniture named X and places it in the Furniture folder. This command only works in the main menu
 +
* '''EXPORT_FURNITURE_BOUNDS X''' - Exports the auto generated furniture boundaries (created by adding the '''AutoBounds True''' record) and puts it in the TyD file for the furniture named X. This should be done when you're finished with the furniture, to avoid having the game generate them on every startup. This also allows you to change them in the TyD file.
 +
* '''UNLOCK_FURNITURE''' - Allows you to place furniture that hasn't been unlocked in-game
 +
 
== Furniture modding ==
 
== Furniture modding ==
Furniture modding is available as of Alpha 8.10.13
+
=== TyD file layout ===
 +
Each furniture should be defined in separate  [[TyD|TyD]] files.
   −
Furniture packages should be located in subfolders in the “Furniture” folder with the game. A furniture package will inherit its name from the folder name.
+
The Furniture table should have a '''Thumbnail''' record with a relative path to a 128x128 thumbnail to use in-game.
   −
You can reload furniture while in-game by bringing up the console and executing the RELOAD_FURNITURE command.
+
The Furniture table can also have a '''Base''' record to inherit from an existing furniture from the game. If you define the record '''AutoBounds True''', the game will auto generate the navigation mesh, building boundary, vertical span, x and y grid offset, width and vertical offset for wall furniture, and collision box for selection, based on the furniture meshes, otherwise these can be controlled in the Furniture component by setting the variables BuildBoundary, NavBoundary, Height1, Height2, OnXEdge, OnYEdge, WallWidth, YOffset and the BoxCollider component.
You can generate thumbnails by bringing up the console in the main menu and executing the FURNITURE_THUMBNAIL command with the name of your furniture as parameter.
     −
=== XML Generator ===
+
You can check your build and navigation boundary, and interaction and snap points by enabling furniture debugging using the command '''FURNITURE_DEBUG True''' in the console and selecting the furniture you want to review in-game. The navigation boundary is located on the floor and goes from green to pink. The build boundary also illustrates Height1 and Height2 and goes from cyan to red. Interaction points are blue and snap points are yellow:
[http://demannu.com/softwareinc/gen.php Furniture XML Generator]
  −
This tool is currently under development, it is stable for producing basic XML files for objects
     −
=== The XML and basic tags ===
+
[[File:FurnDebug.png]]
Each furniture should be defined in separate XML files.
  −
 
  −
The root tag in a furniture xml file should have a Thumbnail attribute with a relative path to a 128x128 thumbnail it should use in-game.
     −
The root tag can also have a Base attribute to inherit from an existing furniture from the game. If you define the attribute AutoBounds to “True”, the game will auto generate the navigation mesh, building boundary, vertical span, x and y grid offset, width and vertical offset for wall furniture, and collision box for selection, based on the furniture meshes, otherwise these can be controlled in the Furniture component by setting the variables BuildBoundary, NavBoundary, Height1, Height2, OnXEdge, OnYEdge, WallWidth, YOffset and the BoxCollider component.
+
'''It is highly recommended that you run the command EXPORT_FURNITURE_BOUNDS with your furniture name as parameter, if you've used the '''AutoBounds True''' record. This command bakes the bounds information in the TyD file so it doesn't have to be recalculated each time the game launches.'''
   −
You can check your build and navigation boundary, and interaction and snap points by enabling furniture debugging using the command "FURNITURE_DEBUG True" in the console and selecting the furniture you want to review in-game. The navigation boundary is located on the floor and goes from green to pink. The build boundary also illustrates Height1 and Height2 and goes from cyan to red. Interaction points are blue and snap points are yellow:
+
=== Hierarchy ===
 +
Every object you add to your furniture can be given a name using a '''ComponentName''' record and can be added as a child transform to another object by using a '''TransformParent''' with the ComponentName of the other object. If '''TransformParent''' is not defined, the object will be added to the root furniture object.
   −
[[File:FurnDebug.png]]
+
You can define a list of empty Transforms using a Transform list with object that define Position, Rotation (in degrees as Euler angles) and Scale.
   −
'''It is highly recommended that you run the command EXPORT_FURNITURE_BOUNDS with your furniture name as parameter if you've used the AutoBounds attribute. This command bakes the bounds information in the XML file so it doesn't have to be recalculated each time the game launches.''' This command has been introduced in alpha 8.10.15.
+
You can add Unity components to any tranforms and objects by using the '''TransformParent''' record in a table that has the same name as the UnityComponent you want to add, e.g. '''Light'''.
    
=== Meshes and materials ===
 
=== Meshes and materials ===
Meshes will be loaded from the Models tag. The Models tag should contain children tags that define meshes. Each mesh tag should have a File tag, with the relative path to an obj file, a Position, Rotation and Scale. Optionally, the mesh tag can have a Parent attribute, to make it a child transform of an object with the specified name, a ComponentName tag to name the mesh for later reference(e.g. to make it a parent for another mesh or transform) and a Material tag to give it a material.
+
Meshes will be loaded from the Models list. The Models list should contain a list of tables that define meshes. Each mesh table should have a File record, with the relative path to an .obj file, a Position, Rotation (in degrees as Euler angles) and Scale (Should always be positive). Optionally, the mesh tag can have a '''TransformParent''' record, to make it a child transform of an object with the specified name, a '''ComponentName''' record to name the mesh for later reference(e.g. to make it a parent for another mesh or transform) and a '''Material''' record to give it a material.
   −
Materials can either be any material you want or the default material, which is much better performance wise and allows the player to colorize the furniture. If you don't specify a material, the default material will be used and the meshes should be UV mapped according to the texture shown below. You can also supply your own texture to be used by the default material, in which the red color channel will be mapped to color 1, green is color 2 and blue is color 3. Grayscale pixels will not be color mapped. The alpha channel controls smoothness/specularity where 99% transparent means full specularity. 100% transparency is specifically used for glow in the dark materials, but note that Photoshop destroys RGB channels for transparent pixels when you save as PNG, unless you keep the alpha mask on your layers before you save and you need to have a color defined for the glow.
+
If you omit the Material record, it will automatically select the in-game default furniture material, which has great performance and allows the player to colorize the furniture. The default material works by mapping the Red, Green and Blue channels to the colors the players has picked for the furniture, while greyscale pixels remain greyscale. Furthermore, the alpha channel is used to control material smoothness and emission/glow. 100% alpha will make the material rough and then smoother as the alpha decreases, 0% alpha will make the material glow in the dark (Note that some image editing software will destroy your RGB channels if the alpha channels is 0%, e.g. Photoshop). If you use the default material, you should UV map your furniture to the texture pictured below. You can also set the Material record to '''Glass''' to use the in-game glass shader.
    
[[File:NewFurnUV.png]]
 
[[File:NewFurnUV.png]]
   −
If you decide to use your own materials, you should have a Materials XML file in your furniture package folder, in which you define your materials. The Materials.xml file should have a root tag with material tags as children and each material will be named as its tag. If a material tag has the the Standard attribute as shown below, you should supply a relative path to one 256x256 texture in the a child <Texture> tag, which will be used for the standard colorable texture (as described above), any other child tag will be ignored:
+
If you want to use your own materials and textures, you need to add a '''Materials.tyd''' file. It should contain a list of tables that define your materials. The first record in a material table should be the '''Type''', which can be one of the following values:
 +
* Unity, the default Unity standard shader as of Unity 2017.4 (http://unity3d.com/get-unity/download/archive)
 +
* Standard, the default furniture shader used in-game
 +
* Atlas, a shader that allows the player to change the furniture texture, which works well for paintings
   −
<MyMaterial Standard="True">
+
Each table can have 3 tables
 
+
* Textures
If you want a completely custom material, you should have up to three children: Textures, Floats and Colors. All materials use Unity’s default material. If you want to set the texture you would write <_MainTex>test.png</_MainTex>. All textures will be loaded in 256x256. If you want to see all the colors, floats and textures you can change, refer to Unity’s default shader, which can be downloaded here: http://unity3d.com/get-unity/download/archive . Some variables include:
+
* Floats
 +
* Colors
 +
Each can contain a set of records that define textures, numbers and colors, where the record names should reference actual shader variables as defined in Unity, e.g:
 
* _MainTex
 
* _MainTex
 
* _BumpMap
 
* _BumpMap
Line 44: Line 55:  
* _Color
 
* _Color
   −
To apply the material to a model, simply add a Material tag to the model naming your material.
+
==== The standard furniture shader ====
 +
 
 +
 
 +
==== The atlas shader ====
 +
 
    
=== Interaction points ===
 
=== Interaction points ===

Navigation menu