Author Topic: Values in Citizen.rsc?  (Read 2197 times)

0 Members and 1 Guest are viewing this topic.

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Values in Citizen.rsc?
« on: November 15, 2018, 09:01:37 PM »
Specifically lines 118-122 of this
Code: [Select]
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?

Online brads3

  • Banished Expert
  • *****
  • Posts: 3486
  • Country: us
Re: Values in Citizen.rsc?
« Reply #1 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.

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #2 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:

Code: [Select]
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...


Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #3 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:
Code: [Select]
..\..\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
Code: [Select]
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, but I can't get the dang thing to compile... any hints?

Offline RedKetchup

  • Champion
  • Banished Expert
  • *****
  • Posts: 10732
  • Country: ca
Re: Values in Citizen.rsc?
« Reply #4 on: November 16, 2018, 04:00:27 AM »
Alrighty then. The values I changed had the intended effect. Now for the tricky part.

Here's my batch script:
Code: [Select]
..\..\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

> > > Support Mods Creation developments with Donations by Paypal  < < <
Click here to Donate by PayPal .

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #5 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.

Online brads3

  • Banished Expert
  • *****
  • Posts: 3486
  • Country: us
Re: Values in Citizen.rsc?
« Reply #6 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.

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #7 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:

Code: [Select]
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.

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #8 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...

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #9 on: November 16, 2018, 08:01:21 PM »
oh, other 'discoveries', age is measured in factors of 5. So:
Code: [Select]
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.

Online brads3

  • Banished Expert
  • *****
  • Posts: 3486
  • Country: us
Re: Values in Citizen.rsc?
« Reply #10 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.

Offline Tom Sawyer

  • Modders
  • Banished Expert
  • *****
  • Posts: 1038
  • Country: no
Re: Values in Citizen.rsc?
« Reply #11 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.

Offline Gatherer

  • Banished Expert
  • *****
  • Posts: 1252
  • Country: si
  • DECO FANATIC!!!
Re: Values in Citizen.rsc?
« Reply #12 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%
There's never enough deco stuff!!!
Fiat panis.

Offline tangent

  • Laborer
  • **
  • Posts: 23
  • Country: us
Re: Values in Citizen.rsc?
« Reply #13 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.
« Last Edit: November 17, 2018, 03:24:43 AM by tangent »

Offline Tom Sawyer

  • Modders
  • Banished Expert
  • *****
  • Posts: 1038
  • Country: no
Re: Values in Citizen.rsc?
« Reply #14 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.

 

SMF spam blocked by CleanTalk