World of Banished

MODS Garage => Mod Talk => Topic started by: tangent on November 15, 2018, 09:01:37 PM

Title: Values in Citizen.rsc?
Post by: tangent on November 15, 2018, 09:01:37 PM
Specifically lines 118-122 of this

float _foodPerYear = 100;
float _foodLevel = 25.0;
float _hungerLevel = 10.0;
float _starvingLevel = 18.0;
float _maxHunger = 25.0;


The only one I immediately get is 100 `foodPerYear`. That means each citizen will consume 100 units of food annually.

Do the other values pertain to this `foodPerYear`? If `foodLevel` is set to 25.0, will citizens eat 4x per year? If I wanted them to consume more food, would I set foodPerYear to 200 AND foodLevel to 50.0? Do I need to also increase hunger, starving, and max hunger values?
Title: Re: Values in Citizen.rsc?
Post by: brads3 on November 15, 2018, 09:54:15 PM
not a modder but,i would assume 1 of those numbers is how much they store in their houses.it may be a % of the total.1 is where they trigger that they are starving.vased on the wording i would assume 1 is to tell the bannies when to go home to eat. i would try setting the food per year to the 200 and not change anything else. try it and see what happens.for an experiment, you can do as you say set to 50 the level and see if they eat 2 times a year. i do think you are on the right track with your thinking. 

    while you are a new modder playing with the coding,try some things to see if you find things nobody has. for example,is there a line that tells the bannies what ground level to walk on? so far we can not make them swim or climb very high. new modders have helped us do impossable things before. we all are grateful for the attempts and help of new people.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 01:40:26 AM
literally had a eureka moment about this at 4 in the morning while reading brads3 response. (Also waiting for a friend to fly in during a nasty winter storm, the airline lost her bag so I was up already).

So with inline commenting:


float _foodPerYear = 100; // Total amount of units consumed per bannie, per year
float _foodLevel = 25.0;  // Upper limit of starvation range
float _hungerLevel = 10.0;  // Threshold for when bannie looks for food
float _starvingLevel = 18.0; // Threshold for when the 'starving' badge appears
float _maxHunger = 25.0; // Limit when the bannie dies

float _retryInMonths = 0.1; // How long a bannie waits after NOT finding food before trying again.


So changing the first value, _foodPerYear, will change how much food a bannie needs overall. If I change the _hungerLevel, from 10 to 5, they will get hungry (but not dangerously so) 2x as fast. Then I can change _retryInMonths to 0.2 to make them wait a bit longer before giving it another go.

Gonna compile and test...

Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 03:46:39 AM
Alrighty then. The values I changed had the intended effect. Now for the tricky part.

Here's my batch script:

..\..\bin\Tools-x64.exe /build Package.rsc:list /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin

..\..\bin\Tools-x64.exe /mod Package.rsc:orchard /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin


here's my package.rsc

