News:

Welcome to World of Banished!

Main Menu

Creating a 3d model house in blender and making it available in game

Started by Discrepancy, June 26, 2016, 09:24:38 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Discrepancy

Hello,

I thought I would try to make a (hopefully) straight forward tutorial for anyone wanting to get a model into banished.

I'm using Blender 2.76, this a free open source program, updated often  you can download lastest version for free here.

First up I'll give a list of the my most used keyboard shortcuts for blender when 3d modelling (these are very handy, and enable quicker and less tiresome 3d modelling):
tab = change between Edit / Object mode.
shift + A = Add a mesh / a shape predefined or adjustable.
A = toggle between Select all / Select none
L + hovering cursor over vertex/edge/face = Select Linked, selects vertices attached.
shift + D = adds a duplicate of the selected vertices
E = extrudes face/edge/vertex
S = Scale, adjust the scale, size of the selected vertices
R = Rotate
Also using the numpad buttons 1-9,
most important is:
1 = front view
3 = side view
7 = top down view

alternatively many of these can be accessed through a menu (bottom left of my screen [View | Select | Add | Object/Mesh] in the pictures below)


links to sites that I have used to learn from:

The Blender Manual
Blender Keyboard shortcuts
and a good printable quick access for most used shortcuts: BlenderHotkeysCheatsheet.pdf

and a tutorial that helped me a lot:
Creating a Low Poly Medieval House in Blender: Part 1
& mostly Part 2

I will post the full tutorial over the next few days...


I will also upload all code and source code, as well as a .pkm version for those who just want to play :) I hope to inspire a lot of would-be modders.

Discrepancy

Creating a 3d model house in blender and making it available in game
Part 1

Open up Blender, start a New project,
delete everything (press the A key to select all, press del and then enter key),
In the Properties window panel, click on 'Metric'(1), and ensure that the scale is set to 1.000 (2)
It should look like this:



Setting the measurement system and scale to metric will mean that a square in Blender will represent a game tile square in Banished.
Orientate your view so that the Y-axis travels away from you (3) – this is your North point in the game.
Also ensure you are in 'Object Mode'.

Press shift + A then click on  Add – Mesh – Cube



Press Tab to enter into 'Edit Mode' (4).
Click on 'Face Select' (5), and then click on the icon next to it 'Limit Selection to Visible', this will allow you to see through the now semi-transparent faces for easier editing.



Press A key to deselect the cube.
Now select only the lowest face, and in the 'Transform' window pane, change the Median  Z: to 0m (6), this will bring the bottom of the cube up to ground height.



We are going to make a house with a footprint of width 4 x height 3 + road, to sit in a 4x4 plot.
In blender, from point 0,0,0 (the 0 point at which the x,y,z – axis points meet) we will make our model fit within the 2 squares to either side to that point...

By selecting faces one at a time, move the cube and adjust shape and size so it looks like this:



This will be the stone foundation.



Using a selection of 'Edge Select' (7) to adjust the edges of the mesh, and then using the E key to extrude faces, create the houses stone foundation to look like this:



rotating your view , and holding shift while selecting the individual faces of the underside of the foundation, press delete, and press Delete – Faces.



Press A key to select all. Then press ctrl + E to bring up Edges menu, click on 'Mark Seam' and this should have marked all of the surrounds of the foundation faces in red:



Press A to select all again, then press U to bring up the UV mapping menu and click on 'Unwrap'.

Now we need to bring up another view with the UV map on it.
Top Right of the screen (8) drag the little angle lines to the left, hide away the new duplicate menus that appear, then load up the UV/Image Editor view:



Now in this new view you will see the UV mapping that will call up the textures. I'm going to give a quick basic tutorial, textures will be basic. In this new view, press S key and scale down the foundation faces on the UV square, and we will later create a basic texture.


Now, back to the 3d view, we will be making the wooden frame. We will add a new mesh cube by pressing shift + A to add a new mesh-cube.
Use the arrows to move it around, then press S to scale it smaller, adjust the faces to make an upright next to the doorway.



Now select only the top face, the bottom face and only one of the side edges, press ctrl = E, 'Mark Seam', hover over mesh, press L to select all connected vertices, press U, select 'Unwrap'.



Scale down the UV map of the wooden frame upright, and place away from the area you put the stone foundation UV map



