The Medieval Economy

How about allowing them the professions, which allows harvesting those yields?

Yeah, I thought of that too but wanted to address the immediate issue. Actually, I am not sure what all I have allowed Natives to do as they are no longer your vanilla Natives but rather Minor States so I will investigate that soon.

Thinking about native professions, I came up with an interesting profession setup.

That not only would be an interesting setup but a proficient one as well.

I have considered this on multiple occasions, but I have never actually done anything about it. If I want to produce 2 X instead of 3 Y, then let me produce 2 X. The change due to discovering a tech just makes this problem worse, but the fundamental problem exist regardless of techs.

Other mods haven't done anything regarding this issue, but the issue is minor when you don't have techs. It would still be useful to change production in RaR though.

Yeah, and considering that the one yield that is produced is simply the one higher up on the list of Yields, it seems unethical from a coding point of view. :D
 
Ok, getting back on subject. I am thinking of going ahead and adding Center City Plot functionality. When a City is created and the center plot is defined for the first time it will assign two Yields to the center plot, one being Food the other the dominate Yield. This will prevent the Yields from changing. After I get that done I will look into adding a Click Menu, perhaps clicking the Center Plot will bring up a Menu to Choose the Bonuses. Techs could actually allow you to have different kinds of Bonuses. Like you could have Gold and Hammers for your Center Plot Bonuses instead of crops.

Actually it seems kinda odd that the actual plot your City starts on produces crops as you'd think, "where are they growing these crops, in their houses?" Anyway, that reminds me of the idea we had where a City would start to lose its rural plots due to urbanization. Lib do you remember where it was on the forums that we talked about this? At some point I'd like to start a branch where this is the case just to test out how it would play.
 
Thanks Lib, I'm going to add that to the blackboard so I don't lose it again. I added a boolean Jit array for Center Plot Yields, when the City first updates its Yields it will turn on Yield Food and the best Yield for that plot, then each time it updates the plot it will check if food is already turned on, if so it checks the current Yield against its array value. Only Yields returning true will be produced.

If we add functionality to change Yields we will simply need to define how many Yields can be Produced (iMaxCenterPlotYields). This is something that could be changed with Techs as well. Then popup menus will let you set that many Yields (default would be 2) to true and only those Yields will be produced. If iMaxCenterPlotYields is -1 then the code knows just to use default Food and one other Yield. If iMaxCenterPlotYields > 0 then it will check for that many number of Yields to allow. If the code is done correct then only iMaxCenterPlotYields number of Yields will be set to true. Anyway, just thinking the code through in my head.
 
I have been thinking on how to deal with controlling what the city plot produces.

I propose something like this:
  • Left click on the city plot opens a popup window.
  • It has the yields possible to produce, amount of each and a checkbox for each.
  • When clicking the OK button, the checkboxes are looped to find the two checked ones (TODO: what if the player checks more or less than 2?)
  • those two are send as the two ints to CvCity::doTask() (this will make it work on networks)
  • CvCity has two YieldTypes variables, which are set by doTask(), or function called by doTask()
  • Production then uses those two YieldTypes to figure out what to produce
  • The YieldTypes have to be saved
  • Some GUI update to match YieldTypes rather than best yield

I think that should do it, though it's an open question what the AI should do. Possibly they should just pick the two yields with highest production, though the AI uses emphasize more than most human players. Taking that into account would likely be a good thing.

EDIT: Kailric wrote something for this and pushed it while I was writing this. I haven't read the new code yet, but it's clearly not what I proposed here.

Actually it seems kinda odd that the actual plot your City starts on produces crops as you'd think, "where are they growing these crops, in their houses?"
There is an XML telling city size names based on population count. How about each level gives production bonuses to the city plot where outdoor yield production have negative modifiers and indoor (like hammers) have positive. That way a small village can grow plenty of food between the houses while a major city can't.

Another thing I have been thinking of regarding city size: we need two numbers for city size. One is the current total size and another one for city plot size (all buildings). The latter will make sense in a number of cases as the farmers would live near their fields, hence not take up room inside the city.

It would make a whole lot of difference, both towards city plot production and (quite importantly) towards the population cap. It makes little sense that a farmer can't start living outside the city because the city itself lacks a well and hence enough water for more people. The farmer would dig his own well at his farm.
 
Well, (pun intended after I started writing!) The idea of building the city screen well, would be that it represents all wells in the vicinity of that city.

So said farmer can build his own well, but it would take the time it takes to build the city well without a dedicated hammer man.

Or you can order a hammer man to go help build the wells in and around the city thus speeding up the process.