PackageFile reducedcitizenneeds
{
String _name = "Reduced Citizen Needs";
String _author = "tangent";
String _description = "Citizens require 50% less food and get hungry 25% faster. Starvation and death values unchanged.";
String _icon = "";
int _userVersion = 1.0;

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

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

ExternalList list
{
External _resources
[
"Template/Citizen.rsc"
]
}



I'm trying to compile into a package, but I'm getting several errors about missing resources, etc. Anything I'm missing? I followed slink's tutorial here http://worldofbanished.com/index.php?topic=452.0 (http://worldofbanished.com/index.php?topic=452.0), but I can't get the dang thing to compile... any hints?
Title: Re: Values in Citizen.rsc?
Post by: RedKetchup on November 16, 2018, 04:00:27 AM
Quote from: tangent on November 16, 2018, 03:46:39 AM
Alrighty then. The values I changed had the intended effect. Now for the tricky part.

Here's my batch script:

..\..\bin\Tools-x64.exe /build Package.rsc:list /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin

..\..\bin\Tools-x64.exe /mod Package.rsc:orchard /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin



2nd line , why do you call for Package.rsc:orchard ?

in your package.rsc you defined the name of your mod:
PackageFile reducedcitizenneeds


you need to change the 2nd line of your .bat to correspond the name of your function PackageFile


..\..\bin\Tools-x64.exe /build Package.rsc:list /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin

..\..\bin\Tools-x64.exe /mod Package.rsc:reducedcitizenneeds /pathres ../example/reducedcitizenneeds /pathdat ../example/reducedcitizenneeds/bin

Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 04:52:18 AM
{brief fan boy moment}

huge fan of your work, RK!

Also the `orchard`is from me trying to use a batch script that Panacea created (their no wind mod) and I forgot to replace the mod name there. Let me give that a whirl.
Title: Re: Values in Citizen.rsc?
Post by: brads3 on November 16, 2018, 07:52:41 AM
glad i was of help.let me see if i have this right. you changed it so they need more food,eat more often,but they can search for food longer or will starve slower?

     understanding the bannies is helpful.they do have minds of their own.knowing how they "think" could be an advantage.can we control eating habits separate from aging?? so we can add an age mod and another mod for their food needs and another for something else? from what i have seen we can partly do that.
        this can be  a double edged sword issue. the more often the bannies eat,the more they need to walk home and stop working. however,if they get lost, the starve delay would give time for them to get back to town. can you translate the code #'s to calander time? the game was developed with food production on a year to year base but the bannies breed and age at a much faster rate. this age mods work to correct.i wonder if the bannies think and hunger is still happening at the vanilla pace.

        while you are looking at this,can you see how the different workers think,or is that code hidden? it would be good to understand market vendors more.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 07:35:52 PM
actually, I changed it so the bannies need half as much food, but will eat sooner. Let me explain the vanilla values:

float _foodPerYear = 100 represents the units of food a bannie needs to consume each year, right? This can be changed independently of the rates the need to eat.

With Rate, it kinda works like the Bladder value for the Sims:

When a bannie eats, their hunger value starts at 0. They are 'full' at 0.

With each month, their hunger value increase by about 2.12. After 5 months, when their hunger value is above 10, the bannie's 'hunger' flag is flipped to true. Based on observation, I can assume that this flag is tied to a conditional (or a while loop) that is something like:


if bannie.hungry == true
  bannie.find_food
end


I did that in Ruby cause it's interpretive.

Anyway, once that hunger value gets to float _hungerLevel = 10.0, the bannie returns to their home or nearest storage to retrieve food. If they don't find food, they will retry every 0.1 months to find it. This is what happens when you see a bannie walk to their house (but another family member snags the last food), and then that bannie walks to the barn instead.

If the bannie is unable to find food, that hungerLevel never goes back to 0 and continues to climb. Once it hits 18, the yellow icon with the fork and knife appear above their head.

Once the hungerLevel hits 25, you get an event that 'PorgieGeorge the Laborer has died of starvation'.

So in my mod, I changed the food consumed per year to 50. So each person consumes half the food from vanilla. I did this to take more advantage of RedKetchup's 3-story homes, since I loved the uber-urban look but didn't like having fields and markets every other block in my grid. Another option I considered was doubling food production, but that meant updating the tables for EACH crop, orchard, and livestock. Not only was this time consuming, but it also severely unbalances the game since you could just trade the rest away entirely.

As for the rate, I made the villagers become 'hungry' when their hungerLevel reached 7.5 instead of 10. That meant that they'd go looking for food after about 3.5 months instead of 5ish. I did this to balance the diminished consumption. They require less food, but they spend more time eating the morsels they have (and less time producing other things).


tldr: Bannies base their consumption on an increasing value, once the value hits certain thresholds they, in order, eat, go hungry, starve to death.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 07:55:21 PM
Ahh! I got it!

Catch 22, it conflicts with the 'realistic aging' mods I love...

Hmm, guess I have to make a compatibility mod...
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 16, 2018, 08:01:21 PM
oh, other 'discoveries', age is measured in factors of 5. So:

float _adultAge = 2.0;
float _marriageAge = 2.0;
float _marrigeRange = 4.0;
float _childMinAge = 2.2;
float _childMaxAge = 8.0;


translates to vanilla values of:

Bannies are adults at 10 years old, marry at 10, will marry someone with 20 years of their age, can have children at 11, stop having children at 40.

They also live to a 'max age' of 65, but there's a tolerance of 3.0 (or 15 'fudge it' years).

Also they age 0.000277777 per real second... so I guess I divide by 5 to slow it to 1:1.


Man... I suddenly have a lot of power now that I know some of the hidden variables... I can effectively make a town of elves... Actually, with the dark elves skin that'd be cool. Make bannies live to 200+, but they rarely have children.
Title: Re: Values in Citizen.rsc?
Post by: brads3 on November 16, 2018, 10:09:31 PM
wow. you really want them living to 200?  i do understand you trying to balance the game toward  city building. it is a juggle to find a balance between realistic and being able to grow cities.everyone differs on that. some want to surive and some players would rather spend the time on building and decorating.

       did you try to make a mod that changes just the food habits and not affect the aging? then try 1 above the other back and forth? this is where the game is rigged against us. there should be a way to break the coding apart in pieces by unraveling how or what order it loads them in.so far it has not worked that way. we can affect the game and control only so far.if the game loads how much the bannies can carry,then food needs,then age,etc we should be able to affect the carrying and use another mod to change food needs at the same time. that without changing aging unless we add a mod for that too.in banished many times if we add a mod it creates a stop point so we can't make more changes.

      it would be great if we could figure a way to break some opf the parts and give us more control. like the maps. we should be able to have mods for the terrain, the texture,more lakes,different trees or plants,etc. in separate mods.whereas now,uif you choose  a terrain mod,then you are stuck with everything included and can't do much more with it. if you follow what i mean.

      i do think deep inside those codes and numbers are some controls we are not aware of or don't yet understand.


       can you stagger it so they don't all get hungry at the same time or move food to their houses all at the same time? that could help the food graphs.
Title: Re: Values in Citizen.rsc?
Post by: Tom Sawyer on November 17, 2018, 02:20:08 AM
If you make a mod for changed citizen needs, you always also define (overwrite) aging values. It can't be split in different mods. The rule is that everything coded in one section of a rsc file will be compiled into one crs file and the game loads file by file from top to bottom of the mod list. So you have to make a decision how your half eating people are aging and so on. Values of other citizen mods are published here and there if you like to use them.
Title: Re: Values in Citizen.rsc?
Post by: Gatherer on November 17, 2018, 03:10:45 AM
In theory I like the idea of urban dwellers needing less food per year so not to plant more fields in bigger urban centers. On the other hand that defeats the purpose of various markets available to some extent. Mr. Red has some specialized markets and stores also for 3 floor houses which are quite handy for major towns. With enough vendors assigned you can support a lot of people if the stores are placed at strategic points of town, without the need for fields being close.

Perhaps 50% les food needed per annum is a bit low though. What about 70-75%
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 03:18:26 AM
You know, Tom Sawyer, I was thinking about just that... theres 2 really interesting things Luke's SDK allow us to do:

-  include new files that dont overwrite existing .rsc files. This is how new models, crops, buildings, etc get added

- reference and load external resources. This is how we can declare what meshes and sprites get used with a template, or what professions get assigned to a citizen.

So I'm wondering if I can break Citizen.rsc into subsections based on how its values are assigned (food, aging, reproduction, work, etc), create NEW resource files that assign values for those subsections (CitizenAging.rsc) and load them as an external resources.

Doing so could allow modders to overwrite separate values and mix to mix and match features from otherwise conflicting mods.

-Gatherer: the value could use some tweaking, but markets would still be very viable. Remember that they need to eat more often, so a poor resource network means that bannies spend more time looking for food than vanilla. Without those shops, you're foresters will be spending less time in the forest and more time running back to town cause they got hungry

- brad3 : just thinking aloud :) theres a number of different approaches for this stuff. If modularized packages work, we could set any number of sub mods so that games could be customized to down to each value. Of course, that do mean having 10x as many mods, but whatever.