Now back to the 3d view, we will deselect all, then only select the wooden frame upright we just created (hover over press L to select all connected vertices).
Press shift + D to duplicate, move each duplicate around the foundation to create the houses uprights for its frame.



Now duplicating one of the uprights again, press 1 on your keyboard's numpad to bring up front view, press R key to rotate and create a horizontal piece and using what we've learned, and utilise brining up the front, side and top views, duplicate, rotate and adjust pieces until you have a frame like this:



In side view (press 3 on the numpad), use the 'Loop Cut and Slide' tool (10),
And with new edges in each roof truss, adjust so they are more 'rounded':



Create a duplicate of one of the trusses, move to the centre of your frame, to create a centre truss.
Press tab to exit to 'Object mode',
Your model should  loosely resemble this:



Next, click on 'Object' (11), then 'Apply' (12), then 'Location' (13), again: Object, Apply and then this time 'Rotation & Scale' (14).



Save your project as a blender file.



Discrepancy

Part 2


Keyboard shortcus for working in UV mapping view:
S = Scale
G = Move
R = Rotate
W = Weld/Align tools
L = Select connected vertices




In part 2 we will finalise the 3d model.
First we will add the roof and walls.

Back into 'Edit Mode', add a new plane (press Shift + A, select Plane), move it into place over the centre of the house frame.
By selecting the planes face, click on 'Subdivide' (13) this will split the face into 4 planes, the using the 'Knife' tool, cut a new edge line from the centre of the roof to the outer corners. Pull down the edges and and make slight adjustments to create a roof like this:



Select all the edge lines of the roof piece we just made.
Press ctrl + E to mark the seams, then by hovering over only a section of the roof plane, press L to highlight the rest of the roof,
Press U and unwrap the roof, it should have shown up in the UV window like this:



Adjust the UV layout do the roof fits into the top right,
Your house and UV should look like this when you select all:



Now we will add a front wall, by adding another plane and moving it into the frame and adjusting so it sits just back from the wooden frame,
It will look like this:



Now mark the seam of this wall and unwrap like we have done before scale and move the wall in the UV view to the bottom right.

Continue duplicating (shift + D) this front wall and fill up all the sides of the house.
By doing this, like we did with the Wooden frame, all of the walls will grab the same texture.



Fill up most of the holes between the walls and roof by using all you've learned.
Utilising the 'Loop Cut and Slide' tool (10), as well as the 'Knife' tool (13) will help you to split faces and then move edges around to fill in the gaps.

Once done we will add a chimney to the building.

I have pressed shift + A, added a new cube and moved it next to the wall and altered the shape like this:



Next click on the top face of this cube and press E to extrude the face, pull this new section up over the roof, and click. With the top face still selected, press S to scale it slightly smaller than the base:



Now using the extrude and scale tools I made a 'lip' on the top of the chimney, and then made it go back down into the chimney a bit to create a 'hollow':



Delete the ground face on the chimney, deleting faces that are not visible is good practice to keep the poly count low.

Select all of the chimney (press L to select all connected vertices), move it back away from the house so we can UV unwrap it easier.

With 'Edge Select' active, highlight all of the bottom edges, then highlight one side of the rear chimney edge:



Now zoom in and only select the edges that run around the bottom of the chimney 'lip'.



Press ctrl + E to mark the seam you just highlighted, then deselecting, mark out the chimney 'lip' seam lines like this:



Mark the seam, and then select all of the chimney, and press U to Unwrap the chimney.

In the UV window it'll look like this:



Using the tools for the UV map (see top of this post), scale, rotate and align edges to fit within the whole UV map:



I have moved the chimney lip to a place that overlaps with what will be the foundation texture.

Back into the 3d view, select only the chimney and bring it back next to the house.

Now add a new plane, and adjust it so that it sits back within the door frame:



Mark the seams on this, and then Unwrap to bring it up on the UV map. Adjust so that is fits between everything:



Now add in a new cube, this time scale and adjust, we will make a window, delete the back face, and then mark the seams like this:



Unwrap, and adjust on the UV map. I have moved the sides of the window to the same spot as the wooden frame to share the same wood texture. Select the window and then move it into the wall next to the door, I also duplicated it and added another window on the side wall.



So that is going to be our basic house model.
Exit to 'Object Mode' (press tab key), and it will look like this:
Ensure the model is still located at 0,0,0, click on 'Object' – 'Apply' – 'Location' and then 'Apply' - 'Rotation & Scale'