I do like the idea of villages being better at rural center plot yields and cities being better at industrial center plot yields.

That makes satellite villages all the more important for cities.
 
I have been thinking on how to deal with controlling what the city plot produces.

I propose something like this:
  • Left click on the city plot opens a popup window.
  • It has the yields possible to produce, amount of each and a checkbox for each.
  • When clicking the OK button, the checkboxes are looped to find the two checked ones (TODO: what if the player checks more or less than 2?)
  • those two are send as the two ints to CvCity::doTask() (this will make it work on networks)
  • CvCity has two YieldTypes variables, which are set by doTask(), or function called by doTask()
  • Production then uses those two YieldTypes to figure out what to produce
  • The YieldTypes have to be saved
  • Some GUI update to match YieldTypes rather than best yield

I think that should do it, though it's an open question what the AI should do. Possibly they should just pick the two yields with highest production, though the AI uses emphasize more than most human players. Taking that into account would likely be a good thing.

EDIT: Kailric wrote something for this and pushed it while I was writing this. I haven't read the new code yet, but it's clearly not what I proposed here.

You snooze you lose;) Heh, what I put together was really quick, like 10 min worth of time so if we change it no big deal. I thought about assigning two Yields as you say, but then I thought, "What would Night do?" So, I used a Jit array so we are not limited to just two Yields being produced in the center plot.

There is an XML telling city size names based on population count. How about each level gives production bonuses to the city plot where outdoor yield production have negative modifiers and indoor (like hammers) have positive. That way a small village can grow plenty of food between the houses while a major city can't.

That's a decent idea and would work with changing center plot Yields.

Another thing I have been thinking of regarding city size: we need two numbers for city size. One is the current total size and another one for city plot size (all buildings). The latter will make sense in a number of cases as the farmers would live near their fields, hence not take up room inside the city.

It would make a whole lot of difference, both towards city plot production and (quite importantly) towards the population cap. It makes little sense that a farmer can't start living outside the city because the city itself lacks a well and hence enough water for more people. The farmer would dig his own well at his farm.

I think you may have missed Lib and I's conversation about rural vs urbanization. He posted a link to it a few posts up. We discussed issues like this and some ideas about as Cities grow they take over the surrounding plots, requiring you to bring in food and such from satellite villages, as Lib puts it. Anyway, its just ideas being tossed around, but I'd like to test out a version with those kinds of features.
 
You snooze you lose;) Heh, what I put together was really quick, like 10 min worth of time so if we change it no big deal. I thought about assigning two Yields as you say, but then I thought, "What would Night do?" So, I used a Jit array so we are not limited to just two Yields being produced in the center plot.
Good thinking, but you were wrong. I didn't consider allowing more than 2 yields on the center plot :lol:
It's actually a good idea, but for various reasons it would likely be beneficial to have a vector of enabled yields rather than having to loop a fixed sized array each time.

However I don't like your code. I can't tell if it is working, but it is surely not working as well as the one I explained.

Can you make a DLL popup menu pop up when you click the center plot? If you do, I can do the rest to make the plot production 100% user controlable.

I think you may have missed Lib and I's conversation about rural vs urbanization. He posted a link to it a few posts up. We discussed issues like this and some ideas about as Cities grow they take over the surrounding plots, requiring you to bring in food and such from satellite villages, as Lib puts it. Anyway, its just ideas being tossed around, but I'd like to test out a version with those kinds of features.
I didn't miss it. I just decided to ignore your nonsense :p

It's just an idea, which might never be implemented. Considering what to do without using this idea is entirely valid. However it did give me an idea. How about adding size (int) to each building? The city plot can then have a number of size points. Once those are used up, you can't build buildings anymore. We then add an improvement, which provides more points even if they aren't worked. This urban improvement will render the plot impossible to work, but it will provide the bonus size points even if not worked.

The food production on the city plot can then get the bonus -(current building points)/(city base size points)%. That way the food production will gradually decrease as you build buildings rather than depending on the number of people. In other words you will not be able to grow lots of food in a city if you fill it with empty buildings.

There are some details, which needs to be worked out, such as what about urban improvements being placed next to two cities? What if a city loses an urban improvement and end up with more buildings than it can handle?
 
Good thinking, but you were wrong. I didn't consider allowing more than 2 yields on the center plot :lol:
It's actually a good idea, but for various reasons it would likely be beneficial to have a vector of enabled yields rather than having to loop a fixed sized array each time.

However I don't like your code. I can't tell if it is working, but it is surely not working as well as the one I explained.

Well, there's no extra loops involved at the moment, other than the one that is in the vanilla code. I started to use a vector actually, but went with the Jit as I was a bit more familiar with that by now.