As for staggering their food consumption, that isnt possible without defining a new function. Once an instance of the citizen is initiliazed...erm, 'born', that hunger timer starts running. That's why your first settlers all eat at the same time, because they are all born at the same time. But by virtue of being different distances from a food source, and eating at different times as they get to that food source, they naturally end up resetting their hungerLevels at different paces.
Title: Re: Values in Citizen.rsc?
Post by: Tom Sawyer on November 17, 2018, 03:38:58 AM
That would be a great solution for lack of space in urban development.. Come on townies, just eat half. ;D

Joke aside, if you find a way to influence the core game in another way than the modkit allows it, would be fantastic. With the modkit I doubt it is possible to split things like citizen needs and aging. The game grabs values from certain external resources, in this case from citizen_citizen.crs and I have no idea how to change that.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 04:02:07 AM
Oh, I'm fairly positive that .crs file is created after compiling. The file extension convention suggests that too. If .rsc is resource, .crs strikes me as compiledResource.

Let me futz with this a tad and see. It's still 7 am here though, so I'm theorizing this from under my covers hahaha

EDIT:

As it turns out, Luke already breaks the aspects of Citizens apart:

Top of Citizen.rsc is:

ComponentDescription resource
{
// how often to update
UpdatePriority _updatePriority = Second;

// declare types that will be used
Description _descriptions
[
"ui",
"toolbar",

"model",
"picking",
"highlight",
"character",
"statusicon",
"storage",
"citizen",
"citizenai",
]
}


The array of strings there matches each 'description' for the sub-sections of the .rsc file:


ToolbarDescription toolbar
{
StringTable _stringTable = "Dialog/StringTable.rsc:objects";
String _stringName = "Citizen";
}

CharacterDescription character
{
float _headingOffset = 0.0;
float _turnFilter = 0.96;
float _defaultAnimationBlendTime = 0.5;

float _slowSpeed = 0.75;
float _fastSpeed = 1.2;
float _fastestSpeed = 1.4;
}


Wanna guess what those description strings map to? Check the attachment...

Yeah, that's where the compiled resources are built from.


Here's where my wild theory comes in. I'm thinking I can create a file called, idk, CitizenLifeValues.rsc.

