Author Topic: Help :C  (Read 2620 times)

0 Members and 1 Guest are viewing this topic.

Offline Blapfel

  • Jvst Sayin'
  • Newb
  • *
  • Posts: 6
Help :C
« on: June 19, 2016, 03:57:57 PM »
(sorry for my bad english, I am not a native english speaker)

I never modded any Game, so I need help, i try to make a simple House Mod.
I can make 3D Models and made them how it officially need to be made.
But now I don't know what to do next, I followed the examples but they didn't help me out.  :-[
Is there any Tutorial or somebody who could make one? ;D

Thanks for any help ^^

(Simple, for testing purposes
https://gyazo.com/526f9a1182bbb57c96b2c9657c7981ec )
I love you C:

Huh, Feeling uncomfortable?

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #1 on: June 19, 2016, 04:50:54 PM »
Your model looks really good.

You are using blender I see.
First up, I find it is easiest if you size your model based upon the squares in blender being the same as the squares in the game.
Once you have the size you want you need to then centre your main object model at 0,0,0, then select the objects and click Object - Faces - Apply - Location and Apply Rotation & Scale.

Add points to your model:
In Object mode, 'Shift+A' to Add - Empty - Plain Axes. Rename this to 'points', centre this also at 0,0,0. Add in more 'points' and put them in places around the building depending on the use: name them 'build_001', 'build_002' etc, these are the points at which the builders work from. 'use_001, etc, is used for marking positions of work carried out at building or for entry to house (I think . maybe someone else can confirm this), plus there is smoke_001 which is the point where the smoke exits building if you have a chimney. Once all the points are made, group them all under the 'points' plain axes.

Save you file.

now the way I do it is:
I delete all the 'points'. Export the file as an .fbx, don't save.
Reload up your model, now delete all the objects and only keep the 'points'.
Now export the points only into a .fbx file.

Start a new empty blender file, import .fbx, bottom left of screen, change the Scale to 0.01 - import each of the .fbx files you created earlier at this scale, everything should already be in the correct spot, zoom in to see your now tiny model.

Select objects and add materials if still needed (make sure you name your texture image files the same as the material and texture holders in blender. (see this post Banished modding and Blender)
Now export this as an .fbx. leave scale at 1.0 this time. this should be your final model.

Now make sure you have all of your code correct.
You will need to make material files for every image that is called up by your model.
So if you see within the building/apiary example (ignore the honey files), Models/MaterialInstance folder there is images and .rsc files, the apiary only uses one texture image for the whole building, if you have done the same it should be pretty easy for you to alter all the files, edit all the names within the MaterialInstance .rsc files to link to your own textures. If you have multiple materials/textures for the model, you will need to make .rsc files for each of them within the MaterialInstance folder.

One folder back (Models), is where your exported .fbx file goes, you will also need to have all of these .rsc files edited to link to your own files.

Copy the wood/stone house template .rsc and use this as the guide for making your own. Change all the parts needed to point to your own model (the house templates are calling up different models for 'F-key' variants, that is why there are multiple meshes etc listed just delete them extra ones so it is only calling up your own model.

You also need to make your own SpriteSheet + toolbar icon (goes into UI/Sprites) and StringTable files within the UI folder.

Also needed is your houses toolbar file. Like the example/building/apiary.rsc file, this is where your model is called upon and adds the icon to the game toolbar.

If you have certain issues let us know, happy to help.
« Last Edit: June 19, 2016, 04:53:57 PM by Discrepancy »

Offline Blapfel

  • Jvst Sayin'
  • Newb
  • *
  • Posts: 6
Re: Help :C
« Reply #2 on: June 20, 2016, 07:02:23 AM »
Oh man, thank you so much... Way better than the ShiningRock instruction :D
I love you C:

Huh, Feeling uncomfortable?

Offline Blapfel

  • Jvst Sayin'
  • Newb
  • *
  • Posts: 6
Re: Help :C
« Reply #3 on: June 20, 2016, 08:17:49 AM »
So i made it so far, what now?
(And i didn't figure out how to make the UI  :-X)

I love you C:

Huh, Feeling uncomfortable?

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #4 on: June 20, 2016, 03:24:59 PM »
I will put something together and upload it.

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #5 on: June 20, 2016, 04:00:58 PM »
Okay, I'm at work so can't run the modkit to see if it builds, but I've given it all a quick look over.

Everything in your Models folder looks fine (except a 4096x4096 texture file - might be too big, but you could try. I normally just use 1024x1024).

I have re-written parts of the other code though, and added the UI folder with the stringtable and spritesheet.

I changed the template file to alter the spritenames and stringnames, also I altered the _mesh links to match the mod folder structure.

I also changed the building/house.rsc file to display the icon on the housing toolbar. changed package.rsc also to properly link to files.

anyway here is the edited code (I have not included your Model folder - just add that in before building mod), have a look at the changes I made, a lot of modding banished is trial and error.

download the attachment, unzip and place it directly into the BanishedKit folder (along with the 'bin, 'example', 'resource' folders) as I have set up the .bat files to work from BanishedKit/building/1 build.bat.
Add in your 'Models' folder as is.

Hopefully you should be able to build the model and run it like this. But like I said I'm not sure if the game will accept a 4096x4096 texture.

Good luck.

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #6 on: June 20, 2016, 04:15:22 PM »
... about the UI and Sprites, it is basically just the way the game calls up all the UI elements - text and pictures.
In the games template files, there are sections like:
Code: [Select]
SpriteSheet _spriteSheet = "Dialog/SpriteSheet.rsc";
String _spriteName = "BuildHouse";

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

when making your own mods, you need to make your own SpriteSheet.rsc, and StringTable.rsc files with your own file names so as not to interfere with the rest of the game.
I named yours HouseSpriteSheet.rsc and HouseStringTable.rsc.

The SpriteSheet calls up images to be used, so for example, above in the code is:
Code: [Select]
SpriteSheet _spriteSheet = "Dialog/SpriteSheet.rsc"; String _spriteName = "BuildHouse";This is the Banished Wooden House calling up the spritesheet to find a name called 'BuildHouse', now if you look within the games spritesheet file you will see this code:
Code: [Select]
{ String _name = "BuildHouse"; String _source = "Sprite/Toolbar/BuildHouse.png"; }it is calling up an image file, this is the small 32x32.png image file for the House's toolbar button.

The stringtable.rsc file is in charge of the text that is displayed in game.
In the house's template file:
Code: [Select]
StringTable _stringTable = "Dialog/StringTable.rsc:objects";
String _stringName = "WoodHome";
String _stringNameLwr = "WoodHomeLwr";
String _toolTip = "WoodHomeTip";

once again it is calling up particular names within a file, this time the StringTable.rsc file, and in that you find:
Code: [Select]
{ String _name = "WoodHome"; String _text = "Wooden House"; }
{ String _name = "WoodHomeLwr"; String _text = "wooden house"; }
{ String _name = "WoodHomeTip"; String _text = "Provides a place for citizens to live, eat, store food, and stay warm."; }

the 'String _text' is the actual words that will show up in the game.

... hope this helps explain the UI element.
« Last Edit: June 20, 2016, 04:17:59 PM by Discrepancy »

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #7 on: June 20, 2016, 09:04:14 PM »
okay I was able to sneak home at lunch and have a look.


First up regarding the code, a couple of things I missed.

In the Template/House.rsc file, scroll down to: 'UIDescription ui'
and delete the following section:
Code: [Select]
{
ObjectType _type = UpgradeUI;
ElementDescription _element = "Dialog/Upgrade.rsc:upgradeButton";
String _insertAt = "pageTabGroup";
DialogControllerConfig _config = "upgradeConfig";
}
**this is what controls the upgrade button to stonehouse in the woodhouse. Not needed in your model, and causes mod not to compile.

Next, If you just go into the BanishedKit/resource and copy the whole folder (including the files inside) called 'Texture' and place it within your mod directory (BanishedKit/building/Texture).

That's is all the issues with the code. But a few things need to change within your .fbx.

I managed to get the thing compiled, but only after importing your .fbx and then deleting all the materials you had linked to it, then creating my own to only call up your house.png file (you have many different materials listed (material01 etc) the problem with this, is that Banished call up the NAME of the material, so if you have material01 in your .fbx model you will need to have a file called material01.rsc in your MaterialInstance folder - make sense?

So you can have 20 different materials linked to your model, but it won't work unless there is all the matching files and images within the MaterialInstance folder.

Anyway, like I said I did kind of manage to get it to compile, but when I tried building it in game, this is what happened: (see attached picture)

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6985
Re: Help :C
« Reply #8 on: June 20, 2016, 09:20:41 PM »
not scaled right and not centered on 0,0,0 in blender
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #9 on: June 20, 2016, 09:47:32 PM »
as you can see the footprint is between all the banished buildings, but when all the resources were taken there, the model showed up further away, and I never saw the finished build.

The problem is that the models aren't located properly at 0,0,0.

With your original blender model open, in object mode, select only your 'mesh' and in the properties pane (if hidden, expand it by clicking the small '+' symbol top-right of the 3D view.
Change the x, y & z location to 0,0,0.
Then with still only the 'mesh' selected, click on 'Object' at the bottom of the screen, then 'Apply', then click 'Location'
This will set it so the mesh will remain at 0,0,0, won't happen otherwise. Now if the model isn't showing at 0,0,0 after doing this, you will need to go into 'Edit' mode and then move the model to the centre, then back out to 'Object' mode, and apply the location again.
As your model isn't showing up at the correct size either, you will need to size it so it takes up the amount of squares in blender, as you want it to in Banished. For example if you are building a 3x4 house, size it so it takes up that amount of space in 'edit' mode, once done, back out to 'object' mode and apply scale ('Object'-'Apply'-'Scale'), and make sure it is at 0,0,0, and apply the location again.
Also you will need to rotate your mesh 90degrees (so it is facing/in line with the red line in blender, not the green line, that way it should face south when in game and match your floor decal.
Once you have rotated it, you will need to once again Apply the changes, this time 'Object' - 'Apply' - 'Rotation'.

Next you will need to do this to your build01 and buil02's also. Same with your 'points' - only click on the 'points' holder, and apply rotation/scale and location

What I do now is after doing all of this (and saving the blender file),
I will delete the mesh, build01, and build02, just leaving the points.
Export these points only as an .fbx (name it something like house_points.fbx).

Then reload up your model, and this time delete build01, build02 and all of the points, now export this (the mesh only) as an .fbx (house_nopoints.fbx).

Again reload model, delete build02, points and mesh, export the build01 model to .fbx (house_build01.fbx)

And lastly reload model, delete build01, points and mesh. export the build02 model to .fbx (house_build02.fbx)


Now, open a new blank blender file. Make sure everything is deleted if it loaded up with anything.

File - Import - FBX, change the scale to '0.01' (bottom left of screen), import all of the models you just exported earlier, one at a time (all at scale 0.01). If you did all the location and scale changes correct earlier, they should all land at the 0,0,0 position. You can just select the build01, build02 models in object mode and move slightly sideways to see all the models, check that everything looks okay.

Hopefully you can get it working. Getting all of your material slots working might take some time.

Depending on how you unwrapped your model and applied the textures (I only had a quick look), you might be able to just call up the one material/texture file.

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #10 on: June 20, 2016, 09:49:38 PM »
not scaled right and not centered on 0,0,0 in blender

Yep, that is correct. I only had a quick play around with it... couldn't spend my whole lunch on it.

Hopefully Blapfel gets it working, it looks like a nice house model.

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 6985
Re: Help :C
« Reply #11 on: June 21, 2016, 04:40:06 AM »
but funny, blender seems so complicated lol
> > > Support Mods Creation developments with Paypal Donations < < <
Click here to PayPal Donate.

Offline Discrepancy

  • Modders
  • Architect
  • *****
  • Posts: 591
Re: Help :C
« Reply #12 on: June 21, 2016, 04:53:52 AM »
but funny, blender seems so complicated lol

That is what I first thought.

But now that I understand the basics of it, just getting over that first hurdle the other week has made me understand a lot more of the program.
Now that I'm pretty confident in making and getting the models into the game I'm starting to play around with more of the shortcuts and options it has.

It seems like a pretty powerful program - and being free and open source you can't get much better really.

Offline Blapfel

  • Jvst Sayin'
  • Newb
  • *
  • Posts: 6
Re: Help :C
« Reply #13 on: June 21, 2016, 09:42:47 AM »
Thank you so much,it really helped me.
I'll try to make the models right and then we'll see :D

(best community ever :D)
I love you C:

Huh, Feeling uncomfortable?

Offline Blapfel

  • Jvst Sayin'
  • Newb
  • *
  • Posts: 6
Re: Help :C
« Reply #14 on: June 21, 2016, 10:42:07 AM »
So I quite not understand what to do with the material, I thought the one Image of all materials is enough?

And I think that's why my Game crashes when I try to build the House ingame.
I love you C:

Huh, Feeling uncomfortable?