News:

Welcome to World of Banished!

Main Menu

Footprints and smoke points

Started by Jinxiewinxie, January 31, 2019, 07:58:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jinxiewinxie

I successfully created an okay-ish house mod with two versions (or F-Key Variants), but the footprints on both of them are ugly and the smoke points (and other build/use points) only load from the first variant's locations. When doing F-Variants, can I just.. add a second portion of code for the points? How do I tell it which point set is for which variant?

I imagine this is the spot in the code where it specifies where the points are =) How do?


/// MyMods\DemoHouse\Template\DemoHouse.rsc

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

ParticleDescription particle
{

PointList _pointList = "Models\DemoHousePoints.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";
}
]
}


My second issue is that my F-Key Variants are just.. rotated models, lol. The footprint is bad on the first and duplicated on the second. How do I customize my footprints? Do I just copy the footprint files from BanishedKit\resource\Terrain\TiledDecals and change up the image used? Secondly, can I specify a diagonal version to use for the rotated variant?

I've attached images of the ugliness I've created, for reference XD Any help is appreciated!

kid1293

You can not add multiple 'smoke' points in Blender. Possible in 3DMax

You have to call them 'smoke1' 'smoke2' and so on.

The real problem is that you can not address different points in code. It is all or nothing  :(
You have to adjust position of house/chimney if you want them on f-key. (usually do-able)
The only other option is to make a separate toolbar button for each house.


Jinxiewinxie

Sad times! Is the best way to add a new button for a house to just.. copy the whole mod and rename everything? (Like the file names and inside the files to the new house's name?)

kid1293

Nonono.

You just copy the MyHouse.rsc in Template to MyHouse2.rsc and edit.

You have to edit code for it, make icon and stringtable.
Finally you edit your files in the mods root folder to load a second file (your second house)

The MyHouse.rsc can look like this


ExternalList resource
{
External _resources
[
"MyHouse1",
"MyHouse2",
]
}

Toolbar MyHouse1
{
Toolbar _parent = "Game/Toolbar.rsc:housing";
int _sortPriority = 180;

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

bool _autoHotKey = true;
}

Toolbar MyHouse2
{
Toolbar _parent = "Game/Toolbar.rsc:housing";
int _sortPriority = 190;

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

bool _autoHotKey = true;
}



Your MyHouseResources.rsc can look like this


ExternalList resource
{
External _resources
[
"MyHouse.rsc"
]
}


Your package file


PackageFile MyHouse
{
String _name = "JW My House";
String _author = "JinxieWinxie";
String _description = "My first building.";
String _icon = "Icon.png";
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"
]
}


And your bat-file finally


..\bin\x64\Tools-x64.exe /build MyHouseResources.rsc:resource /pathres ../MyHouse /pathdat ../MyHouse/bin
..\bin\x64\Tools-x64.exe /mod Package.rsc:MyHouse /pathres ../MyHouse /pathdat ../MyHouse/bin

Jinxiewinxie

Oh gosh, that's much easier than creating a whole second set XD Thank you again!

RedKetchup

i cant believe blender never fixed that since many years.
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Tom Sawyer

I guess to have explicit names of points and other elements is intentionally in Blender and nothing to fix. At least, it makes much sense this way in a game asset file. Would be more an issue of Banished but actually not even this since the vanilla houses already have different smoke points in F variants and it works. You just need separate fbx files for your variants, each with a "smoke" point at the respective chimney position and added directly to the mesh as its parent instead of "points". You also have to remove the path line from the particle section in your house template to make the game taking it from mesh.

Different footprints can be added as parts from your footprint file via coords. You can check the decal section of the vanilla wooden house template (in resource folder) to learn how to handle it @Jinxiewinxie

Jinxiewinxie

@Tom Sawyer Thank you for helping with a work around!

Unfortunately, I may have done it wrong. Can you use small words? XD I've attached some images showing what I did and how it ended up in game. Did I remove the wrong line?


kid1293

Thanks for that @Tom Sawyer ! I have learnt something new.

@Jinxiewinxie - It looks like you have done it right. I have to make tests to see how this works
before I can say anything.

Tom Sawyer

@Jinxiewinxie, your template and blender screen look right. Maybe something went wrong with scaling the smoke point or with compiling the new version. If we can look at your blender- and template file, we will find it. You can put it here as zip or send via pm or email.  :)

kid1293

@Jinxiewinxie
I have tested to put smoke point as @Tom Sawyer suggested (as in your pictures).
It works without any errors or strange things.

I agree with TS that wrong scaling on points can lead to unexpected behavior.

Jinxiewinxie

#11
Hmmm, so I fiddled around some more and its still wonky. Here's my steps:

-Individual meshes in blender as .blend (one for build01, another build02, another points and lastly mesh)
-Import those into one file as 0.01 scale
-Move smoke point from original points hierarchy and into mesh's one
-Smoke point gets drunk and moves very far away and is huge, as seen in my screenie.

Should I have my smoke point be inside my original mesh hierarchy BEFORE I import it maybe?

(maybe moving the smoke point makes it realize its at a 1.0 scale and that's what makes it drunk?)

Discrepancy

Yes that would be it. You will need to do it before importing them. :)

Jinxiewinxie

Yay! Phew, that was effort XD Would it be terribly hard for you to update your original tutorial's Part 3 to talk about adding your points to your mesh.blend and exporting them as an fbx together? So maybe the next person following it has an easier time of things?

Jinxiewinxie

#14
For anyone searching the word footprint and needing this info:

Customized Footprint Tutorial:


Open your mesh in blender and change your view to be straight down. You'll see the grid lines and the top of your mesh. Align things so that the grid looks nice and straight and you can see how many grid squares you've got. Take a screenshot.

Paste the screenshot into Paint.Net or Gimp or your favorite image editor and crop out the extra space around your mesh so that you have nice straight edges that follow along the original grid's lines:



This image won't have square dimensions and the game likes squares, so you'll need to make it square while maintaining its original view in the center. Easiest way is to make a new image that's got square dimensions and then copy & paste down your cropped screenshot onto it so that your top view stuff is still in the center of it all:



Next, crop out the extra space and grid lines that are near your mesh's outline so that you just have your outline and everything else around it is transparent:



Lastly, recolor your mesh's outline and innards to look like dirt or whatever you like and have it be a little transparent. Blur the edges so it looks more like a game footprint. Tada!



Make sure to resize the image so that it matches whatever you said the size was in your template file (128x128, 256x256, 2048x2048, whatevs). You can have multiple footprints in the same image if you're making F-Key variants, as long as you keep it square and spread them out in regular dimensions (128, 256, whatever). You can change the float values in your template file to specify which section of the image you want to use for the footprint of your variant.

I ended up doing two variants in the same image and its 256x256 in size with each little footprint area being 128x128:



My code for the bit relating to this in my template file looks like this:


//lines 121 through 148 of BanishedKit\MyMods\DemoHouse\Template\DemoHouse.rsc

DecalDescription decal
{
MaterialInstance _materials
[
"Models/MaterialInstance/DemoHouseFootprintMaterial.rsc"
"Models/MaterialInstance/DemoHouseFootprintDamageMaterial.rsc"
]
bool _tiled = false;
float _initialAlpha = 0.5;
float _mapWidth = 256.0;

DecalLocation _decalLocations
[
                //First variant's stuff
{
float _x0 = 0.0;
float _y0 = 0.0;
float _x1 = 128.0;
float _y1 = 128.0;
}
                //Second variant's stuff (only need this if you have a variant, can delete the below section otherwise)
{
float _x0 = 128.0;
float _y0 = 0.0;
float _x1 = 256.0;
float _y1 = 128.0;
}
]
}


You also need to make the files that this bit references, they go in your BanishedKit\MyMods\YourModsName\Models\MaterialInstance folder. You want your footprint image, a FootprintTexture.rsc, a FootprintMaterial.rsc and a FootprintDamageMaterial.rsc that you've edited to fix names and locations to match your actual mod:



Don't be intimidated, these are small files and they're quick & easy to edit =) Here's what the entire innards of each of mine look like:


//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintTexture.rsc

ImageBuffer resource : "Texture/DecalTexture.rsc" 
{
String _imageName = "Models\MaterialInstance\DemoHouseFootprint.png";
}



//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintMaterial.rsc

MaterialInstance resource
{
Material _material = "Material\TerrainDecal\TerrainDecalMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\DemoHouseFootprintTexture.rsc";
}
]
}



//This is what's inside BanishedKit\MyMods\DemoHouse\Models\MaterialInstance\DemoHouseFootprintDamageMaterial.rsc

MaterialInstance resource
{
Material _material = "Material\TerrainDecal\TerrainDamageDecalMaterial.rsc";
Texture _textures
[
{
String _name = "diffuse";
ImageBuffer _texture = "Models\MaterialInstance\DemoHouseFootprintTexture.rsc";
}
{
String _name = "damage";
ImageBuffer _texture = "Terrain\TiledDecals\DamageTexture.rsc";
}
]
}


Aaaaand, breathe! Its done! =)

Here's what my two house's footprints look like in game when they're being built:



If you're unhappy with the transparency or the color, you can keep editing your original image and saving over the one you've got in your MaterialInstance folder while the game is running. As you save, the game will update your image changes so you can fiddle with it until it looks how you'd like it =)