Now we have a file that 'only' modifies marriage ages (I tweaked those values), death/life expectancy, health and happiness thresholds, disease, food, tools, cold resistance, clothing life, doctor effectiveness, and work selection values. (yeah, I know it's a lot)

What it DOESN'T include are which models are used, the animations used for picking up resources, how fast/slow citizens walk (on or off roads), or how many materials they can carry.

What this means:

We can make a base, required mod that replaces Citizen.rsc with an empty array(to overwrite vanilla). We then create new files that each have one string in the Descriptions array and build the .crs files separate from one another. Then you can add mods that modify those separate sections and build their individual .crs files

This file would pretty much be:

ComponentDescription resource
{
// how often to update
UpdatePriority _updatePriority = Second;

// declare types that will be used
Description _descriptions
[
"citizen"
]
}

CitizenDescription citizen
{
Profession _schoolingProfession = "Game/Profession/Profession.rsc:teacher";
Profession _churchProfession = "Game/Profession/Profession.rsc:priest";
Profession _doctorProfession = "Game/Profession/Profession.rsc:doctor";

// age at which children becomre adults
float _adultAge = 2.6;
float _marriageAge = 2.6;
float _marrigeRange = 4.0;
float _childMinAge = 3.0;
float _childMaxAge = 8.0;

float _maxAge = 15.0;
float _maxAgeTolerance = 3.0;
float _agePerSecond = 0.000277777;

float _childTerm = 900.0;
float _postChildTerm = 1800.0;
float _postChildTermTol = 5400.0;
float _childBirthHealthy = 0.00625;
float _childBirthUnhealthy = 0.025;

float _health = 10.0;
float _maxHealth = 10.0;
float _unhealthyLevel = 8.0;
float _healthUpdateInMonths = 3.0;

float _maxHappiness = 10.0;
int _minFoodForHappiness = 4;
int _maxFoodForHappiness = 12;
float _happinessUpdateInMonths = 3.0;
int _workForHappiness = 10;
float _unhappyLevel = 0.6;
float _depressedLevel = 0.25;
int _idleRange = 25;

// chance of disease, per year.
RandomSelection _diseaseChanceHealthy
{
float _years = 20;
float _population = 500;
}

RandomSelection _diseaseChanceUnhealthy
{
float _years = 1;
float _population = 400;
}

RandomSelection _diseaseChanceNomadTrade
{
float _years = 1;
float _population = 250;
}

// how long disease lasts in months +-
float _diseasePeriod = 1.0;
float _diseasePeriodTol = 0.5;

// how long immune to disease after recovering
float _immunityLength = 12.0f;

float _foodPerYear = 50;
float _foodLevel = 25.0;
float _hungerLevel = 7.5;
float _starvingLevel = 18.0;
float _maxHunger = 25.0;

float _retryInMonths = 0.1;

float _fuelLevel = 8.0;

float _coldnessLevel = 7.5;
float _freezingLevel = 15.0;
float _coldPerMonth [ 12.0, 8.0, 5.0 ]
float _maxColdness = 20.0;
float _minTemperature = 48.0;

int _toolQuality = 100;
float _toolPenalty = 5.0;

int _requiredEducation = 400;
float _educationTimeLength = 3.0;
float _educationWorkLength = 10.0;

float _doctorChanceOfDeathScalar = 2.0;
float _medicateWorkLength = 10.0;
float _medicineEffectivenessInMonths = 0.01;

float _clothingLengthInMonths = 48.0;

int _maxWaterForFireSearch = 64;

int _minDistanceForWork = 60;
int _maxDistanceForWork = 2000; // must encompass longest walk path!
int _timeUntilMaxDistanceForWorkInMonths = 6;
int _maxWalkInWinter = 200;
float _minTemperatureForWinterWalk = 45.0;

GraphicsMesh _tools
[
"Models\Citizen\ToolAxeMesh.rsc"
"Models\Citizen\ToolPickAxeMesh.rsc"
"Models\Citizen\ToolScytheMesh.rsc"
"Models\Citizen\ToolHoeMesh.rsc"
"Models\Citizen\ToolHammerMesh.rsc"
"Models\Citizen\ToolFishingMesh.rsc"
"Models\Citizen\ToolHammerMesh.rsc"
"Models\Citizen\ToolHandSawMesh.rsc"
"Models\Citizen\ToolBucketMesh.rsc"

"Models\Citizen\BarrowEmptyMesh.rsc"
"Models\Citizen\BarrowFullMesh.rsc"
]
}

[\code]
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 06:07:20 AM
Update:

So far, it looks like my theory is correct. I removed the UI from the Citizen.rsc file and added it to its own file. Then I used the Package.rsc file to load the new 'CitizenUi.rsc' and package it with the Citizen.rsc file.

It leads to some weird naming convention, but that's pretty much because Luke is using string interpolation when compiling the file names. You can see my compiled resources in the 'compiled.jpg' file, and a screenshot showing the game still running and loading UI for the citizens/bannies correctly.

God, I love coding.

I guess the next step from here is to break all the sections of Citizen.rsc out, then try modifying ONE of those files to see if the changes load correctly. After that, I need to make a separate .pkm to see if I change one of the Citizen sub-sections (like Cititzen_character) and overwrite my new library mod. If that last step works, we can use the same method on literally every resource file.

tldr; if I manage to make this work, we no longer have to pick a variation of a single .rsc, we can make variations of .crs instead. In layman's terms, WAY more customization.
Title: Re: Values in Citizen.rsc?
Post by: RedKetchup on November 17, 2018, 06:12:34 AM
Quote from: tangent on November 17, 2018, 06:07:20 AM
God, I love coding.

awesome !!!

awesome cause you completly lost me when you started to break the citizens.rsc into replacement pieces ^^
i have 0 knowledge in programmation.

i really hope you can accomplish great things !!
Title: Re: Values in Citizen.rsc?
Post by: embx61 on November 17, 2018, 06:39:32 AM
Not sure about this but are we all ready doing this?

This is what we call an override. Some segments of a file are changed and the rest stays as Vanilla.

Instead of after changing a value we define that changed segment as for example CitizenDescription: citizen

So the compiler only compiles the citizen part of the Citizen.rsc file.

The citizen part is where most changes happiness, tools, cold, marriage, etc. are done and I doubt that segment can be split up into more parts without having the source C++ code.
So everything in this segment get overwritten by another mod which changes the segment too and is higher in the Mod list.

I not think all of the code segment below can be split up. It is all in the citizen object.
CitizenDescription citizen
{
Profession _schoolingProfession = "Game/Profession/Profession.rsc:teacher";
Profession _churchProfession = "Game/Profession/Profession.rsc:priest";
Profession _doctorProfession = "Game/Profession/Profession.rsc:doctor";

// age at which children becomre adults
float _adultAge = 2.0;
float _marriageAge = 2.0;
float _marrigeRange = 4.0;
float _childMinAge = 2.2;
float _childMaxAge = 8.0;

float _maxAge = 15.0;
float _maxAgeTolerance = 3.0;
float _agePerSecond = 0.000277777;

float _childTerm = 900.0;
float _postChildTerm = 1800.0;
float _postChildTermTol = 5400.0;
float _childBirthHealthy = 0.00625;
float _childBirthUnhealthy = 0.025;

float _health = 10.0;
float _maxHealth = 10.0;
float _unhealthyLevel = 8.0;
float _healthUpdateInMonths = 3.0;

float _maxHappiness = 10.0;
int _minFoodForHappiness = 4;
int _maxFoodForHappiness = 12;
float _happinessUpdateInMonths = 3.0;
int _workForHappiness = 10;
float _unhappyLevel = 0.6;
float _depressedLevel = 0.25;
int _idleRange = 25;

// chance of disease, per year.
RandomSelection _diseaseChanceHealthy
{
float _years = 20;
float _population = 500;
}

RandomSelection _diseaseChanceUnhealthy
{
float _years = 1;
float _population = 400;
}

RandomSelection _diseaseChanceNomadTrade
{
float _years = 1;
float _population = 250;
}

// how long disease lasts in months +-
float _diseasePeriod = 1.0;
float _diseasePeriodTol = 0.5;

// how long immune to disease after recovering
float _immunityLength = 12.0f;

float _foodPerYear = 100;
float _foodLevel = 25.0;
float _hungerLevel = 10.0;
float _starvingLevel = 18.0;
float _maxHunger = 25.0;

float _retryInMonths = 0.1;

float _fuelLevel = 8.0;

float _coldnessLevel = 7.5;
float _freezingLevel = 15.0;
float _coldPerMonth [ 12.0, 8.0, 5.0 ]
float _maxColdness = 20.0;
float _minTemperature = 48.0;

int _toolQuality = 100;
float _toolPenalty = 5.0;

int _requiredEducation = 400;
float _educationTimeLength = 3.0;
float _educationWorkLength = 10.0;

float _doctorChanceOfDeathScalar = 2.0;
float _medicateWorkLength = 10.0;
float _medicineEffectivenessInMonths = 0.01;

float _clothingLengthInMonths = 48.0;

int _maxWaterForFireSearch = 64;

int _minDistanceForWork = 60;
int _maxDistanceForWork = 2000; // must encompass longest walk path!
int _timeUntilMaxDistanceForWorkInMonths = 6;
int _maxWalkInWinter = 200;
float _minTemperatureForWinterWalk = 45.0;

GraphicsMesh _tools
[
"Models\Citizen\ToolAxeMesh.rsc"
"Models\Citizen\ToolPickAxeMesh.rsc"
"Models\Citizen\ToolScytheMesh.rsc"
"Models\Citizen\ToolHoeMesh.rsc"
"Models\Citizen\ToolHammerMesh.rsc"
"Models\Citizen\ToolFishingMesh.rsc"
"Models\Citizen\ToolHammerMesh.rsc"
"Models\Citizen\ToolHandSawMesh.rsc"
"Models\Citizen\ToolBucketMesh.rsc"

"Models\Citizen\BarrowEmptyMesh.rsc"
"Models\Citizen\BarrowFullMesh.rsc"
]
}


Maybe you are talking about something else and I missed the point of what you are want to do.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 06:53:23 AM
@embx61 So, I'm overriding the Citizen.rsc file, since that is actually just an index of objects used to define various attributes of the Citizen class. I'm actually a Ruby/Javascript developer, so I'm just pinching my nose and hoping that basic principles of OOD/OOP apply here :)

With that said, I've only broken down index into the description objects:

HighligtDescription highlight {}


With the library in place, the vanilla index for Citizen.rsc is replaced with an empty file


// layout of the entity
ComponentDescription resource
{
// how often to update
UpdatePriority _updatePriority = Second;

// declare types that will be used
Description _descriptions
[]
}

StateMachineDescription statemachine { }


I'm a little worried about performance since there are now 11 calls to statemachine {}, but I'm guessing that's just an initalizer/constructor function and that it won't cause lasting harm.

As for breaking down the description citizen object down further... I have ideas for that:


CitizenDescription citizen
{
Profession _schoolingProfession = "Game/Profession/Profession.rsc:teacher";
Profession _churchProfession = "Game/Profession/Profession.rsc:priest";
Profession _doctorProfession = "Game/Profession/Profession.rsc:doctor";

...


At the beginning of this object, Luke imports Profession objects and points the variables (_schoolingProfession) to path resources. Those resources are child classes of the Profession Parent class.

We may (MAY) be able to define child classes of the citizen object and break the large Citizen class into smaller objects. That would give us independent customization of those values. With that, we can have a separate mod for aging and food.

The issue there isn't with the code... it's with end users. We'd have to make a SUPER thorough walkthrough describing load orders, required vanilla-valued library mods, and probably some computer science lessons built in to help non-dev's understand what is actually going on...


With that said:
Screenshots prove that fully breaking apart the Citizen.rsc into sub-resources correctly compiles and allows the game to function normally.
Title: Re: Values in Citizen.rsc?
Post by: kid1293 on November 17, 2018, 06:56:18 AM
I agree to what EB said. We do it all the time with overrides.
And your method would still be dependent on who's mod is on top.

A way to add more options to existing paragraphs would be nice but probably impossible.

Like have 3 trees and a modder adds a 4th. Then next modder could add 5 and 6.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 06:58:56 AM
@kid1293 oh totally. The library pkm would have to be the first loaded, so that any sub-mod could overwrite the one crs they wanted to, but still have vanilla values for the other aspects of the library. For instance, we could have a mesh replacement for how citizens render AND a 1:1 aging mod load without having to code them together.

A community library would mean maintaining a Github repo with the base library, and modders would have to fork the repo or do PRs to add their content...

Additionally, I don't know how C++ handles nil/null/NoMethodErrors. If it fails silently but doesn't crash the program, then modders building off the community library would do pull requests adding a call to their rsc/crs files within the parent class object.

If, when loading mods, the game tries searching for tree 'foo' under the foliage class, but doesn't find it, will it continue to compile the other assets? Will it throw an error, but compile the rest anyway? Or will it just crash?

Oh, here's what the compiled resources look like with this method:
Title: Re: Values in Citizen.rsc?
Post by: embx61 on November 17, 2018, 07:06:06 AM
I understand that the segments like UI, citizen, highlight, etc. can be compiled one at a time and lots of us do this with overrides.

But if Kid and I both change something in the same segment in that file one of ours will be overwritten if both mods are loaded.

Spitting up the citizen part into more parts which would be awesome because then it is possible what you are after but is in my view not possible unless the structure in the C++ source code can be edited and we not have the source code.

Title: Re: Values in Citizen.rsc?
Post by: kid1293 on November 17, 2018, 07:08:53 AM
One minor/major objection is - Do we want to incorporate a completely new system
that is not automatic? We (modders) are a lazy bunch if we can.

Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 07:21:12 AM
Quote
Spitting up the citizen part into more parts which would be awesome because then it is possible what you are after but is in my view not possible unless the structure in the C++ source code can be edited and we not have the source code.

Yeah, without the source code there's a LOT of guesswork involved. Not having access to functions is particularly frustrating, but completely understandable. Still, there are examples within the resource files (namely Profession) that suggest we'd be able to set up really basic inheritance to handle that.

...in fact, I'll give that a go either this weekend or Monday. If it works, I'll upload it so that we can try each making different values and cobbling them together :)

QuoteBut if Kid and I both change something in the same segment in that file one of ours will be overwritten if both mods are loaded.
True, but that happens anyway. It's up to the end user to decide which mod to use or which mod to load first

Quote
One minor/major objection is - Do we want to incorporate a completely new system
that is not automatic? We (modders) are a lazy bunch if we can.

Yeah... that's a daunting thought. The worst part would be fragmenting the resources files initially. 1 typo and BLAM! Compile error. I guess this experiment was mostly just proof of concept?

Yet... if we were to implement a system like this... think about the ramifications! Fully customizable Banished (at least in the sense of the variables it uses to load assets). It'd take a sizeable cabal of the more influential modders within the community to agree to a framework.

Anyway, here's the pkm with the library. I can also provide the folder with the uncompiled assets if anyone wants to mess with it some.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 07:50:35 AM
So doing some learning on C++ and rereading some replies, I've learned some stuff. Particularly that fragmenting the .rsc isnt too useful since a new mod can just call one of the child objects directly (thanks, emb!).

That said, my focus now is to split apart the citizen description object into child components that can be molded independently. Wish me luck
Title: Re: Values in Citizen.rsc?
Post by: Gatherer on November 17, 2018, 07:54:54 AM
Good luck!
Title: Re: Values in Citizen.rsc?
Post by: Tom Sawyer on November 17, 2018, 08:20:46 AM
Maybe Red was not really awake yet or needed a coffee first.^^ As Kid and EB said, you just figured out the standard way of modding, where we change a section of a resource file and compile it into its crs. I loaded your library pkm but can't see how this could work. I would like to see the source to try to understand, if you did not reject this idea. Keep going. Maybe it will lead to something! :)
Title: Re: Values in Citizen.rsc?
Post by: embx61 on November 17, 2018, 08:24:37 AM
Yeps, sadly Banished not really have a SDK (Software Development Kit)
I remember Civilization Game had a SDK and some good stuff was taken out of the Exe and compiled into a DLL and the source of that DLL was given for free.

Knowledge of the C++ language was a must because some real C++ stuff could be changed and the DLL recompiled.
So beside graphics/xml/Python changes direct changes to some of the source could be changed too like even some AI behavior.

All the stuff which is listed in the citizen part are in the source code defined in the object citizen.
So splitting up/delete/add to this is not possible without the source code.

But we appreciate your efforts on this and who knows which (other) stuff you can come up with.
Some stuff what we deemed was not possible was unlocked by some members by digging through the mod kit files over the years.
Flowing water and real transparent glass are two of them.

Good luck in your quest to hopefully unlock some more stuff even if it will not be what you were after because of just too much restrictions in the Mod Kit.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 08:58:26 AM
Civilization! That's where I first cut my teeth with programming! Changing XML values.

@Tom Sawyer Here's the zip with the source files for the pkm. Maybe I actually did something useful and just misunderstood something?

I was under the impression that changing 1 value in Citizen.rsc would recompile ALL crs (which it does), but that those crs assets would overwrite another mod that changed something in the same rsc as you.

In other words, if I changed something with the citizen toolbar, and you changed something with the mesh, if your mod was loaded after mine, it would overwrite my toolbar changes even though the toolbar was a different crs.

My idea with the library was that we could use the library as a base mod (which overwrites vanilla indexes with vanilla-valued sub-files) and that you could create your template/CitizenModels mod and I could create my template/CitizenToolbar mod and they wouldn't overwrite one another.

Anyway, I attached a zip with the source files.
Title: Re: Values in Citizen.rsc?
Post by: kid1293 on November 17, 2018, 09:16:34 AM
If you don't call any other subsection than the one you changed, the compilation will get default or
other changes made to the other subsections. Has always been.

I can change what spawns from a tree and Necora can change the tree itself.
A third could make them temperature dependent. It all compiles if we only address
the specific subsection.

Breaking down subsections is beyond our knowledge right now.
It goes way beyond and it is one of the biggest wishes we have.
Make game recognize ALL added start/climate/landscape options. :)
All added tree spawns (you pick and choose at load time what you want)