Save your work :)

Discrepancy

Part 3


In part 3 we will be adding the (AO) Ambient Occlusion, creating the texture file, the build models and adding the points.



.... baking the AO

In 'Object Mode', add a new plane, align it to 0,0,0. Scale it so that it is larger than the house:



We add this to stop light shining through the bottom of the house when new bake the AO.

Select the house model, and in the properties window select 'World' (15), then activate 'Ambient Occlusion' (16), adjust the 'Gather' sample count to 10 (17).



Now click on the 'Render' tab (18), scroll down until you find the 'Bake' section, change the Bake mode to Ambient Occlusion (19), change the margin to 10px (20)



Now in the houses 'Edit mode', select all, and then in the UV view, click on 'Image' – 'New Image', keep all the default settings, and size of 1024x1024. Press okay.
Now click on the 'Bake' button (21).



The ambient occlusion will have been 'baked' on this new image, you will see the effects in the UV view.
Press 'Image' – 'Invert' – 'Invert Image Colors' this will make the AO image have a predominantly white appearance, need to work with Banished.
Press 'Image' – 'Save as Image', save as an RGB (22) .png file, I named mine SmallTownHomeAO.png
Click on 'Save as image' (23)



Back in the UV view, click on 'UVs'  - 'Export UV Layout' – change the 'Fill Opacity' to 0.000 (24).

I named my file SmallTownHomeUV.png, ensure it is saving as .png, click on 'Export UV Layout' (25)



Enter into 'Object mode', select the plane we made just prior to baking the AO, and delete it as it is no longer needed.

Save your file.



.... Texturing

Now open up your SmallTownHomeUV.png image in a Image Editing program, I am using Adobe Photoshop, but there are plenty of others (and free ones) that can be used.

We want to now start adding textures to fit within the UV lines,

Put your textures into separate 'Layers' for easier editing..

All sorts of textures can be found on the internet for free use (I got all of these textures from Textures.com – requires setting up a free account)

This is what I have done for the textures:



Before saving I hide the UV lines, then I save the image as a .png format (SmallTownHome.png).



.... creating the Build models

Back into Blender.

Load up your .blend model of the house if not already.

Then 'File' – 'Export' – 'FBX'  keep all settings as is, make sure  scale is set to 1.00 , pick a file name, I saved mine as SmallTownHome_nopoints.fbx

Save your file.

Back into 'Edit mode',

and now for what I think the fun part is.... making the build models.

Before you start it is a good idea to firstly save this file again but as a different save – call it something like SmallTownHome_build02.blend

Now, in 'Edit mode' start deleting parts and moving sections of the mesh as if you were dismantling the house in reverse to someone building it...

