The Medieval Economy

I think we should tar and feather Kailric and throw him in the stocks, (with two sticks and a laptop so he can keep coding) for besmirching the good name of the Kingdom and it's LOYAL subjects!

Wouldn't be the first time :cry::D
 
True, but you are speaking of the specific example. I'm considering the concept that somebody might make a profession, which produce multiple yields on a city plot (if you could place a unit there). The XML flexibility allows it.

Dag nabbit, you nab it before I could. Need to be quicker on the draw!!:cowboy::ar15:
 
I made a new branch called center_plot. It is hopefully short lived and merged back soon, but needed right now as I think I broke the existing code, which I intend to replace. I finished the GUI part and have a bool for each yield, which I can turn on/off through the network. Now I "just" need to make the city code use the bool as intended.

I intentionally postponed strings. The reason is that I decided to keep the branching simple and make a DLL only branch, hence no XML updates. It's not a big deal, but the GUI will be pure function and little eyecandy until it gets proper strings. Just something to keep in mind in case you decide to take a look.

We have one int and 3 bools unused in the center plot task arguments. That leaves a great deal of freedom to add new stuff to the center plot window, though I can't think of anything useful at the moment.
 
It's working. I can now control which yields the city plot produces :woohoo:

It's still not done though. The todo list is far from empty.
  1. Lack of update when changing emphazise
  2. Yield icons on plot not updating
  3. Yields not in the list (not possible to produce) act like they have their checkboxes checked
  4. Cleanup. Some of the existing code will no longer be used.
  5. The data is still not saved (waits for #3 to not corrupt the data)
So close and yet so much more to do. However the remaining parts feels like they are a whole lot less now that there is something working.

I'm not entirely sure if I take into account that it is a city plot when it is calculating how much the plot can produce. Changing this later on is very simple as it is a matter of changing a single line. There is no code duplication.

I just had an idea. I will let the city remember which yields it can produce. No need to check all over and over. That list can also be used to solve issue #3.
 
I figured out what to do about the checkboxes for the yields, which were not in the list. When reading checkboxes, if the yield in question can't be produced, then false is used regardless of the checkbox state. Not only did this solve the current bug, it also kills the settings for yields if they can't be produced anymore.

This solution resulted in 3 different functions, which needs to know if a yield can be produced. I added getCityPotientialYieldProduction(yield) to CvPlot and CvCity to ensure that we only have one check for this, hence no bugs due to inconsistencies. The city function is just a shortcut to the plot function for center plot, which allows the calling function to work with only the city pointer.
 
I found the problem with lack of yield update. It is actually updating, but it is drawing the wrong yields.

The problem is that there are more than one way to calculate yields from a plot and none of them delivers the result I want.

For placing a city on plains:
  1. calculateNatureYield() correct yields, but wrong modifiers
  2. calculateYield() lacks barley
  3. calculatePotentialYield() replaces barley with hammers
I use #1 to calculate production, #2 is used on the map in the city screen and #3 is used on the map outside the city screen.

Another problem with those 3 functions is that it would appear that only #1 produces ore in a city build on hills. I remember vanilla and RaR producing ore if the colony is on hills.

Note that the hammer is never displayed as only cargo yields are displayed. I kind of like the concept of sacrificing producing a yield on the city plot for a free hammer though.

I think the best solution is to just accept wrong yields for now and then clean up the plot yield code really soon. I question if vanilla got it right and a high number of inconsistent mods haven't helped at all :sad:
 
I currently have a City that use to produce Barley in its center plot but now it produces nothing but Food. Apparently there is a possible bug in the Code I changed a few pushes back. And yes, when you mouse over the Plot Help it shows 6 Food and 1 Hammer being produced. You could start by checking my code I added. I added code so that when you Discover a new Yield it will not change the Center Plot Yields, and also so that Natives could produce more than one Yield form the center.
 
It doesn't look like that change broke anything because the code was already pretty broken. However the code in question is obsolete because the new center plot code takes care of the very same issue. As a result the problem was solved by simply deleting all the code.

There is a new problem though. The center plot produces a hammer and it is now one of the two yield picks. Because it is only a single hammer, the AI will not use it. I'm going to change my code to select between cargo yields and then it auto selects all virtual yields. I will try to figure out a way to easily re-enable selectable virtual yields as I kind of like that concept. We just need to balance it correctly and teach the AI that it really want to produce hammers.
 
It doesn't look like that change broke anything because the code was already pretty broken. However the code in question is obsolete because the new center plot code takes care of the very same issue. As a result the problem was solved by simply deleting all the code.

There is a new problem though. The center plot produces a hammer and it is now one of the two yield picks. Because it is only a single hammer, the AI will not use it. I'm going to change my code to select between cargo yields and then it auto selects all virtual yields. I will try to figure out a way to easily re-enable selectable virtual yields as I kind of like that concept. We just need to balance it correctly and teach the AI that it really want to produce hammers.

Ok, sounds like a good plan.:goodjob:
 
I actually had something else to say, I've been play testing a bit, having fun too. Like Lib mentioned in a pervious post I haven't been using the new Plotgroup Market feature either. The issue is 3 fold, first that Market Buildings autosell overstocked yields (just like warehouse expansion), so there isn't an immediate reason to use it there. Also, stock piling say Furs is basically money in the bank as you can always at any time load them up and sell a whole bunch all at once. Plus, we have the AI Traders who can sell them for you pretty quick. So, perhaps we need to rethink the functionality of this and perhaps give it another benefit.

Currently I changed the output of Trading Stalls to Trade Goods, which sounded pretty neat and realistic sense no other profession produces Trade Goods. At the moment however there is no input so it is just free money at the cost of two food per turn to feed the Trader, which before he was producing Gold.

Anyway, I had this idea where the Trading Stalls, Markets, Guilds could be used for Yield Exchanges. So if you are producing tons of Barley but would rather have Food you could click the Trading Stall and actually setup the Input and Output manually, in this instance the Input would be Barley and the Output would be Food. There would need to be a special code set up that determines what Yields can be exchanged this way so that you are not exchanging Barley for Weapons on a one for one bases. First you would select what Yield that you currently have in your town that you want to use for an Input, the system will check for available yields that have a comparable price. Say you can input 3 Barley, the system will check the sell price of 3 Barley and only allow Yields that are within the price range. So, 3 Barley could produce 2 Spice on the Market Exchange. Your better Traders will be able to get better deals at this as well, and also Input 6 Barley each turn, allowing for a better exchange.

Anyway, as I mentioned with all the current features I just don't see Plotgroup Markets being all that big of a deal. Of course there could be drastic changes made like better prices on Plotgroup markets and such, but that would take away from what people love about the current Col Trade system. Any Ideas on this or comments?
 
Top Bottom