Keep working @tangent . Luke absolutely made a lot of workarounds and maybe
you can find useful things hidden in the code.

Title: Re: Values in Citizen.rsc?
Post by: embx61 on November 17, 2018, 09:18:29 AM
If a modder makes a change in a resource file and define that change as rawMaterialXXXX.rsc for example then indeed it would be overwritten or overwrites another mod which does the same.

That is why we use the separate segments only and call them as such. It is a better way but it is sadly not full proof.

Here the part of the citizen.rsc file many mods use when Luke gave us more flags/limits.
StorageDescription storage
{
RawMaterialFlags _storageFlags = Edible | Fuel | Tool | Wood | Stone | Iron | Health | Clothing | Textile | Alcohol | Grain | Fruit | Vegetable | Protein | CoalFuel | Custom0 | Custom1 | Custom2 | Custom3 | Custom4 | Custom5 | Custom6 | Custom7 | Custom8 | Custom9;
bool _areaBasedLimit = false;
bool _available = true;
int _volumeLimit = 100;
}


Note that is all there is in that file while the Vanilla Citizen.rsc file contains way more.

Then we call this Citizen as "Template/Citizen.rsc:storage", in the XXXXXResources.rsc file.

So after the : is the only part what will be compiled so another mod which change something in the same file but another segment of it will call it
Template/Citizen.rsc: character for example.