For example I deleted the roof first, then I deleted the door and windows and all the walls. (depending on your design you could incorporate more build models, but in this tutorial I'm trying to keep it pretty simple)



From here I save again (as SmallTownHome_build02.blend), then I export this an .fbx like we did earlier.


Now save a new .blend save – build01

Delete more, or move things around like they have just gotten to building site. Build 01 is what you see after the resources have been taken to the houses footprint.



Build 01, saved and exported as an .fbx file also.


Now that all of our models are made, we can reopen up the complete house .blend save.

We now need to add 'points' for the game to interact with the building.

In 'Object mode', press shift + A and 'Add' – 'Empty' – 'Plain Axes'

Using the 'Transform' properties menu window, orientate this so it is at 0,0,0 (26).
Then change the name of this to 'points' (27)



Add in more points in the same manner, this time, keep them all at ground level (z-axis=0), name them:
build_001
build_002
use_001

by clicking on the little icons next to the names of the points, drag them all onto the 'points' to 'Drop to Select Parent'
it should look like this:



Now add in a new point, this time it will be called 'smoke', move it so that it is sitting within the chimney slightly, set it's parent to 'points'.

Save the file.

Now delete the house mesh object, so you will only have the points.

Export this as an FBX, (SmallTownHome_points.fbx)




Now you can close blender (don't save when prompted otherwise you will loose you model


... in part 4 we will be creating all the code. We are getting close to finishing :)

Discrepancy

Part 4


It is a good idea to try to familiarize yourself with the basic ways in which a mod needs to be put together.
Taking a look at the examples in the mod kit and within the resource folder to see how elements of the game works.
Download and install your Banished modKit, (install to main drive and with no '.,-' symbols in the folder paths)

My modkit, and path to this mod is installed on my main hard drive like this:

C:\BanishedKit106\MyMods\SmallTownHome

Within this 'SmallTownHome' folder I will create more folders and copy files from the example mods as well as from the resource folder.

Create folders called: Dialog / Models / Template / Texture / UI all within the 'SmallTownHome' folder

Into the Dialog folder, make a copy of 'SharedElements.rsc' no need to change the name or anything within the file, but it will be required when compiling. (can be found in modkit folder/resource/Dialog)

Out of the Apiary/Models example folder, copy all the .rsc files named with Apiary.... leave the one named honeyMesh, this is not needed. Copy these into your own Modles folder.

Time to start altering these files so they will link to what we're making.

I start by changing the filenames first, substituting 'Apiary' with 'SmallTownHome',
Then open up each file in notepad, and do the same for all the instances that it says 'Apiary'.

Create a folder within this Models folder, and name it 'MaterialInstance'
In it put the .png files we created – the texture rile and the AO image. Don't need the UV image.

Again from the Apiary example folder, copy the .rsc files from this folder that are concerned with the Apiary only, except for the one concerning the ApiaryFootprint, we don't need these.

Back in our own folder, rename the file names and substitute 'Apiary' for 'SmallTownHome', do the same inside all the files, but with the Build01 and Build02AO files, link the images all to the same .png file – 'SmallTownHomeAO.png' This is because we only made the one AO image in this tutorial (if wanted, they can be easily made though by baking a new AO in the 2 build saves and exporting the image like before)

After this your Models folder, and Models/MaterialInstance folder should look like:



From the resource/Template folder, copy the 'Woodhouse.rsc' file, put it into your own template folder.

Change the file name to 'SmallTownHome.rsc'

in it scroll down until you find this section:

ToolbarDescription toolbar
{
SpriteSheet _spriteSheet = "Dialog/SpriteSheet.rsc";
String _spriteName = "BuildHouse";

StringTable _stringTable = "Dialog/StringTable.rsc:objects";
String _stringName = "WoodHome";
String _stringNameLwr = "WoodHomeLwr";
String _toolTip = "WoodHomeTip";

String _statusStrings
[
"CreateOk",
"CreateBlocked",
]

int _group = 3;
}


This is the section that makes all the connections for the menu button, icons and text regarding the house.
Change it to:
ToolbarDescription toolbar
{
SpriteSheet _spriteSheet = "UI/SmallTownHomeSpriteSheet.rsc";
String _spriteName = "BuildSmallTownHome";

StringTable _stringTable = "UI/SmallTownHomeStringTable.rsc";
String _stringName = "SmallTownHome";
String _stringNameLwr = "SmallTownHomeLwr";
String _toolTip = "SmallTownHomeTip";

String _statusStrings
[
"CreateOk",
"CreateBlocked",
]

int _group = 3;
}


Under this code you will find:

CreatePlacedDescription createplaced
{
PathBits _placeBits = Normal | Obstacle;

int _width = 4;
int _height = 5;
int _footprintRotation = 0;

PathBits _placeBitArray
[
Normal | Obstacle,
Normal | Obstacle | Fast | Faster,
]
String _placeBitmap =
"0000
0000
0000
0000
1111";

ComponentDescription _allowAndRemove = "Template/Clear.rsc";
}

MapDescription map
{
PathType _pathType = Immovable;
String _pathBitmap =
"####
####
####
###_
....";

bool _addToOverhead = true;
Color _mapColor = 0xFF545454;
}


This is the section that controls how the house sits on the game tiles.
In Blender we have made our house to sit on a footprint of 4x3 + road tiles (4x4)

So we need to change the createplaced to:

CreatePlacedDescription createplaced
{
PathBits _placeBits = Normal | Obstacle;

int _width = 4;
int _height = 4;
int _footprintRotation = 0;

PathBits _placeBitArray
[
Normal | Obstacle,
Normal | Obstacle | Fast | Faster,
]
String _placeBitmap =
"0000
0000
0000
1111";

ComponentDescription _allowAndRemove = "Template/Clear.rsc";
}


the placeBitArray, is what the placeBitmap is calling up info from.
The first line ' Normal | Obstacle,' = 0 in the placeBitmap,
so when we have the 0's listed, it is saying it is an Obstacle (building) that can be placed on Normal (level) terrain.
While the 1's mean it can have a road travel on the tiles, though it is still an obstacle so cannot have another building built there.

Now we change the next part the map description.
Our building will look like this:
MapDescription map
{
PathType _pathType = Immovable;
String _pathBitmap =
"####
####
##_#
....";

bool _addToOverhead = true;
Color _mapColor = 0xFF545454;
}


The #'s mean that it is a solid building, the _ (underscore) is passage that citizens can take 'inside' a building, and the .'s (dots) are the part that  assigns a road to be built on the front tiles? I think
The other section is what for the display on the overhead game map.

Thanks goes to Kralyerg for giving me insight into how the placeBitArray and placeBits work.


Next we will change the rest of the template file to link up to the model and materials.
A fair bit will need to be deleted from the woodhouse.rsc as it has many F-key variants.
It should look like this:
DecalDescription decal
{
MaterialInstance _materials
[
"Terrain/TiledDecals/BuildingFootprint8Material.rsc"
"Terrain/TiledDecals/BuildingFootprint8DamageMaterial.rsc"
]
bool _tiled = false;
float _initialAlpha = 0.5;
float _mapWidth = 2048.0;

DecalLocation _decalLocations
[
{
float _x0 = 0.0;
float _y0 = 0.0;
float _x1 = 256.0;
float _y1 = 320.0;
}
]
}

PickingDescription picking
{
MaterialInstance _selectMaterial = "Material/SelectionMask/SelectionMask.rsc";
PickingGroup _meshes
[
{
PickingMesh _mesh
[
"Models\SmallTownHomeBuild01Picking.rsc",
"Models\SmallTownHomeBuild02Picking.rsc",
"Models\SmallTownHomePicking.rsc"
]
}
]
}

ModelDescription model
{
MeshGroup _meshes
[
{
GraphicsMesh _mesh
[
"Models\SmallTownHomeBuild01Mesh.rsc",
"Models\SmallTownHomeBuild02Mesh.rsc",
"Models\SmallTownHomeMesh.rsc"
]
}
]

int _displayIndex = 0;
int _subIndex = 0;
bool _randomIndex = false;
}

HighlightDescription highlight
{
EdgeGroup _meshes
[
{
EdgeMesh _mesh
[
"Models\SmallTownHomeBuild01Mesh.rsc:edge"
"Models\SmallTownHomeBuild02Mesh.rsc:edge"
"Models\SmallTownHomeMesh.rsc:edge"
]
}
]

// materials for drawing selection with no mesh
MaterialInstance _maskMaterial = "Material/SelectionMask/SelectionMask.rsc";
MaterialInstance _edgeMaterial = "Material/SelectionEdge/SelectionEdge.rsc";
}


InteractDescription interact
{
PointList _pointList = "Models\SmallTownHomePoints.rsc";
}



at the bottom of the file, delete this from the UI section:
{
ObjectType _type = UpgradeUI;
ElementDescription _element = "Dialog/Upgrade.rsc:upgradeButton";
String _insertAt = "pageTabGroup";
DialogControllerConfig _config = "upgradeConfig";
}


and then right at the bottom, delete:
UpgradeUIConfig upgradeConfig
{
ComponentDescription _upgradeTo = "Template/StoneHouse.rsc";
}


These are the sections that handles the stone house upgrade, not needed for this house.

Discrepancy

Part 5


From the Apiary example folder, copy the 4 .rsc files in the Texture folder, put them into your own. Done.

Now again from the Apiary example folder, copy the 4 .rsc files in the UI folder, put them into your own and then alter the filenames, again substituting 'Apiary' for 'SmallTownHome'.

SmallTownHomeSpriteSheet.rsc will look like this:
SpriteSheet resource
{
String _materialName = "SmallTownHomeSpriteSheetMaterial.rsc";
String _imageName = "Build/SmallTownHomeSpriteSheet.png";
int _imageWidth = 128;
int _imageHeight = 128;
bool _padForFiltering = true;

Sprite _sprites
[
{ String _name = "BuildSmallTownHome"; String _source = "UI/Sprite/BuildSmallTownHome.png"; }
]
}


This is what calls up the individual toolbar icon for the house.

Now in SmallTownHomeSpriteSheetMaterial.rsc and SmallTownHomeSpriteSheetTexture.rsc
Alter the sections where it says 'Apiary', replace with 'SmallTownHome'

The SmallTownHomeStringTable.rsc file controls the text that is written in the game (display names/toolbar tips etc)
I changed mine to be:
StringTable resource
{
Entry _strings
[
{ String _name = "SmallTownHome"; String _text = "Small Town Home"; }
{ String _name = "SmallTownHomeLwr"; String _text = "small town home"; }
{ String _name = "SmallTownHomeTip"; String _text = "A small home with same costs and same numbers as the Wood house."; }
]
}


Now we need to create the Toolbar icon, it needs to be a 32x32 png image with a transparent background to match the other icons.
Name it 'BuildSmallTownHome.png'
Once made it needs to go into a folder called 'Sprite' within the UI folder.


Back into the main folder (MyMods/SmallTownHome)
we will need to add in copies from the Apiary example folder:
copy: Apiary.rsc, apiaryResources.rsc and Package.rsc

Rename Apiary.rsc to SmallTownHome.rsc,
This file is the toolbar file- it controls where the houses icon will be.
We want it to sit with the other houses, so I have changed it to:
Toolbar SmallTownHome
{
Toolbar _parent = "Game\Toolbar.rsc:housing";
int _sortPriority = 111;

Action _action = Tool;
ComponentDescription _tool = "Template/SmallTownHome.rsc";

bool _autoHotKey = true; 
}


Now change apiaryResources.rsc to SmallTownHomeResources.rsc
this is the mod kit's 'call up' sheet for when compiling the mod.
Inside it should look like this:
ExternalList resource
{
External _resources
[
// toolbar - references building and everything else - nothing else need be listed here
"SmallTownHome.rsc:SmallTownHome"
]
}



Now  edit the Package file, this is what controls the information that is shown in the game mod menu and in the steam workshop.
I made my Package file look like this:
PackageFile SmallTownHome
{
String _name = "Small Town Home";
String _author = "Discrepancy";
String _description = "This is small home with the same numbers of the Wooden House.
    This was made for a tutorial, you can find it at www.worldofbanished.com";
String _icon = "icon.png";
String _preview = "preview.jpg";
int _userVersion = 1;

// all files in resource directory
String _includeList
[
"*"
]

// exclude package files, mod files, file used for building packages
String _excludeList
[
"Package_*.crs"
"*.pkg"
"*.pkm"
]
}


Next make the icon.png file it is asking for. This needs to be 48x48. I just resize the toolbar build icon.

Don't worry about the preview.jpg, as we haven't got an in game shot yet.

Now to make the bat files to compile the mod:
In the main folder (MyMods/SmallTownHome), we will now create 3 text files,
they will be named as:
'1 Build.bat'
'2 Run.bat'
3 Package.bat'

inside '1 Build.bat' put this:
..\..\bin\x64\Tools-x64.exe /build SmallTownHomeResources.rsc:resource /pathres ../MyMods/SmallTownHome /pathdat ../MyMods/SmallTownHome/bin
pause


inside '2 Run.bat' put this:
..\..\bin\x64\Application-x64-profile.exe /ref SmallTownHomeResources.rsc:resource /pathres ../MyMods/SmallTownHome /pathdat ../MyMods/SmallTownHome/bin
pause


inside '3 Package.bat'' put this:
..\..\bin\x64\Tools-x64.exe /mod Package.rsc:SmallTownHome /pathres ../MyMods/SmallTownHome /pathdat ../MyMods/SmallTownHome/bin
pause




... Compiling all the 3d models

Now we must make the single .fbx file that the game will read from.

Open Blender and with a new blank project, press 'File' – 'Import' – 'FBX'
Change the scale to 0.01 (28), and then import the main house model we exported to .fbx (29)



The house should have been imported and you will have to zoom in a long way to see it.

Change the name of the model to 'mesh' (30) (*NOTE: pictures are wrongly displaying 'Mesh', this I later changed to 'mesh' – sorry couldn't take new screenshots)



Import the point.fbx file, keep it all the same at scale of 0.01, it should fall directly into the model at 0,0,0

Import the build models one at a time in the same way, they should also fall directly into the centre of the house, if not they were not exported properly at 0,0,0.
With the build models, while still in 'Object mode', move them sideways away from he main house model, and rename them 'build01' and 'build02'



Now select the main mesh, and click on the 'Material' property tab (31), then click 'New' (32)



Rename the new material to 'SmallTownHome'

Next to the 'Material' tab, click on the 'Texture' tab (33), click 'New' to add a texture place-holder, rename this also to 'SmallTownHome' (34)



Press 'Open' (35), and link to the SmallTownHome.png file in the MaterialInstance folder.

Now click on each of the build models and call up the same texture, only this time you only need to click on the 'Material' tab, and instead of adding a new material, just click on the 'SmallTownHome' material we had just made. Just click on the little globe/circle, and select the material.

Now it is ready to export again, this time as a single .fbx file.

Export to the 'Models' folder we made, named as 'SmallTownHome.fbx'

Now we can build the model!

Double click on the '1 Build.bat' file we created, and if all was followed it should build...
You will be prompted if there is an issue.

My build went fine,

I then double click on the 2 Run.bat file and the game loads up. Start a new game.

The model loads up fine in game, but it is too big !








.... In Part 6 we will resize the models and make it fit on a smaller footprint.

Discrepancy

Part 6


So our house model is way too large inside the game, looking at the picture in game, we could easily take one square off the side, so it will be a smaller house sitting on a smaller footprint of 3x3 instead of 4x4.

Open up Blender and load up the save you have for the completed house (SmallTownHome.blend):



In 'Object mode',
Select the house, and in the Transform window panel, change the scale to 0.650 for all axis points (36)
Do the same for the points holder (it will resize all points).
We now have a house scaled to 65% of what it was.
It takes up approx. 1.5 squares either side of the Y-axis.



Important, we now need to 'Apply' these changes to the scale.

Like we did earlier in the tutorial, click on 'Object' – 'Apply' – 'Rotation & Scale', repeat with the 'point' holder. (you will see that the 'Transform' scale will have changed to 1.000) (37)

Save file.



Now like we did earlier, delete the house mesh, and export only the points as an .fbx file (at scale 1.000).

Reload the house save, this time delete all the points (all points can quickly be deleted by 'right-clicking' on the 'points' holder in the Outliner window pane [top right of my blender view], and click on 'Delete Hierarchy').
Now export the house only as an .fbx.

Now load up the build01 & build02.blend saves we made earlier, and make the same changes in scale that we made to the complete house, apply the scale, and save and export as .fbx's.

And again following the same method we did in Part 5, we will start a new empty Blender project and import the .fbx files one at a time at 0.01 scale.

And add the 'Material/Texture' to each of the mesh, build 02 & build 01 like we did earlier. (they all call up the same Material holder)
If you want, you can press on the 'Object mode'  button (38), press 'Texture Paint' and it will show up the house with the texture you just assigned.



Once you've assigned the materials, export all as an .fbx, and replace the SmallTownHome.fbx you created in the Models folder.

Open up the SmallTownHome.rsc file in the Templete folder.

Change the following:
CreatePlacedDescription createplaced
{
PathBits _placeBits = Normal | Obstacle;

int _width = 4;
int _height = 4;
int _footprintRotation = 0;

PathBits _placeBitArray
[
Normal | Obstacle,
Normal | Obstacle | Fast | Faster,
]
String _placeBitmap =
"0000
0000
0000
1111";

ComponentDescription _allowAndRemove = "Template/Clear.rsc";
}

MapDescription map
{
PathType _pathType = Immovable;
String _pathBitmap =
"####
####
##_#
....";

bool _addToOverhead = true;
Color _mapColor = 0xFF545454;
}


to:
CreatePlacedDescription createplaced
{
PathBits _placeBits = Normal | Obstacle;

int _width = 3;
int _height = 3;
int _footprintRotation = 0;

PathBits _placeBitArray
[
Normal | Obstacle,
Normal | Obstacle | Fast | Faster,
]
String _placeBitmap =
"000
000
111";

ComponentDescription _allowAndRemove = "Template/Clear.rsc";
}

MapDescription map
{
PathType _pathType = Immovable;
String _pathBitmap =
"###
#_#
...";

bool _addToOverhead = true;
Color _mapColor = 0xFF545454;
}


We have now changed the house to sit on a 3x3 footprint including the road.

Now recompile the mod (delete the 'bin' and 'Build' folders first) by clicking on the '1 Build.bat' file. Run the mod by clicking '2 Run.bat'.


More issues:

The size is better in game, but a problem! although hard to see... our roof is on fire! Smoke is billowing out from the centre of the roof! (I recall this coming up before: http://worldofbanished.com/index.php?topic=1112.0 but how it was solved?...)



I guess we will find out in Part 7! ... I was hoping to have this finished by now. But problem solving is the best way to learn.

Discrepancy

Part 7

So thankfully this issue isn't anything major, and it wasn't really our fault considering it isn't in the wooden house file...


Within the SmallTownHome.rsc file in the Template folder is this code:

InteractDescription interact
{
PointList _pointList = "Models\SmallTownHomePoints.rsc";
}

ParticleDescription particle
{
ParticleAttachment _systems
[
{
Time _fadeInOutTime = 2.0;
bool _addOnCreate = false;
bool _addOnNotify = false;
Particle _particle = "ParticleSystems\Fire\FireSmall.rsc";
}
{
bool _addOnCreate = false;
Particle _particle = "ParticleSystems\ChimneySmoke\ChimneySmoke.rsc";
String _attachNode = "smoke";
}
]
}


Thanks to @kid1293 , we now know that the particle system needs to call up the points.rsc file directly from its code in the template file.
Change the section above to:

InteractDescription interact
{
PointList _pointList = "Models\SmallTownHomePoints.rsc";
}

ParticleDescription particle
{
PointList _pointList = "Models\SmallTownHomePoints.rsc";

ParticleAttachment _systems
[
{
Time _fadeInOutTime = 2.0;
bool _addOnCreate = false;
bool _addOnNotify = false;
Particle _particle = "ParticleSystems\Fire\FireSmall.rsc";
}
{
bool _addOnCreate = false;
Particle _particle = "ParticleSystems\ChimneySmoke\ChimneySmoke.rsc";
String _attachNode = "smoke";
}
]
}


just that added 'PointList _pointList = "Models\SmallTownHomePoints.rsc";' line will make the chimney point act as it should.

:) It is now complete.

Almost.

To properly add a mod to the steam workshop you need a preview picture...
using this...


I edit and crop it so that it is a 360x360px image, save it as 'preview.jpg'

Now rebuild the mod with these added changes, and lastly package the mod.

The SmallTownHome.pkm file is found in my C:\BanishedKit106\bin\WinData/ folder

Test the mod in the normal Banished environment.

All done.



Thanks for reading, any questions? happy to help.







If you want to use this house in your game,
Download the SmallTownHome.pkm file here

See how it is made? Download the source code here: (all code, textures and .fbx models)
SmallTownHome_SourceCode v1.0

NEW sourcecode (includes model alterations, AO added, footprint added, file name changes)
SmallTownHome_v1.1_sourcecode.zip v1.1

here you can download the original Blender files, .psd texture file etc, etc SmallTownHome_SourceWorkFiles.zip

Discrepancy

... I'm sorry that I have titled this as a tutorial when I myself am having problems...

but I still hope, going through all of this might allow others to venture into the 3d modelling and Banished modding world.

Keep checking back above, as we will solve the issue.

I will also upload all the source files once it is operating as required.

Discrepancy

This tutorial is now complete.

I hope that some of you will find it helpful.

:) happy modding.

RedKetchup

THANKS YOU ALOT @Discrepancy  for this nice tuto :)
sure it will help some people :)
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Ogedei

Great tutorial. This is actually a lot better than most Blender tutorials out there - the others tend to be so needlessly complicated. :)

mellowtraumatic

Thank you for this! It makes me want to break out Blender again. I tried it once and got hopelessly frustrated with it.

triangle

Just wanted to say thank you for the tutorial I use it 10 times a day as my goto model problem solving 101.

If you decide to update it at some point I hope you add to it showing more F-Key textured model variants of your smallhouse that are lined up in rows inside the same .fbx so people understand how this can be done and restructured/renamed: SmallHouse01Mesh, SmallHousepoints, SmallHouse01Build01, SmallHouse01Build02.

I didn't know how this was done until kid pointed this out to me and could save others like him from overhelpwelming PM's  lol

RedKetchup

if happends to have a chimney in each model not at same place as the other models, then you need to "link" the smoke point to the mesh and not to the "points" point.
and in the template, you take out the pointlist mention from the particle system function paragraph.
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .