Creating a mesh building

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


Sie betrachten gerade eine ältere Version des Eintrags. Klicken Sie hier, um zur aktuellen Version zu gelangen.

  • How to create a building for my Mesh Building Enabler mod.
    [color=#B22222][size=12]This tutorial requires the Mesh Buildings Enabler to be installed. Download here: [u][b][url='http://www.train-fever.net/filebase/index.php/Entry/154-Mesh-Buildings-Enabler/']Mesh Buildings Enabler[/url][/b][/u][/color][/size][u][size=14][b] Step 1: Create the mesh[/b][/size][/u] First of all you need to know what type of building you want to create. There are residential, commercial, industrial and leisure buildings in the game. Next you need to choose a size. It must always be dividable through eight. Here are the sizes for the default lots:: [table][tr][td] [/td][td]Width[/td][td]Depth [/td][/tr][tr][td]Small [/td][td]16m [/td][td]24m [/td][/tr][tr][td]Medium [/td][td]24m [/td][td]24m [/td][/tr][tr][td]Large [/td][td]32m [/td][td]32m [/td][/tr][tr][td]Very Large [/td][td]48m [/td][td]40m [/td][/tr][/table] The width is the y-axis in the modeler and the x-axis in the game. The depth is the x-axis in the modeler and the y-axis in the game. The house gets always placed in the center of the lot with the positive x-axis (in the modeler) facing the road. The axes mentioned refer to a right-handed, z-up system. Next you need to choose a capacity of workers/residents/customers for your lot. Here you can see the capacities of the default lots: [table][tr][td] [/td][td]Residential [/td][td]Commercial [/td][td]Industrial [/td][td]Leisure [/td][/tr][tr][td]Small [/td][td]1-4 [/td][td]1-16 [/td][td]1-8 [/td][td]1-16 [/td][/tr][tr][td]Medium [/td][td]5-10 [/td][td]17-40 [/td][td]9-20 [/td][td]17-40 [/td][/tr][tr][td]Large [/td][td]11-18 [/td][td]41-72 [/td][td]21-36 [/td][td]41-72 [/td][/tr][tr][td]Very Large [/td][td]19-100 [/td][td]73-400 [/td][td]37-200 [/td][td]73-400 [/td][/tr][/table] Since the house can be placed on a sloped road, you should create a foundation for your building, that goes a few meters into the ground. [u][b][size=14]Step 2: Placement of files[/size][/b][/u] Files should be placed here: MESHES (.msh/.msh.blob): – res\models\mesh\building\{YourSetName} (if you create a set of buildings) – res\models\mesh\building\residential – res\models\mesh\building\commercial – res\models\mesh\building\industrial – res\models\mesh\building\leisure TEXTURES (.tga): – res\textures\models\building\{YourSetName} (if you create a set of buildings) – res\textures\models\building\residential – res\textures\models\building\commercial – res\textures\models\building\industrial – res\textures\models\building\leisure MATERIALS (.mtl): – res\models\material\building\{YourSetName} (if you create a set of buildings) – res\models\material\building\residential – res\models\material\building\commercial – res\models\material\building\industrial – res\models\material\building\leisure MODELS (.mdl): – res\models\model\building\{YourSetName} (if you create a set of buildings) – res\models\model\building\residential – res\models\model\building\commercial – res\models\model\building\industrial – res\models\model\building\leisure BUILDING UTILITY DATA (.bud): – res\config\building\bud\meshbuildings\{YourSetName} (if you create a set of buildings) – res\config\building\bud\meshbuildings\residential – res\config\building\bud\meshbuildings\commercial – res\config\building\bud\meshbuildings\industrial – res\config\building\bud\meshbuildings\leisure [size=14][u][b]Step 3: Create your model[/b][/u][/size] A typical .mdl file for a model looks like this: [code]function data() return{ boundingInfo = { bbMax = { 7.9, 11.9, 8.5, }, bbMin = { -7.9, -11.9, 0, }, }, collider = { params = { }, type = "MESH", }, lods = { { children = { { id = "building/residential0/mymesh.msh", transf = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, }, type = "MESH", }, }, matConfigs = { { 0, }, }, static = false, visibleFrom = 0, visibleTo = 2500, }, }, metadata = { }, } end[/code] The bounding box is (as always) very important. If it's too big, the model will not be displayed / the building will not be chosen. Always make it 0.5m to 1m in each direction smaller than the ground size is. Is the size of one direction not equal to the opposite direction, the model will be centered so that the bounding box is centered. Also of importance is the “visibleTo” value. Buildings should be displayed even when fully zoomed out. So turn it up real high (as in the example above) and make the mesh either very low-poly or create multiple LODs. [size=14][u][b]Step 4: Create the building data[/b][/u][/size] Now comes the part which is probably new to you. Create a .bud text file with the following content in the appropriate folder (see step 2): [quote]local dasmatze_meshbuildings = require "dasmatze_meshbuildings" function data() result = dasmatze_meshbuildings.create() result.availability.yearFrom = 1800 result.availability.yearTo = 99999 result.type = "RESIDENTIAL" result.capacity = { 1, 4 } result.parcelWidth = { 3, 3 } result.parcelDepth = { 3, 3 } result.params.assetCenter = "building/residential0/mymodel.mdl" [color=#008000]result.params.assetGarden = { "asset/park_fountain_1.mdl", "asset/park_fountain_2.mdl" } result.params.assetTree = { "all" } result.params.assetProbGarden = .0 result.params.assetProbTree = .0 result.params.matWall = { "wall_stone1.btd", "wall_stone2.btd" }[/color] result.params.shapeGridSize = 6.0 return result; end[/quote] The green colored lines are completely optional. If you leave them out, the default parameters are used most of the time. "result.availability.yearFrom" and "result.availability.yearTo" must not be 0 otherwise they might crash the game. Use a very high number if you want to make it available almost forever. Here are the rest of the parameters: [table][tr][td]Parameter [/td][td]Description [/td][/tr][tr][td]result.type = "RESIDENTIAL" [/td][td]The type of the lot. Possible values are RESIDENTIAL, COMMERCIAL, INDUSTRIAL and LEISURE [/td][/tr][tr][td]result.capacity = { 1, 4 } [/td][td]The capacity of the lot. A random value between the first value (low value) and the second value (high value) is chosen when a building gets built. It always fits the cities needs. [/td][/tr][tr][td]result.parcelWidth = { 3, 3 } [/td][td]The width of the lot. Caluclated by width divided by eight. No decimal values are allowed. If the value is too high, the chance of it appearing sinks drastically. See the data table in step 1 for default sizes which are always appearing. Both values should be the same. [/td][/tr][tr][td]result.parcelDepth = { 3, 3 } [/td][td]The width of the lot. Caluclated by width divided by eight. No decimal values are allowed. If the value is above six, it will never appear. See the data table in step 1 for default sizes which are always appearing. Both values should be the same. [/td][/tr][tr][td]result.params.assetCenter = "" [/td][td]The model you created which gets placed in the center of the lot. [/td][/tr][tr][td]result.params.assetGarden = { } [/td][td]An array of garden assets (.mdl) placed randomly in the part of the lot that is not blocked by the bounding box of the building's mdl file. By default no assets are used. [/td][/tr][tr][td]result.params.assetTree = { } [/td][td]An array of possible tree models you want to use on your lot. [/td][/tr][tr][td]result.params.assetProbGarden = .0 [/td][td]Not sure what this does, but the higher the number, the more garden assets are placed. It's probably a value between 0 and 1. By default it won't spawn any garden assets. [/td][/tr][tr][td]result.params.assetProbTree = .0 [/td][td]Not sure what this does, but the higher the number, the more trees are placed. It's probably a value between 0 and 1. By default it won't spawn any trees. [/td][/tr][tr][td]result.params.matWall = { } [/td][td]An array of walls from the folder "res\config\building\btd\wall" which are placed at the edges of the lot beneath the ground (so that there is a wall when the house is placed on a sloped road and floats in the air). By default, there won't be any walls. [/td][/tr][tr][td]result.params.shapeGridSize = 6.0 [/td][td]This defines how accurate the terrain gets leveled around the building. The higher the value, the more precise it'll be. Six is a good value to work with. [/td][/tr][tr][td] [/td][td] [/td][/tr][/table] [u][b][size=14]Step 5: Test it in the game[/size][/b][/u] If you did everything right, you should have a a custom building in the game. [img]http://www.train-fever.net/index.php/Attachment/15221-Picture-jpg/[/img] Congratulations! The Train Fever Community awaits some cool buildings from you now. If you have any trouble concerning this tutorial/mod, leave a comment/reply here or in the Mesh Buildings Enabler Thread.

Teilen