So both files can run together as both have changes in different part of the Citizen.rsc file and called them correctly.

But it become a problem if two mods change the same segment as then the mod higher then the other mod in the list will overwrite the lower one.
If you read more on the forum you will read a lot about spawning stuff from different mods.

As some mods have to edit the same file  and the same segment which spawn stuff on the map is defined so the load order become important.


Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 09:40:51 AM
Okay, this is making a lot more sense. Thanks for the help, folks!

I gotta entertain some in-laws, but I'll be back in the code soon enough.
Title: Re: Values in Citizen.rsc?
Post by: brads3 on November 17, 2018, 10:15:05 AM
TOM:"

If you make a mod for changed citizen needs, you always also define (overwrite) aging values. It can't be split in different mods. The rule is that everything coded in one section of a rsc file will be compiled into one crs file and the game loads file by file from top to bottom of the mod list. So you have to make a decision how your half eating people are aging and so on. Values of other citizen mods are published here and there if you like to use them."

i argue with that. not with TOM's thinking but with the idea that we can't make the game do it. i just woke up so remind me i will come explain later. i think we can fix it or trick the game into loading more than 1 mod into those files.
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 12:36:51 PM
we could just define a bunch of  variables for values in the main rcs, then add extra mods that assign values to those variables.
Title: Re: Values in Citizen.rsc?
Post by: brads3 on November 17, 2018, 12:58:13 PM
you all sound like you are on the right track. half of the coding is like greek or a foreign language to me. i try to be simple. my understanding is the game loads the 1st mod and  adds its code. what that mod doesn't add,it reverts back to vanilla code.so take KID's propertime mod,the game loads the age codes.the parts KID didn't change,the game automatically loads from vanilla.this process blocks any mod after from having any effect.to me this is wrong.
       we should be able to create a call-back loop so the door stays open. as the game loads the mods,plural,it adds codes from all.if there is something not coded ,then the game reverts back to vanilla AFTER all mods are loaded. in the example of KID's propertime mod if a mod after that changes the looks of the bannies it would still load since KID's properime mod didn't do anything to that part of the coding.

   i am not a modder or programmer.know enough to get mysef in trouble. can a mod be made to leave these doors open and set  a call-back loop? this saves rewriting mods and also having to add many code lines to mods. many small mods i do not see a problem of having. not if those mods do something. manyplayers add several mods and don't realize some of those won't do nothing since they are blocked by the top most mod.

       to me the way the game is now is goofy. we can add crops,livestock, and many other things. so we should be able to add to the trees,plants.map start settings,etc. this new idea could open many doors and give players tons of options. definetly worthh loooking into more.

      @tangent  were you being sarcastic about liking coding? understanding and being able to read it would be very very helpful.you could be a big addition to the modding team.someday i would like to learn how the bannies "think" more.there are easter eggs to be found. 
