Nick:  
Pass:     
Help Register


Post Reply 
Modding Building modding
Author Message
Rasmus Offline
Main developer of Dwelvers
Dwelvers Developers

Posts: 3.619
Joined: Sep 2013
Reputation: 502
Post: #1
Building modding
Modding buildings


Some modding possibilities has now been introduced to some of the buildings. What has changed with the 0.8f version is that all the buildings textures and models now have been moved into a separate folder together with the xml file for the building.

All buildings now have their content loaded through the xml files, this includes textures, models, animations, handles, selections etc. Some of the buildings graphics are also totally controlled through the xml file, this includes static buildings such as walls, floors and decorations. Other buildings such as the mill are still rendered through hard coding and is not accessible by the user.

Here I will only go through the what the different tags in the xml files means if anyone would like to modify a building, and if you do I would love it if you could share your creating with the forum, perhaps I will add it into the game as well Smile

Some info before starting

All the attributes that are marked in bold are required attributes, they don't have a default value and the game will not load unless these are added.

Skinned models, animations, selections and handles are custom file types generated by 3DSMax, to be able to export these filetypes you need 3DSMax and these scripts that are downloadable here: www.dwelvers.com/files/modding/scripts/maxscripts.zip

Loading building content

<model>
Code:
<model id="roof" filename="RoofHiPoly.3ds" filelodmid="RoofMidPoly.3ds" filelodlow="RoofLowPoly.3ds" color="RoofColor.png" normal="RoofNormal.png" specular="RoofSpec.png" mixcolor="RoofMixColor.png" mixnormal="RoofMixNormal.png" mixspecular="RoofMixSpec.png" fullres="1"/>

The tag (in this case 'model') shows that we are going to initialize a new static model.

Attributes
  • id - This attribute links this model with this id. So when we are going to call on this model in the future we will use the id 'roof' as in the example above.
  • filename - This is the 3d model that needs to be loaded. This model must be in 3DS format.
  • filelodmid - This 3d model need to be a less detailed version of the one loaded with 'filename', this is out of optimization reasons so that we don't render a fully detailed model at the distance when it is barely visible. If this attribute is not included it will just use the 'filename' model.
  • filelodlow - This 3d model need to be a less detailed version of the one loaded with 'filelodmid', this is out of optimization reasons so that we don't render a fully detailed model at the distance when it is barely visible. If this attribute is not included it will just use the 'filelodmid' model.
  • color - The color texture that the model will use. This must be specified unless an itemtexture is set (explanation below).
  • normal - The normal texture that the model will use. This must be specified unless an itemtexture is set (explanation below).
  • specular - The specular texture that the model will use. This must be specified unless an itemtexture is set (explanation below).
  • mixcolor - If included this color texture will blend together with the default color texture to create more variations.
  • mixnormal - If included this normal texture will blend together with the default normaltexture to create more variations.
  • mixspecular - If included this specular texture will blend together with the default specular texture to create more variations.
  • fullres - Can be set to either '0' or '1', it is '0' by default, but if set to one the game will use the textures full resolution and not compress it into a 256x256 texture. It may look nicer, but it is something that shouldn't be used to frequently as it will lower the fps.

Code:
<model id="ironingotcool" filename="ironingot.3ds" itemtexture="IronIngot"/>
  • itemtexture - This itemtexture can replace the color, normal and specular attributes. But if this one isn't specified then the color, normal and specular attributes must be. What the itemtexture does is that it assigns the texture used by the item (in this case the 'IronIngot') to the model. This is useful for several reasons, it saves memory and loading time, and also if the texture for the item were to be changed we don't have to change it at several locations.

<selection>
Code:
<selection id="storage" filename="storage.slc"/>

The tag (in this case 'selection') shows that we are going to initialize a new selection. Selections are a file built up with an list of 3D coordinates and are used in storage rooms and chests especially. Each 3D coordinate represents a location where the items can be rendered, and the amount of 3D coordinates shows how many items can be held by the building.

Attributes
  • id - This attribute links this selection with this id. So when we are going to call on this selection in the future we will use the id 'storage' as in the example above.
  • filename - This is the selection file that needs to be loaded.


<handle>
Code:
<handle id="bread" filename="Bread.hdl"/>

The tag (in this case 'handle ') shows that we are going to initialize a new handle. Handles are a file that contains a single matrix which tells the game a location, scale and rotation. This is useful information when the user wants a specific model to be rendered in a specific angle or size.

Attributes
  • id - This attribute links this handle with this id. So when we are going to call on this handle in the future we will use the id 'bread' as in the example above.
  • filename - This is the handle file that needs to be loaded.

<skinnedmodel>
Code:
<skinnedmodel id="smelterhandle" filename="smelterhandle.skin" color="GearColor.png" normal="GearNormal.png" specular="GearSpec.png"/>

A skinned model is a model with bones assigned to it. This is used when it comes to animations, the creatures in the game uses the same file format.

Attributes
  • id - This attribute links this skinnedmodel with this id. So when we are going to call on this skinnedmodel in the future we will use the id 'smelterhandle' as in the example above.
  • filename - skinnedmodel that needs to be loaded.
  • color - The color texture that the skinnedmodel will use.
  • normal - The normal texture that the skinnedmodel will use.
  • specular - The specular texture that the skinnedmodel will use.


<animation>
Code:
<animation id="smelterwaiting" filename="SmelterWaiting.anim" skinnedmodelid="smelterholder"/>

These animations are used by skinned models only.

Attributes
  • id - This attribute links this animation with this id. So when we are going to call on this animation in the future we will use the id 'smelterhandle' as in the example above.
  • filename - animation that needs to be loaded.
  • skinnedmodelid - The id of the skinnedmodel this animation is connected too.


Appearance

<blueprint>
Code:
<blueprint id="roof"/>

The blueprint is what model id will be used with construction sites. In this case it is the 'roof' model id that was specified above.


<blocksmoother>
Code:
<blocksmoother color="RockColor.png" normal="RockNormal.png" specular="RockSpec.png" mixcolor="RockMixColor.png" mixnormal="RockMixNormal.png" mixspecular="RockMixSpec.png"/>

The blocksmoother is an add on effect created by the game to make blocks like the rock wall look a little smoother. It will create round corners over the model with the texture specified with the attributes.

Attributes
  • color - The color texture that the blocksmoother will use.
  • normal - The normal texture that the blocksmoother will use.
  • specular - The specular texture that the blocksmoother will use.
  • mixcolor - If included this color texture will blend together with the default color texture to create more variations.
  • mixnormal - If included this normal texture will blend together with the default normaltexture to create more variations.
  • mixspecular - If included this specular texture will blend together with the default specular texture to create more variations.

Rendering

<package>
Code:
<package claimed ="1" scalemin ="100" scalemax="100" rotationmin="0" rotationmax="0" alwaysontop="0">
    <render id="roof" type="roof"/>
    <render id="wall" type="outerwall" blocksmoother="1"/>
  </package>

A package tells the game what will be rendered with this building when it is at the top layer. The package can contain several model id's that the game will loop through and render and show above. In this case we have a roof and a wall that needs to be rendered. If several packages is defined in the xml file the game will randomly choose one of them with each tile.

Attributes for package
  • claimed - This tells the game if the models rendered in the package is a claimed model or not. It is useful when it comes to rooms connected to the wall if they have their own walls or not. The storage room will for example not render its wall towards an ordinary rock, but it will towards a reinforced wall that is claimed. Its value can be set to '0' (false) or '1' (true), default value is '0'.
  • scalemin - The minimum scaling of this package, useful when it comes to letting the game creating variations between the models, bushes and trees are something that commonly uses this attributes.
  • scalemax - The maximum scaling of this package.
  • rotationmin- The minimum rotation of this package.
  • rotationmax- The maximum rotation of this package.
  • alwaysontop - Can be set to '0' (false) or '1' (true), default value is '0'. When set to '1' it will always render the model on top of the tile, this is when there are a possibility for the model to be rendered on both a floor and a wall building and if the model is rendered on a wall building it will intersect the wall unless this is set to '1'.

<render>
Code:
<package claimed ="1" scalemin ="100" scalemax="100" rotationmin="0" rotationmax="0" alwaysontop="0">
    <render id="roof" type="roof" pattern="zigzag"/>
    <render id="wall" type="outerwall" blocksmoother="1"/>
  </package>

A render tells the game what model id will be rendered with the package.

Attributes for render
  • id - The id of the model that is going to be rendered.
  • type - This tells the game what rendering type this model will have. There are several types and these are explained below.
  • blocksmoother - Can be set to '0' (false) or '1' (true), default value is '0'. When this is defined it will tell the game that if this model is rendered then the blocksmoother should be rendered as well. It is important to only define this one time per package so that several blocksmoothers aren't rendered over the same block.
  • pattern - This tells the game what rendering pattern this model will have. Right now there is only 'zigzag' available, and this will make it so that the the model will be rendered with either a north direction or a east direction in a chess-like pattern.

Different rendering types
  • misc - Will render the model as it is on the tile.
  • floor - Will render the model as a floor model.
  • threshold - Will render the model as a threshold model, useful for rooms.
  • roof - Will render the model as a roof model.
  • outerwall - Will render the model as an outer wall model. This is for rendering blocks like 'rock' or 'claimed walls'.
  • rooftoplayer - (roof-top-layer), will render the model as a roof when it is on the top layer. The walls and roofs at the top layer of the dungeon is 25% higher than the other walls.
  • outerwalltoplayer - (outer-wall-top-layer), will render the model as a outer wall when it is on the top layer. This is for rendering blocks like 'rock' or 'claimed walls'. The walls and roofs at the top layer of the dungeon is 25% higher than the other walls.
  • pillar - Will render the model as a pillar model, useful for rooms.
  • wall - Will render the model as a room wall model. This is for rendering walls inside rooms.
  • wallitem - Will render the model as a wall item model, like wall decorations.


<layerpackage>
Code:
<layerpackage claimed ="1">
    <render id="wall" type="outerwall"/>
  </layerpackage>

An layerpackage tells the game what will be rendered with this building when it is rendered below the top layer. It works the same as the <package>, but will only be rendered when it is below the top layer.
21-10-2014 08:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)


© 2013-2017 Dwelvers | Contact