Can you make a DLL popup menu pop up when you click the center plot? If you do, I can do the rest to make the plot production 100% user controlable.

I'll see what I can do there, if nothing else we can add perhaps an invisible button in the center that you can click.


It's just an idea, which might never be implemented. Considering what to do without using this idea is entirely valid. However it did give me an idea. How about adding size (int) to each building? The city plot can then have a number of size points. Once those are used up, you can't build buildings anymore. We then add an improvement, which provides more points even if they aren't worked. This urban improvement will render the plot impossible to work, but it will provide the bonus size points even if not worked.

The food production on the city plot can then get the bonus -(current building points)/(city base size points)%. That way the food production will gradually decrease as you build buildings rather than depending on the number of people. In other words you will not be able to grow lots of food in a city if you fill it with empty buildings.

There are some details, which needs to be worked out, such as what about urban improvements being placed next to two cities? What if a city loses an urban improvement and end up with more buildings than it can handle?

I had similar thoughts myself. It's also not just production buildings but housing can be factored in as well. As your buildings begin to fill up with workers (and presumedly their families) where do all these people live? So there could also be urban improvements just for that.
 
Ok, I added a popup Menu for City Center Plots called BUTTONPOPUP_CENTER_PLOT_CLICK. All it does at the moment is display Help Text on mouse over and the popup menu just displays header text. I created an invisible button that gets clicked, we could make it a small visible button that hovers close to Center, kinda like the small Citizen Lock icons, because people want realize this functionality easily unless they mouse over the center plot or it is talked about in Tutorial or Pedia Hints etc.
 
Ok, I added a popup Menu for City Center Plots called BUTTONPOPUP_CENTER_PLOT_CLICK. All it does at the moment is display Help Text on mouse over and the popup menu just displays header text. I created an invisible button that gets clicked, we could make it a small visible button that hovers close to Center, kinda like the small Citizen Lock icons, because people want realize this functionality easily unless they mouse over the center plot or it is talked about in Tutorial or Pedia Hints etc.
Ok, I will look into this, though I plan on fixing the diplo hang bug first.

As for telling people what we add to the game. Generally speaking we should add info on stuff like that to the concept pedia, but we do in fact have a wiki page on SF. It would be nice to have a page listing important differences from vanilla. Since the list should be overview, it would make sense to at least some of the features would be links to a page explaining precisely what it does.

Yeah, on the subject of housing I was musing on the idea of building housing but just as a building like the well, that does stuff like generate flat fealty, as is you givve people nice things they will like you more!
We could do something simple like each unit counts 1 towards the building size score. Perhaps if you build proper housing with hammers and possibly other yields, you can build a building, which provides "free" housing for a number of people, the idea being that the house could give say 5 free slots for size 2.

Happiness could also be influenced by housing. If you provide housing, they will no longer have to build them themselves, hence they have more time to work for you.
 
Working on the center plot yield thing, I realized something. Rather than a simple "I want this yield" feature, we should have some automation in it as well.

We need a function, which does the following:
  1. Clear yields
  2. loop groups
  3. Loop yields to find the best one, which isn't already set for production
  4. Add best to production
  5. goto 2 unless it was the last yield in the group
The groups are then
  1. selected by checkboxes
  2. Emphasized
  3. Neutral
  4. Deemphasized
This structure will allow dictating one or more yields you want to produce with the checkboxes as well as including rules for what to do if you enable too many. Furthermore rather than the current behavior, it will use emphasize rules for picking yields if you didn't pick all of them. Finally the number of yields produced will be the same as the number of times the loop is run meaning we can have an int in CvCity controlling how many yields to produce.

I think it's great because you can control what yields to produce while at the same time the game will pick something you most likely want to pick if you don't do it yourself. The ability to mix those is likely very useful if you get a civic, which gives +1 yieldtype for 5 turns or something. Imagine the hassle if you had to set that up manually.

The emphasize setup is mainly because the AI uses that alot. Honoring those settings mean the AI will become more flexible without adding more AI specific code.

Coding progress is different though. I have managed to make the popup window show a list of yields that the center plot can produce, but that's it. The checkboxes have no functionality yet.
 

Yeah, Night, I like where this is going. It will help the AI as well to figure out what to do with the Center Plot.

I just read in my "The Middle Ages" book and I quote, "When the citizens decided to expand the town and build new walls, they left enough space to accommodate gardens, orchards, and vineyards, as a precaution against siege."

So, I retract what I said earlier about center plots having a crop production. Seems, the Medievalites where smarter than I thought :lol:
 
Top Bottom