Title: Re: Values in Citizen.rsc?
Post by: tangent on November 17, 2018, 01:25:53 PM
Haha I wasnt being sarcastic THIS time.

So, the thing were all lamenting is that we can see the source code. Without the ability to define classes or functions, we're very limited in what we can do. Specifically, with your example, we cant do a call back because we dont know the loading function that initially gets called.

Banished, right now, is effectively like a scanner. We take a piece of paper, draw on it what we want and scan it in to be displayed on the computer. Theres all sorts of visual illusions we can draw to make the image on the screen nicer, but we cant open the screener and turn it into a 3d printer or anything.

That was a dumb example...but maybe it worked haha

Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on November 20, 2018, 04:59:28 AM
My brain can't handle this level of programming chat, but I can offer one suggestion...    Get Luke to release everything.    I know a lot of people are fine with what Luke did with Banished, but I have a different outlook.   I think it's wrong the way he ditched Banished and he needs to suck it up and finish the game properly.    Charging for a game and then leaving it broken is just wrong.   Either finish it or man up and release the code to somebody who is willing to clean up the mess and continue the game.   This is one of my main issues with early release style games that really tick me off.   These guys get money for broken stuff and then just dump it after awhile and expect everyone to just agree with their reasoning... "Oh, I decided to move on to something else bigger and better....", well, that's not a good enough reason.

There was another game called "Sol 0" that had developed a strong following and the guy dumped it and left behind an incomplete and broken game.   It's ridiculous.   If they no longer want it, release the code and be done with it and let others take over.
Title: Re: Values in Citizen.rsc?
Post by: embx61 on November 20, 2018, 07:37:22 AM
The game is not broken.
It works right out of the box.

Luke released the game about 4 years ago as a finished product beside major bug fixes.
He said he would add some modding support later and he did.

So nothing he said was wrong. Buyers knew what they were buying.
He only let the Linux/Max users down by not releasing versions of Banished for those OS'es  while he said he would.

Could he have done more, yes he could have, but Luke moved on to a new game.

I not see Luke releasing the source code. About 65% he is going to use for his new project so releasing the code would not be wise from a business point of view.

I think he should fix the Debug though so the new flags can be added through debug or tell us how we can fix it ourselves if that is possible.

I can understand that some are disappointed Luke not working on Banished/Mod Kit anymore but he is not in the wrong.

Title: Re: Values in Citizen.rsc?
Post by: RedKetchup on November 20, 2018, 09:40:13 AM
the game is not broken, it is finished and 100% operational.

it is not because you wish to do this that way or do that this way .... that the game is broken and a mess.
Title: Re: Values in Citizen.rsc?
Post by: Abandoned on November 20, 2018, 09:54:45 AM
Wow, Banished was playable and enjoyable even before all the great mods were added.  That is why so many of us are still playing and enjoying it.  I think Luke did a wonderful job all on his own making this wonderful game.  It is not broken or a mess.  Don't mess with it.  ;D
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on November 20, 2018, 11:11:16 AM
There is no doubt at all the modders have saved this game!  If it wasn't for the mods it couldn't be considered a complete game in my mind.   Vanilla is so limited, there is simply nothing there.    You modders have all but eliminated anything he had accomplished other then the rudimentary aspect of the game.   I'd have to look again, but I'm pretty sure there isn't much refinement or production in vanilla, very limited in everything it provides.

The modders deserve and have earned the rights to the code, you've developed this game 100x more then he has.

Seriously, you people are amazing, the stuff you are doing for this game is awesome!    I wouldn't be playing it without your stuff.   I realize the game wouldn't exist without Luke, of course, but without the mods, it might as well not exist for me.
Title: Re: Values in Citizen.rsc?
Post by: RedKetchup on November 20, 2018, 11:25:58 AM
Thanks you for your kind words :) @theonlywanderer
it is very appreciated
Title: Re: Values in Citizen.rsc?
Post by: Paeng on November 29, 2018, 02:41:31 AM
Quote from: theonlywanderer on November 20, 2018, 04:59:28 AMThese guys get money for broken stuff and then just dump it after awhile

Sorry, but I can't let this stand this way  :)

I been following the dev blog way before this game was released, and I cannot say that Luke broke any promises. He released Banished as a small (100Mb) game that was supposed to stand by itself. Modding was never on his plate (in his own words, he thought he would add a few small mods of his own design - which he did), but I don't think he expected a community that goes all out to mod his game on their own.

