1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

The Medieval Economy

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Sep 15, 2013.

  1. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,776
    That's a good point. For situations where you want to set a maximum for a buildingclass, I'd say its best to use maximums on an x-per-civ basis rather than x-per-plotgroup to avoid that. Civ4Bts buildingclassinfos.xml has
    <iMaxGlobalInstances>
    <iMaxTeamInstances>
    <iMaxPlayerInstances>
    for National and World Wonders respectively, I don't see that in the Col version but IIRC RaR did have World Wonders. Are these still present in the code or would be possible to reactivate?

    edit: After thinking further, it could still be possible to have buildings depend on local resource access if you have each building actually "absorb" or use x units of a Bonus from the local plotgroup, and trigger some consequence if there is a negative net amount in the plotgroup (number of that bonus supplied minus number used).

    E.g. say a factory consumes 1 electricity and a powerplant generates 5, their "freebonusresources" xml values would be -1 and 5 respectively. If a given plotgroup contains 6 factories and 1 powerplant, the sum at end of turn would be -1, triggering a consequence (to penalize players who tried to "game the system" or got supplies disconnected by blockades etc.)

    Possible consequences could be:
    * charges a penalty of x units of gold (or Crosses, or Fealty, etc) times the number of undersupplied bonuses; representing increased maintenance costs & supply chain disruption
    * creates a percent chance that one of the undersupplied buildings in the plotgroup gets destroyed due to lack of maintenance

    (I was also thinking about inactivating a building's functions if it lacks needed access, but buildings can have so many functions this would be horrible to code. And it would be arbitrary to pick which of the plotgroup buildings was the "unsupplied" one.)
     
  2. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,707
    Location:
    UK
    Talking about Soldiers, there are already benefits to having a standing army..

    1: They don't cost food (so you they are not a burden on your cities)

    2: A standing army gains training (this is a bit like all peasants being required to train as a bowmen once a week in english law)

    Perhaps we could look at some other benefits/negatives of army, like costing money to build them (but this is already represened through equipment..) or promotions/experince for garrison duties at watchtowers, etc. or the ability to become a 'veteran', through fighting or regular duty. That way a standing/trained army would fight better than a peasant/levy force.

    As for supplies, 'supplie chains' didn't really exist, the army would have a wagon train of supplies, and then they would take anything else they needed from enemy lands and holdings along the way. Armies would usually be held together by the promise of looting. This was often more important than pay, as they were given leave to take whatever they could get their hands on. If you didn't provide an army with regular looting oppurtunities, as well as a war chest to dish out gold when things got rough.. you would lose your army to desertion.

    Perhaps soldiers on the march could consume food from wagons in a stack(like people in a city), and if you run out of food, they become 'under supplied' and lose strength, forcing you to send another food wagon, or capture an enemy town.
     
  3. Don Senglar

    Don Senglar Chieftain

    Joined:
    Nov 8, 2010
    Messages:
    76
    I don't like the "free army" as well.

    To my opinion one of variant could be following:
    - if each military unit has own salary equal X coins/turn,
    - if each military unit required 2 food/turn.

    This food is free-of-payment if nearest city has no domestic market.
    If domestic market exists, then military unit can buy food and other goods on this market but mot more than X coins per turn.
     
  4. Trade Winds

    Trade Winds Warlord

    Joined:
    Nov 21, 2013
    Messages:
    235
    That’s right, when I discovered your M:C, I really noticed the great possibilities that talented people could do here, and I began to dream. I don’t know if I will once become such a modder, but for time being playing your mods is extremely indulging.

    I understand it now and I think plotgroups are great for supplying all marketplaces with small amounts of resources.
    Regarding the exploit of detaching an upgraded city from a plotgroup to be able to upgrade a different city, I remember that in Civ buildings detached from trade routes would stop benefiting from bonuses. So here, big cities will always need let say 3 smaller cities for bonuses, and if there are two big cities in the plotgroup only one will get the bonuses until 6 new small cities are created. But I don’t know if this can work in the code.

    I completely agree with that. It will greatly enhance gameplaying.
    That leads to two different approaches. First of all having military costs. From my little code understanding, I think work must be done into professions and not units. For example, experience points affect only to soldiers to provide them with promotions, so there must be a variable or a counter somewhere that stores experience points into a unit UNTIL that unit is given the military profession and actually makes use of the experience points and promotions. At that stage, it will also start to cost money.

    Then we have the food supply concept. Units should continue to consume food or resources even outside cities. It is not real to blockade a city with soldiers and ships forever. No food could mean extra costs or taking damage little by little. DOANE had the munitions supply system. And that could be extended to explorers, M:C got a point here because explorers can store some provisions or even live on hunting. Units can get food from warehouses if they are outside cities of from peddlers or supply wagons if they are on map tiles.

    What I don't know is how the AI will deal with all this.
     
  5. Don Senglar

    Don Senglar Chieftain

    Joined:
    Nov 8, 2010
    Messages:
    76
    Food outside the city and the munitions supply systems should be available ONLY for human players but not for AI.

    AI is very stupid in many simpliest situations and I'm sure AI will never get 100% perfect strategic planning.

    Thus, much better to leave AI "as is" without food supply system outside the city and with unlimited munitions. And program both supply systems only for human player. At least fun in the game must have HUMAN but not AI player!
     
  6. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    Part of the reason for that law is that it takes two years to build up the strength to pull the string on a Welsh (English) longbow. If you just lost most of your army in battle, then waiting two years to get new bowmen would be an awful long time. Because it's a question of strength and not experience alone the training can't be rushed.

    There is a theory that the success of the musket is that it takes 3 months to train a peasant to use it, which is so much shorter than 2 years that it is acceptable even though the longbow was actually a better weapon at that time. Another theory is that longbows were made of yew and yew grows extremely slowly. England nearly ran out of yew due to bow production.

    An interesting twist on bow production is that the asians figured out how to use bamboo to make bows. Bamboo isn't the best suited and they had to mix it with wood from a certain tree. The result is a bow, which doesn't have the range, accuracy nor power like the European ones, but there are no shortage of building materials.

    You have the most important part for modding, which is a vision/dream of what you would like. You are welcome to start modding if you want. The technical skill level needed isn't equally high for all tasks. In fact the simplest outstanding task right now is fill in text in the pedia. There is no need for programming skills for such tasks. There is also the ever important task of modifying unit production etc for better game balance.

    Once plotgrgoups are complete, the improvement XML needs to be extended to tell which improvements can harvest which bonus resources for the plotgroup it is in.

    There are a lot of tasks, which needs little or no coding experience. What is needed is the willpower and manpower. Maybe they aren't making the most groundbreaking new features, but it is still important and have to be done by somebody. If that somebody isn't me, then I will be free to code new stuff in the DLL.

    In fact bringing up this topic of teamwork I feel kind of like it is a single player game to develop at the moment. Kailric hasn't committed since August (with one Christmas commit as the exception) and since his last August commit I committed 83 times (+5 local ones for plotgroups). I know Kailric has been busy and that's ok. However it doesn't change the point that effectively there is only one person working on the mod right now and that there is a limit to what a single person can do, skills or no skills :help:

    I have been thinking of that as well. However how should it work? Turning off a building isn't that hard, but then we would need to turn off all the buildings, which has the now off building as requirement.

    Say we have an administration building, which allows us to build a sawmill with room for 3 workers. The administration building is then turned off, which turns off the sawmill. The city should then go back to the carpenter shop (2 workers) it had before the sawmill, but the sawmill replaced the carpenter shop and now the city is left without workspace for carpenters.

    I think it is the solution to turn off buildings, but we need to figure out how to not completely break a city by doing that.
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Ha, didn't think I would notice this comment did you:) I am doing the best I can at the moment. Besides, I think with what work I put into the mod prior to the recent help, you all have a lot of catching up to do:) I have been working on the trade routes when I can. I hope to have something ready to commit by middle of next week.
     
  8. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,707
    Location:
    UK
  9. Trade Winds

    Trade Winds Warlord

    Joined:
    Nov 21, 2013
    Messages:
    235
    If I am given easy instructions, I think I could handle some XML to help you moding.

    It only occurs to me that to deal with turned off buildings we could reintroduce the concept of maintenance costs for buildings and a demolish option. In an example situation where you have a Weaponsmith’s shop and a City Hall and you lose the right to have a City Hall, you can keep the City Hall, with all the worker’s slots, but the production levels are the same as the Village Hall; and also you can keep the Weaponsmith’s Shop but the production for citizen changes from 6 to 3 weapons for citizen as in the Weaponsmith’s House. And of course, you CAN’T construct buildings that require City Hall. So in this situation the player may decide to keep the buildings if they consider that the enemy sabotage will finish soon or demolish the Weaponsmith’s Shop because it costs extra for no extra production.

    But I imagine that this is difficult to code because now building are not straightforward city promotions, on the contrary, they are subject to many other variables and that may slow the game.
     
  10. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    Hey don't ruin my recruitment strategy :p

    Yeah there are still plenty of asserts and other bugs I haven't dealt with yet :lol:

    Seriously though you did a great job. It still doesn't change the fact that you haven't been as active lately as I would have liked to see. Also I wouldn't mind 20 active modders regardless of your activity.

    As for bugs, the only real outstanding bug you introduced is breaking multiplayer. However I blame the non-existing documentation from Firaxis for this as all mods except TAC/RaR broke it due to undocumented issues. In fact I broke RaR at one point (and fix it again later) because the exe ignores network transmission requests during doTurn(), but the command is executed locally making it look like it is transmitted from the sender's point of view. Wonderful completely undocumented feature :crazyeye:
    The sad part is that making network games work is fairly easy and trivial if people knew what to do.

    Sounds good. I look forward to it.

    I think Kailric has a better overview of what needs to be done than me. We really should write a list of "yet to be done" tasks, either on the wiki or the bug tracker.

    What comes to my mind is pedia text (presumably lowest priority) and game balance. I noticed food is possibly too easy to get. However that might be ok if we make soldiers eat food.

    Setting up building and unit yield demands (for domestic market) is also something, which should be looked into. Kailric started filling out info here and any changes should be coordinated with him. Maybe those changes should be postponed as plotgroups affects this greatly.

    Once plotgroups are done, each improvement needs a list of bonus resources it adds to the plotgroup distribution. More info on this when the DLL is ready for it.

    Plotgroup development
    Speaking of plotgroups, I figured out how to add sea bonus resources to a plotgroup. In fact it's really simple. Once you have the invention to add terrain to the plotgroup, you add coast terrain. This mean building improvements on coasts will act just like building improvement on land with road access as the plotgroup is already present.

    I think I'm nearly done making plotgroups behaving correctly for included plots. Adding/removing plots is still something I need to look at. There is a good chance it will be in working order soon :D
     
  11. Trade Winds

    Trade Winds Warlord

    Joined:
    Nov 21, 2013
    Messages:
    235
    As for the sea bonuses to be added to plotgroups, why don’t just land and sea tiles are worked on city radius in the traditional way or even sending fishing boats or harvest wagons and then the domestic supply within the plotgroup comes from any city’s warehouse and not the map tile itself?. Therefore, plotgroups distribution from warehouses can benefit from more exotic products not found in the vicinity. And we can devote map tile bonuses to something less material.
     
  12. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    My statement before was about how civ4 deals with this problem. I want to code it the same way in M:C because I'm nearly done with it.

    However I like your idea and it wouldn't be hard to implement. It would be extra resources given by the city just like buildings will be able to supply resources. Using the same access into plotgroups means it can be added without modifying plotgroups themselves, only city code. The city code wouldn't even have to be modified much to include this.

    I don't want to pick one or the other for the DLL. Instead it would be nice to have an XML on/off switch for both methods of getting bonus resources. This way XML modders can pick which bonus resources to use one system, which to use the other or if the plotgroup should ignore the bonus resource. This has to be the correct way to do it considering the goal is to make a DLL, which allows completely different mods based on XML alone.

    Technically speaking, this setup would allow a bonus resource to be harvested twice if the XML enables both system for it. I think I will add an assert in XML reading to detect this, just like there are asserts to detect multiple usage of the same tag name etc.
     
  13. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,776
    I hesitate to admit to liking much in Civ5, but one thing I did like is that maintaining a certain number of units can require a corresponding amount of their corresponding resource. E.g. maintaining 6 Tanks requires you have access to 6 Oil, rather than by accessing one Bonus you can do anything like in Civ4. (If you don't have enough I believe it triggers a happiness penalty and you can't build more of that unit until you access more resources.)

    If you want local supply lines in M:C, maybe you could let some Professions (civilian or military) within a Plotgroup absorb one unit of a Bonus, and have buildings such as Manors etc. generate 2-3 units of a Bonus "Military Supplies" which would let you raise and support some local army for free within your domain depending on local infrastructure. If a unit is unsupplied, maybe it could then have to consume surplus Food, and/or some amount of gold in wages. Another option is to have unsupplied military create some War Weariness from operating far from home, which could cause a penalty to Fealty or Crosses. As Kailric mentioned, in Civ4 various Civic choices can influence War Weariness and military maintenance which could create interesting tradeoffs of military/civilian benefits for Civics. I would think in almost all offensive campaigns you'd likely have no link to your own plotgroup no matter how hard you tried to manage supply lines, if the enemy owns the tiles you're in. (BTW one interesting Civ4 modcomp about tile control is Influence Driven War, where the outcome of battles on a tile can affect local "culture" ownership and thus push borders :king:)

    As was mentioned earlier in the thread, systems like this do have the potential to be really really bad for AI. I can just picture the AI wandering off somewhere and not understanding about supply, inadvertently starving/crippling itself. As a failsafe maybe the number of units players & AI can support for free without supply can be configurable in game difficulty settings by CivHandicapInfos.xml, so could be turned up or off for the AI if it becomes too crippling.

    In agreement with Kailric I think the current setup of arming your citizens only when needed (very rarely having a standing army sitting around during peacetime) is actually a fairly good fit for colonization (both historical colonization where part time civilian militia / Minutemen were the rule, and Medieval where peasant levies were pressed into service temporarily when needed but otherwise left to constantly work the land). However, I also agree it could be cool to have some benefits of training: perhaps letting certain military Professions gain Experience each turn they remain in a settlement with a military building, as compensation for the lost productivity from not working. All the new military Promotion options are interesting enough to make training through Experience accumulation a worthwhile goal. If some civilian promotions like Pious, Dutiful, Master Farmer etc and noble title promotions like Baron, Count etc are eventually added as discussed earlier, gaining Experience could become interesting for civilian professions too.
     
  14. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    Blasphemy :mad:

    I recall something about a civ4 mod, which introduce something like that as well. The idea is not bad and would work well if you have just one plotgroup. However say you have 3 plotgroups with 2 resources in each. That would allow 6 units, but which plotgroup to subtract from? Clearly the plotgroup they are in, but what if we build 2 units in each plotgroup and then moved all to the same. That plotgroup would then have -4 while the other two has 2 each and can continue to produce.

    Some kind of capital system like in civ4 or global bonus resource count would be needed.

    Easy solution: your plotgroup can go though enemy owned plots if you have at least one military unit standing there.

    We will figure out the AI behavior for this later. I might have a few ideas, but nothing worth looking into until we have working code for human players. A limit of X units for each city is one option. Another is a percentage of total population. There are plenty of options.

    I still haven't forgotten about the journeyman modcomp. Sure my implementation work stalled, but I will work on it again eventually. I think I need a better implementation plan and will start over eventually based on the experience of the first attempt. Next time I will focus on subgoals like I'm doing with plotgroups. I assume the first step is to just gain experience and make a good storage system for that and not care for threshold for level gaining or production bonus or anything else until the fundamentals are working.

    Oh and I need to finish what I'm doing now before starting the next thing ;)
     
  15. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    A little update: I made a branch for plotgroups and pushed it to github. I figure it will break savegames possibly multiple times and it would be better to have a branch, which can break savegames without warning and then only do it once in the master branch (when merging). It also mean that everybody will have access to testing it before the merge.

    No test is needed yet as there is still no ingame changes. It needs something as fundamentally as starting a new plotgroup and let it spread. Also savegames have been ignored so far.
     
  16. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,776
    Maybe the plotgroup supply lines could just mean that only Units/Professions that aren't connected to resources they need would incur maintenance costs (ie unsupplied units can cost some food/gold in maintenance as you were planning).

    If you have 2 Manors in the local plotgroup producing a total of 6 Military Supply, and Profession Archer consumes -1 Military Supply each; then the first 6 Archers connected to that plotgroup don't add anything to food/gold maintenance costs.

    When some units/professions need a supply and can't access it, then the total number of unsupplied units could cost some food per unit (and/or gold or War Weariness) per turn, which would create costs for military campaigns that could be somewhat mitigated by attention to supply line strategy and infrastructure.

    I'm still not totally convinced whether systems for supply lines and food maintenance would necessarily be worth adding though, it sounds complicated to implement with potential AI and performance issues, and there are plenty of other features as you say.

    Sounds interesting, but could you describe this more I'm not sure I get the gist?

    Since buildings can give free resources too, it could be good if the resource types supplied through plotgroups don't necessarily need a 1-to-1 relationship with map tile bonuses themselves. There would be some resources (like Electricity or Military Supply produced by Buildings) which have nothing to do with a Bonus tile on the map; and some Bonuses on the map that don't supply a resource to plotgroups.

    To reduce confusion, maybe we could refer to things supplied through plotgroups as Resources like RESOURCE_ELECTRICITY or RESOURCE_MILITARY_SUPPLY to distinguish them from individual map Bonus tile types. By modifying <BonusTypeStruct> in improvementinfos , improved map Bonus tiles could supply a Resource type, or not.
     
  17. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    There will be two ways to harvest a bonus resource from the map (assuming we implement it according to this idea)

    The plot is assumed to have a bonus resource.

    Method 1:
    The plot is owned by the player, is covered by the plotgroup and has the needed improvement to harvest the bonus resource.

    Each improvement has a list of bonus resources it can harvest. Multiple improvements might be able to harvest the same resource, which is ok as only one of them exist in a plot at a time.

    Method 2:
    A city has a citizen working a plot. The city will add this resource to the combined resources from the city to the plotgroup (together with building output). The worked plot will not have to be part of a plotgroup.

    Which bonus resources can be harvested like this is set in bonus resource XML as an on/off switch (bool).


    The potential bug is that a plot can end up in both methods and as such be added twice to the plotgroup. I'm thinking of adding an assert if the XML allows the same resource to be harvested using both methods.
     
  18. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,283
    Gender:
    Male
    Location:
    Stuttgart, Germany
    Just out of interest:

    Why do you need "harvesting of bonus resources" as currently discussed ? :confused:

    Civ4 needed to handle things like that, because it did not have as many yields as Civ4Col does.
    But well, you are modding Civ4Col and I really like the Civ4Col approach with yields much much better, than the one from Civ4 with resources.

    So why not simply use the existing system of yields being produced (by professions) and recquired to build or equip ?
    It would probably be much much easier to code, than what you are discussing at the moment.

    Coal, Electricity, ... everything could be handled as yields. (Goods or abstract.)

    You can implement yields as local goods stored within a city or civilization wide.
    Both works just fine.

    It is also most likely much less risky for AI.

    AI does not have some yields it really needs:
    -> Tell it to focus on its production or acquire it through trade system or buying.
    -> If necessary code some logic that converts some other yield into it.
    -> If that is not enough code some AI cheat, that gives AI a little bit of that yield for free from time to time.
     
  19. raystuttgart

    raystuttgart Civ4Col Modder

    Joined:
    Jan 24, 2011
    Messages:
    5,283
    Gender:
    Male
    Location:
    Stuttgart, Germany
    RaR has "National Wonders" but no "World Wonders".
    (I did not have enough good use cases for "World Wonders".)

    The code for that is not present in Vanilla.
    I recoded that feature.

    Such things are actually pretty simple to code for an experienced Civ4Col modder.
     
  20. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    I have been thinking on how to deal with buildings "consuming" bonus resources and started wondering if it really would be the correct approach even before ray posted this. The problem is that things could go really wrong when you have around 0 bonus resources and I'm starting to become unsure if it can be made bug free.

    I think we should go back to basics and ask what we originally wanted to use plotgroups for:
    • Group connected cities:
      Domestic sales should be combined for all connected cities
    • find out if cities are connected by road:
      Automated transports can use this. Possibly the AI at some point as well.
    • Count of your bonus resources:
      Each city will be aware of how many bonus resources it has access to of each type and act accordingly.
    • Free bonus resources from cities:
      Certain buildings (wonders?) can affect all cities it is connected to.
    We should be able to do this fairly bug free. The bonus resources it then keeps track of would be something, which has influence on the cities connected, like monasteries count holy places they are connected to and give bonus to something multiplied by that number.

    This could actually be done fairly easy if you get the right idea. First we make a yield group for "shared in plotgroup" called YieldGroupShared (or whatever). Then get and set stored yield functions in the city checks if the yield is in YieldGroupShared. If it is, it accesses the data in the plotgroup, else it accesses the data in the city. We then have the ability to produce in one city and consume in another without transporting the yield. I think this is only valid for virtual yields.

    The question is what to do about storage? If we are talking about electricity, then we can't produce 9 for 10 turns and then consume 90 in one turn. This is the problem, which made me wonder if yields should be avoided.

    The only storage solution I can think of is to give buildings storage capacity for specific yields (I think they have already) and then during doTurn() the plotgroups adds up the capacity from each city. Once all cities are complete, the player will loop all his plotgroups and any yield where stored exceeds capacity will be set to store the capacity. The excess is then lost. If XML is set correctly, this should give a buffer big enough for this to work with unmodified yield code, but small enough not to stockpile the yields.

    Alternatively the storage capacity could be the same as total production that turn while ignoring the buildings consuming the yield. However if I remember correctly we get the change, not the total produced and consumed in doYields(). Hooking into getting the right number without spending too much CPU time might be tricky. At least it should be investigated.

    If we add electricity as a yield, then there is a chance the AI can figure out how to use it. It will not be able to coordinate between cities, but with a bit of luck it can exploit it anyway as it will go "I'm not producing this, but I have it stored anyway. I will produce this for a few turns until I'm out of stock.". The tricky part is to make it produce electricity while not producing way more than it needs. I don't think we can make it do that in even a semi human way. The AI is stupid anyway. Maybe it will not really make a difference if the coordination sucks :lol:
     

Share This Page