News:

Welcome to World of Banished!

Main Menu

Always greener on the other side

Started by Voeille, June 06, 2022, 07:20:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RedKetchup

bah the game dont interact with a special grid, the grid is painted on the grass bitmap direct with photoshop. the reason mountains doesnt have grids, because it has not been draw on the mountain bitmap image. but you can still find some "grass bitmap" on top of mountains.
> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Voeille

#46
@MarkAnthony
Just like RedKetchup said, the grid works by literally drawing the grid on your terrain textures, there's no way with the current modkit to have a separate terrain-conforming overlay on the whole map that just goes on top of it, as far as I know. So for the grid mod, I would put the grid on the grass and snow textures, but if it's useful, I could add it to others. The only texture that conflicts with RKEC is cemeteries/pastures (same for both), I wouldn't include it in the grid version of the mod, so there's automatically no conflict. So in the game, you would have the grid version that replaces grass, dirt and snow textures with ones that have grid drawn on them, and have the regular mod below (if you only loaded the grid one, you would have the other textures such as crop fields vanilla, as the grid wouldn't include those).

Lush & green HD replaces dirt texture with light green grass (same as my original lush & green from years ago). This is how it looks in the mod folder. Now, you might wonder why as it doesn't seem to make sense at the first glance. However, if you look at this screenshot, you might notice that the vanilla terrain has dirt patches with low opacity spread over the grass, and my terrain has ligher green patches spread over the main medium green grass. If I used the exact same texture for grass and dirt (which is a common practice for replacers to get rid of dirt), it wouldn't have those nice different colour patches and would look more repetitive. The side effect is having light green terrain underwater (you might notice on the shoreline), while it would be much better darker. The dark version you can see on my mod list replaces dirt with dark green instead of light green, but it needs more work to adjust the colours better. I think the patches work better when the dirt texture is lighter than the base grass, but as I mentioned, shorelines would look better if the dirt texture is dark green grass, so I wanted to have a version that does that.

Another 'dark' thing I have (TestMat on my modlist) is the result of me experimenting with materials (editing various values I saw there) and see what happens, and this gif shows what it does — I edited one line of code (literally) and it multiplies the original texture by its ambient occlusion(if a mesh has an AO map, no effect otherwise as multiplying by white is multiplying by 1), and additionally multiplies the texture by grey colour, which makes it darker overall (that has an effect on everything). The effect is equivalent to placing the AO map and a grey square on the texture and using the 'multiply' blending mode in programs such as Photoshop. The shader just does this globally for everything that uses the Opaque material and its variants so no texture editing is needed. I did this because it always felt to me that buildings were a tad too bright with my grass replacement (it is much darker than vanilla), but of course this is just subjective, I'd wager most people do actually prefer the original bright look of buildings.

And thanks for the info about double-clicking a mod and adding notes, that's useful to know.

brads3

in your experimenting with splitting the mod coding, how far can it be broken apart?  without altering the trees on a map, can a mod lessen the # of trees spawned?

the original Nat Div mod had more meadows  and they were larger than the RKEC. there were still forests but also more open space amongst them.   i've been able to tweak much of the start with various mods but can't get the open look.

i have the Pine mod for trees and gathering. am using some of KID's mods to tweak the RK fodder grass. flowers are collected as thatch and houses can use it for fuel. and am using a Lite version of the RKEC. i even found using a KID mod makes the roaming bison look more wild than the domesticated. 

Voeille

#48
In the NaturalResourceTree.rsc file there's this block:


NaturalResourceDescription naturalresource
{
ComponentDescription _rawMaterial = "Template\RawMaterialWood.rsc";

// placement
float _noisePersistance = 1.0;
float _noiseOctaves = 4.0;
float _noiseScale = 30.0;
float _noiseCutoff = 0.35;
float _spawnChance = 0.4;

bool _groupModels = true;
float _groupPersistance = 1.0;
float _groupOctaves = 1.0;
float _groupScale = 5.0;
float _groupCutOff = 0.5;
int _groupRandom = 5;

float _minHeight = 0.0f;
float _maxHeight = 1.0f;
float _maxAngle = 0.75f;

bool _animated = true;
Time _preAnimateTime = 6.0;
Time _postAnimateTime = 3.0;
ToolType _toolType = Axe;

float _positionTolerance = 0.4;
}


Some of the variables include 'noise', as the game uses Perlin noise to place trees, to ensure trees are placed in groups (e.g. a group of oaks and then a group of pines next to it, as opposed to an even number of them in a single group). Unfortunately foresters don't place trees like that and it's always a mixed group, which looks a bit less natural. Examples of Perlin noise:


Source

Tweaking the numbers in the variables above would affect how the trees are spawned during map generation. You can experiment and see what you get with different numbers.

The same file also has this block:


GrowthDescription growth
{
// maximum growth before death, -1 for ever living
float _maxGrowth = 5.0;

// growth +- some amount
float _maxGrowthTolerance = 1.0;

// length of growth period to maturity
float _growthInMonths = 40;

// temperature dependant growth
bool _temperatureDependent = false;
float _growthTemp = 0.0;
float _growthTempRange = 0.0;

// re-seeding.
bool _autoSeed = true;
int _seedChance = 12;
int _seedDistance = 8;
int _seedTimeMonths = 3;
float _growthForSeeding = 0.9;

// max neighbors when reseeding
int _maxNeighbors = 1;
int _maxNeighborsSelf = 0;

float _minScale = 0.2f;
}


Those are vanilla values for tree lifetime and reseeding, and as far as I know they eventually cause the trees to die off. Various mods change the numbers to prevent that, I have one as well with rather aggressive values, however I have seen that even with it disabled the forests spread at a steady pace with other mods I have installed.

It is worth noting that the seed chance is actually higher the lower the number is. So setting it to 4 for example would make the trees reseed 3 times as fast as with original 12. The grass from RKEC has rather a high value as it doesn't take long for the natural grass to die off and you need the fodder farmers building to keep it going. Flowers on the other hand reseed rather fast and survive on their own. If you have multiple resseding plants, such as trees, grass and flowers, it might be hard to balance the numbers just right to prevent either of them from dying off or overtaking the others.


As for splitting the mod coding, the examples I pasted above can help to show how it works. You can see that I pasted the 'naturalresource' block and the 'growth' block from the NaturalResourceTree.rsc file. If one mod only edits the 'growth' block and another mod only edits the 'naturalresource' block, they won't conflict and you will get changes from both, despite both making changes to NaturalResourceTree.rsc. However, if they both edited the same block, for example 'growth', you will only get the changes from the mod loaded first. While compiling the mod that edits vanilla files, it will automatically detect which block you edited and only include that. You can also specify that manually in your Package.rsc file, for example you can write that you want to include "Template/NaturalResourceTree.rsc:growth" as opposed to "Template/NaturalResourceTree.rsc". If you're only editing one block, you can also remove other blocks from the .rsc file included in your mod folder in the modkit as your mod doesn't try to use them. If you're editing a block of a mod-added file, you always need to manually specify which block you want to include, as the compiler only knows vanilla and cannot tell what you edited compared to the original mod. This allows you to edit things from mods you don't have the source for — you can check what file names and blocks the mod includes using the in-game mod menu, and then include those in your mod, as long as the given block doesn't refer to resources you don't have.

For an instance, let's say there's a mod X that adds a few buildings and one of them is a storage building. You open the in-game mod menu to see details, and you see that there's a file listed called Templates/ModXStorage.rsc, and there's a block ModXStorage.rsc:build that specifies building requirements. You would like to change them to be 20 work and 20 wood. In your mod folder in the modkit you would create a file Templates/ModXStorage.rsc, and the file would only need to include this:


BuildDescription build
{
int _workRequired = 20;

BuildRequirement _buildRequirement
[
{
ComponentDescription _rawMaterial = "Template/RawMaterialWood.rsc";
int _count =  20;
}
]
}


It only refers to vanilla wood, which means you don't need to include any extra files. If you wanted to use lumber instead of wood, you would need all necessary lumber files as that's not included in the vanilla game.

In your references in Package.rsc you would have "Template/ModXStorage.rsc:build" in the reference list. Once compiled, you would want your mod higher in the load order than mod X, as it normally works with overwrites.

brads3

that is interesting. so we do have ability to affect parts of things individually withouty offsetting everything. like the growth rate of trees but not the textures. you are correct bout the RK fodder dying off after a few years. KID fixed that issue in a few mods. i do think RED fixed the trees dying off issue. can't remember the #'s thou.

balance is unique. my current order does yield more textiles and less food than before. it also depends on which forester is working an area.  each map is diverse that way. planted forests do act different than the start.

i'm not a modder and don't have the mod kit. i can only do what the great modders allow me to. i understand the trees will fill in the grass areas over time, but i don't think it will be very fast. especially since the fodder does spawn itself.  way back in time i saw a post that stated the various trees spawn different foods. oaks spawned something and birch trees something else. not sure if any are aware of that. i never could find the post again. in vanilla, there was an over abundance of roots and onions.

what controls how many or how close the groups of trees are? have you seen pics of the original Nat Div? the meadows were larger and more of them than the RKEC.

Voeille

The tree groups would be affected by those numbers:


bool _groupModels = true;
float _groupPersistance = 1.0;
float _groupOctaves = 1.0;
float _groupScale = 5.0;
float _groupCutOff = 0.5;
int _groupRandom = 5;


But I don't know without testing how each of those numbers would affect the trees exactly.

What spawns is defined in the 'spawn' block in NaturalResourceTree.rsc and it doesn't matter what tree it is. Whether it is an oak or a birch is purely visual. This is where the tree models are defined:


ModelDescription model
{
MeshGroup _meshes
[
{
AnimationGroup _animations = "Models\NaturalResource\Tree\TreeAnims.rsc";
GraphicsMesh _mesh
[
"Models\NaturalResource\Tree\PineTreeMesh01.rsc"
"Models\NaturalResource\Tree\PineTreeMesh02.rsc"
"Models\NaturalResource\Tree\PineTreeMesh03.rsc"
"Models\NaturalResource\Tree\PineTreeMesh04.rsc"
]
}
{
AnimationGroup _animations = "Models\NaturalResource\Tree\TreeAnims.rsc";
GraphicsMesh _mesh
[
"Models\NaturalResource\Tree\BirchTreeMesh01.rsc"
"Models\NaturalResource\Tree\BirchTreeMesh02.rsc"
"Models\NaturalResource\Tree\BirchTreeMesh03.rsc"
"Models\NaturalResource\Tree\BirchTreeMesh04.rsc"
]
}
{
AnimationGroup _animations = "Models\NaturalResource\Tree\TreeAnims.rsc";
GraphicsMesh _mesh
[
"Models\NaturalResource\Tree\OakTreeMesh.rsc"
]
}
]
int _displayIndex = 0;
int _subIndex = 0;
bool _randomIndex = false;
}


You can add more model references there if you have source files for trees from mods, and they will work the same as vanilla trees, just look different. Interestingly, the closer the model is to the top of that list (in the vanilla list above, pine is at the top), the more and larger groups of it appear on the map. It doesn't seem to affect foresters and they plant everything equally.

This is what defines the plants that spawn under trees:


SpawnDescription spawn
{
Spawn _spawn
[
{
ComponentDescription _naturalResource = "Template\NaturalResourceHerb.rsc";
float _minSpawnAge = 1.1;
float _maxSpawnAge = 100.0;
}
{
ComponentDescription _naturalResource = "Template\NaturalResourceOnion.rsc";
float _minSpawnAge = 0.1;
float _maxSpawnAge = 100.0;
}
{
ComponentDescription _naturalResource = "Template\NaturalResourceBlueberry.rsc";
float _minSpawnAge = 0.1;
float _maxSpawnAge = 100.0;
}
{
ComponentDescription _naturalResource = "Template\NaturalResourceMushroom.rsc";
float _minSpawnAge = 0.1;
float _maxSpawnAge = 100.0;
}
{
ComponentDescription _naturalResource = "Template\NaturalResourceRoot.rsc";
float _minSpawnAge = 0.1;
float _maxSpawnAge = 100.0;
}
]
}


You can see that herbs need older trees than food to spawn. It is also likely that this list works the same as the model list and things closer to the top are more common, as I do seem to have more onion in my towns than the other forest food.

Even if you don't consider yourself as modder, I think having a modkit working is a good idea. You can learn a lot how things work by tweaking numbers and checking the effect in the game, and you can achieve impactful effects with just that. An ageing mod for example is just changing a few numbers and nothing else, but it has a big effect on the gameplay. Banished modkit doesn't provide anything to do any programming outside shaders anyway, the .rsc files are just variables and references, but you cannot add any custom logic. A scripting interface would be nice though, even if it had just as fragile engine as Skyrim's Papyrus.

PlumSeed

Hi Voeille

I just want to say that your trees in your first pictures look stunning (I'm obsessed with trees right now^^). I'm not sure if you already said it, if so I apologize, but do you intend to make a texture replacer just for those? A tree is just a tree but a forest can give an entire different vibe.