So in all fairness - he released a finished and very playable game with surprisingly little errors or bugs (which he fixed in a few successive updates), and then he took a well-earned timeout, and now he returned with plans for a new game, continuing to share his thoughts with 'his' community.

Reading his newer blogs it becomes clear that Banished development was a learning process for him as well. He is now seeing many things he could have done in a better way - good for us! Hopefully next time around he'll consider modding right off the start  ;)

Anyway, he delivered what was promised - even more, as he tried to rectify a few of the most glaring obstacles to modding. Sure, the game is not perfect from our point of view, it is hard to mod because of many hard-coded items - but again, modding was not on the original plate, so by now we all understand that certain changes are not easy -- maybe impossible -- to implement, specially not in code that he wrote like four years ago.

Not to forget that he is a 1-man-show, so it's understandable that he is now concentrating on his next game instead of endlessly and probably hopelessly wallowing in old sourcecode that he himself by now finds imperfect.


So I do maintain that he delivered an outstanding piece of software (1-man-show!) and managed to bring out the best in our modding community, who managed to add gigabytes of content to a game that was not even considered to be modded. That alone I consider quite a feat and proof that his code was not all bad at all.

As for asking to make his sourcecode free-4-all - well, imho that is expecting too much, as he plans to further develop and refine this code for his next game. Maybe he'll get to a point where he feels he cannot re-use that code... well, then he can still open source it  :D
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on December 01, 2018, 12:33:34 PM
It is indeed broken when it comes to many aspects, there is no doubt here.   The bannies don't follow roads properly for starters, I'd say that's a major issue that remains broken.   The logic behind how bannies manage things is still broken.   Bannies do random goofy things and everyone knows this.   The fact bannies still freeze and die of starvation standing 10 squares from a barn full of food and firewood should be considered a broken issue.   The fact bannies will be assigned a house or job that is on the complete other side of the map should be considered a broken issue.     I can set a building for demolition and watch two bannies standing right there do absolutely nothing and see two bannies come from further away to demo the building.  Same with construction or any other task.   These are all broken issues.

Don't get me wrong... I am a huge fan of the game, obviously, despite the issues.   I just don't ignore the fact there are many issues that should have been resolved and I consider the game broken because of it.

Housing has always been the most obvious!   You put a house next to a farm and the forester lives there.   Okay... that makes little sense!    Put a house next to the blacksmith and the baker lives there.... mmmkay!    Eventually they sort of adjust, but not like it should.       Some would say you need more houses closer to forester then, and that's maybe true, but at the same time..  shouldn't the person in any house represent the closest job to it's location first?

I'm sure that I'm not thinking of everything here, but this should be clear the game is broken.
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on December 01, 2018, 04:31:46 PM
One other broken thing....    the game crapping out at larger populations is a major issue and happens with most people playing from what I'v read on many forums.   I don't have any clue how people have achieved 5 to 6 thousand population with this game.  Even with the no smoke mod I can't go much beyond 1,000 without it driving me nuts and I have a pretty darn good gaming PC.  I'd say this is absolutely an issue he should have looked in to.
Title: Re: Values in Citizen.rsc?
Post by: Abandoned on December 01, 2018, 07:55:55 PM
LOL I think someone is playing the wrong game  :D :D :D
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on December 02, 2018, 12:37:35 PM
How is that, Abandoned?    Can I not enjoy a game simply because I admit it has flaws?   

Title: Re: Values in Citizen.rsc?
Post by: kid1293 on December 02, 2018, 01:06:31 PM
@theonlywanderer   - You seem pretty sure about how this game should be enjoyed and you let us know.
I wish I had that confidence when making mods. It is an endless row of compromises.
If I make a new product there are voices 'why I did it/why I didn't do another/is there more'
A bit unsettling if one think I do it for free. I am, and will always be, free to have my opinion
but since I publish my mods I must think twice before saying anything.

Maybe I am too old for this and should move on instead of wiping my eyes from the dust.
Don't stir up more!
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on December 02, 2018, 01:21:45 PM
I haven't told anyone how to enjoy anything, my position from day one around here has been "to each their own", the game is about whatever the player chooses it to be.    Others are trying to pigeon hole the game and claim it's supposed to be about some specific agenda... survival, organization....      I am not doing that one bit... I embrace the fact that mods exist and they are completely optional. 

I think you should absolutely voice your opinion, Kid..  it's how people communicate and get things done.  If people don't like it, they should grow a thicker skin.   I certainly am not stirring anything up.   If the only thing allowed around here is rainbows and sunshine, maybe I'll  leave!    I can't think of anything I've said that should upset anyone, but whatever.
Title: Re: Values in Citizen.rsc?
Post by: RedKetchup on December 02, 2018, 01:36:42 PM
your input and contribution are valuable. never take things personally here, there are 8 billions people on the planet and there will always be 8 billions of view and thoughts different. thats human.
and sometime to translate in a common language like english, cannot be always very accurate.

we like you.
Title: Re: Values in Citizen.rsc?
Post by: Abandoned on December 02, 2018, 01:57:03 PM
oh my, I do find it so hard to believe that anyone would enjoy a game that is so flawed and broken as they say this game is.  And of course it is just my opinion that those type of critical comments are not at all valuable. 
Title: Re: Values in Citizen.rsc?
Post by: theonlywanderer on December 02, 2018, 02:03:58 PM
If taken out of context and said out of nowhere...  I can see them not being valuable.   However, my complaints were clearly done within the context of justifying why the game code should be released so that somebody else can solve the underlying issues.

Now, if you actually had something of value to add....  like maybe trying to prove my claims wrong, which you can't because my claims are true, then it is your comments that were of little value to simply suggest I am playing the wrong game.
Title: Re: Values in Citizen.rsc?
Post by: Abandoned on December 02, 2018, 02:34:09 PM
 :D :D :D
Title: Re: Values in Citizen.rsc?
Post by: brads3 on December 15, 2018, 02:15:55 PM
did we scare @tangent  away? how is the coding going?