Results 1 to 1 of 1

Thread: Basic Systems and Internal Structure

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Basic Systems and Internal Structure

    This thread is for the development of the underlying systems to govern how we approach the facets of AUH. It will be moved into the public once I've gotten all of my notes into a more comprehensible format and refined it some.

    -----------------------------------------------------------

    The Three Pillars

    ||Military|| ||Socio-Economic|| ||Cultural||

    The three pillars symbolize the main aspects of the makeup of a faction. Each aspect governs wide ranging sub-divisions, and just about any consideration can be classified under one of the three headers primarily. These pillars play a key role in AUH, taking the emphasis off city-by-city generic developmental cycles with city specializations which leave the wrong impression of medieval administration and warfare, and put the emphasis on factional differences and foci that trickle down to city specializations. This gives increased character to every faction, because no faction has the same strengths and weaknesses as any other faction, increasing the unique play experiences from the top down.

    Every faction in AUH 'specializes' inherently in one of the three pillars. This specialization is a representation both of the values held by the cultures that comprise the faction constituents, the history of the faction and cornerstones of its civilization, and the necessity of the approach the faction needs to take to carve a place in history for itself in the turbulent times to come. In addition to this inherent preference, a system of administrative policy enables the player to choose the direction she wants to bring her nation towards, independent of the tendencies present but also complementary to them. The differences from nation to nation start with this sweeping classification and continue as each aspect of these pillars retains differences in approach from faction to faction.

    For instance, when considering the Military, every faction has a rating between 1 and 10 to denote their emphasis and prowess in each of the three main fields of infantry, cavalry, and artillery. The sum of the 3 ratings is 15 'points', distributed based on that factions portfolio. A nation which has a military specialization however has 20 'points' distributed, making them 33% more proficient in terms of the military than a faction who specializes in Cultural or Socio-Economic pillars. Naturally this is not the only benefit of a Military specialization, just as it isn't a one way street and factions focused on the other two pillars gain distinct advantages in their area of focus.

    Military

    • Army
      • Infantry
      • Cavalry
      • Artillery
      • Militia
      • Mercenaries
    • Navy
      • Fleet
    • Institutions
      • Headquarters
      • Admirality
      • Officer Academics
      • Specialized Schools
    • Defense
      • City Defenses
      • Conscription
      • Espionage
    • Doctrine



    Socio-Economical
    • Trade
      • Resources
      • Trade Agreements
      • Merchants
      • Trade Routes
    • Production
    • Tax
    • Regulations
    • Policies


    Cultural
    • Culture
    • Religion
    • Science
    • Art
    • Happiness
    • Policies


    ------------------------------------------------------

    Economics Package

    Spoiler Alert, click show to read: 

    The economic model is the architecture by which we want the code to implement. It comprises the theory by which the organic economy should operate on. The scripting will be done to implement this framework in a coherent and extensible manner.

    The foundation for the economic model is geographical oriented. Every region has geographical factors (access to sea, mines, farmland, trade routes, etc.) that effects the potential within a settlement. That is to say, not every city has the requisite to become a burgeoning economic metropolis. Geographical potential is measured from a level of 0 to 16 and is dependent on the following factors:

    1. Water Access
    2. Land Access
    3. Natural Resources
    4. Agriculture
    Each area except for Governor has 4 possible states.

    Water access:

    1. No Water
    2. River
    3. Minor Sea
    4. Major Sea/Ocean
    Land Access:

    1. Difficult to traverse region
    2. Accessible region
    3. Region is situated in a minor trade route
    4. Region is situated in a major trade route
    Natural Resource:

    1. No natural resource
    2. One regular resource
    3. One premium (or multiple regular) resource
    4. Multiple premium resources
    Agriculture:

    1. Non-sustainable land (Desert, Frozen Wastes)
    2. Some sustainable land (Tundra, Mountains,
    3. Sustainable land (Steppes,
    4. Optimal land (River Delta, Plains)
    Potential is filled by the development of those areas and an additional three factors which effect the potential with geometric growth:

    1. Trading Partners
    2. Population
    3. Governor's management traits
    Trading Partners: - Has been coded - now its just a matter of checking the counter whenever we need

    1. No trading partners
    2. One trading partners
    3. Four trading partners
    4. Ten trading partners
    Population size:

    1. Large Town
    2. City
    3. Large City
    4. Huge City
    Governor is an entirely separate function that helps attain maximum potential but in a very different methodology.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    Psuedocode extended - Governors not included at the moment.
    I am writing this as my vision of how this works so I can start coding a few settlements.

    There will be X levels of Economic Potential. Each level will be assigned a value that is stored in a counter.

    Level 1 1000
    Level 2 2000
    Level 3 3000
    Level 4 4000
    Level 5 5000
    Level 6 6000
    Level 7 7000
    Level 8 8000
    Level 9 9000

    Each level will then set an event_counter to enable various bonuses stored in export_descr_buildings.txt. This way a Smith in a Huge City will produce exponentially more income than a Smith in a Village. Every single building in the EDB file will have all potential levels listed in their capability section, with various bonuses that each building can give.

    Economic Potential can be increased by adding government buildings and increasing settlement size. Some cities will not be able to reach full potential because they lack enough land/water/naturaul resources. So the cap for London might be level 6 but the cap for Constantinople might be level 10.

    New global_counters:
    bonus_level - checked at SettlementTurnEnd

    Settlement level counters, note that I am adding a few for each settlment. Originally there were 2.

    settlement_economy - Increasing this will increase the chances of new merchants
    settlement_crime - Increases the chances of criminal activity - more ideas/work needed here.
    settlement_potential - The cap based on values above
    settlement_actual - The stored value of all economic buildings in a settlement. (Note to self) DO NOT COUNT crime buildings.
    settlement_market - Raw number of economic that exist - caps determined by market level.

    settlement_enable_construction - An event counter that is either true/false

    Other possible counters:
    settlement_number_MerchantName - The max number of a certain kind of merchant. We will terminate_monitor on any building tree that hits the max. Default is 1. These numbers can go up based on settlment_potential or other conditions.

    Each region is assigned a value based upon local resources present at game start. Values to be determined. Probably somewhere between 0 and 100. This sets the base level for Economic Potential. Then add in the value for the buildings that exist at game start to get the total Economic Potential for each settlement.

    So all settlements will be set at game start based upon manually calculated numbers:
    Code:
    monitor_event PreFactionTurnStart FactionIsLocal
     set_counter  london_potential 1
     set_counter paris_potential 2
     ;etc etc one for each city
     set_counter london_market; - set the initial market cap for each settlement based on market level
     terminate_monitor ;once this is set no need to reference it again, kill the monitor
    end_monitor


    Then there will be a bunch of monitors that check the status of each settlement for stuff such as tax_rate and governor_traits. At each SettlementTurnEnd these factors will add up in settlement_economy and settlement_crime, which will get reset at each SlaveTurnEnd to 0. This will allow factors to change but will require that it is calculated each turn. Its possible we could combine these into a single counter if we do random percents correctly but for now we will leave two.

    Note that for this to work it HAS to progress in the order outlined below. Doing things out of order will cause problem.

    Check tax_rate first. 5 monitors but only 1 can be true:
    Code:
    monitor_event SettlementTurnEnd SettlementName London
     and taxes = high
     set_counter london_crime XXX
     set_counter london_economy XXX
    end_monitor
    monitor_event SettlementTurnEnd SettlementName London
     and taxes = low
     set_counter london_crime YYY
     set_counter london_economy YYY
    end_monitor
    monitor_event SettlementTurnEnd SettlementName London
     and taxes = normal
     set_counter london_crime ZZZ
     set_counter london_economy ZZZ
    end_monitor

    After that check if a Governor is in the settlement. Note that we INCREMENT these values not SET.
    Code:
    monitor_event SettlementTurnEnd SettlementName London
     and GovernorInResidence
     inc_counter london_crime -AAA ;decrease chance for crime
     inc_counter london_economy BBB ;increase chance for business
    end_monitor
    monitor_event SettlementTurnEnd SettlementName London
     and not GovernorInResidence
     inc_counter london_crime AAA ;increase chance for crime
     inc_counter london_economy -BBB ;decrease chance for business
    end_monitor

    Then we compare the settlement_market, settlement_actual and settlement_potential and get a true/false to allow new buildings. If actual > potential then deny new economic buildings. New crime buildings still allowed.


    One monitor for each level of market: (NOTE TO SELF) Set all these to a default value at PreFactionTurnStart FactionIsLocal, either true or false just pick one. To be determined, shortest code wins, go from lowest level to higehst to prevent multiple conditions being true. Probably should be set to true for error catching purposes.
    Code:
    monitor_event SettlementTurnEnd SettlementName london
     and SettlementBuildingExists MarketName1
     and I_CompareCounter london_market => X
      set_event_counter settlement_enable_construction 0 ;disable or disable construction by script or by player
    end_monitor
    Once we have determined whether or not to allow buildings, then check the cap.
    Code:
    monitor_event SettlementTurnEnd SettlementName london
     if I_EventCounter settlement_enable_construction == 1 ; if construction is enabled then check caps, if disabled no need to do anything.
      if I_CompareCounter london_potential == 1 ;potential is between 1000 and 2000
       and I_CompareCounter london_actual => 2000 ;disable new buildings
       set_event_counter settlement_enable_construction 0
      end_if
     
      if I_CompareCounter london_potential == 2 ;potential is between 2000 and 3000
       and I_CompareCounter london_actual => 3000 ;disable new buildings
       set_event_counter settlement_enable_construction 0
      end_if 
     
      ;need one condition for each level of potential
     
     end_if
    end_monitor


    Now we have determined whether or not new buildings will be allowed. We can then check for new buildings to be created via script. This can all be done inside one big monitor with nested IF statements. The same for crime buildings but we can add those later after we nail this process down.
    Code:
    monitor_event SettlementTurnEnd SettlementName london
     and I_EventCounter london_enable_construction == 1
     
     if I_CompareCounter london_ecnonomy > x ;is economic value between two numbers?
      and I_CompareCounter london_ecnonomy < y
       RandomPercent create building 1 - remember to check max_merchants first
       RandomPercent create building 2 - also remember to increase the related counters if building gets created
       RandomPercent create building 3
       RandomPercent create building 4
       RandomPercent create building 5
       RandomPercent create building 5
     end_if
     
     if I_CompareCounter london_ecnonomy > A ;is economic value between next two numbers?
      and I_CompareCounter london_ecnonomy < B
       RandomPercent create building 1 - remember to check max_merchants first
       RandomPercent create building 2
       RandomPercent create building 3
       RandomPercent create building 4
       RandomPercent create building 5
       RandomPercent create building 5
     end_if 
     
     ;set several levels of economic value so we can have several different RandomPercent values
     
     
     ;at the end of this monitor set our bonus_level based on settlement_actual
     if settlement_actual > A and below B then set_counter bonus_level 1
     if settlement_actual > B and below C then set_counter bonus_level 2
    end_monitor


    Now all of our buildings for this turn have been created, either by script or by the player. We can add a SettlementSelected monitor and allow/disallow certain buildings for the player with the same settlement_enable_construction counter. Also note that some of these probably should be done at SettlementTurnStart rather than SettlementTurnEnd. I will figure out the best method once I get into seriously coding settlements.


    Now we need to figure out our bonus levels. The settlement_potential sets the base for our bonus level, but we need to move it up or down depending on our region status: drought, severe_drought, recession_severe recession etc.
    Code:
    monitor_event SettlementTurnEnd SettlementNameLondon ;check status for region_weather_status and region_economy_status
     if I_EventCounter britain_weather_status 1 ;severe_drought
      lower bonus_level
     end_if
     
     if I_EventCounter britain_weather_status 2 ;drought
      lower bonus_level
     end_if
     
     if I_EventCounter britain_weather_status 3 ;normal
      do nothing bonus is flat
     end_if
     
     if I_EventCounter britain_weather_status 4 ;good_harvest
      raise bonus_level
     end_if
     
     if I_EventCounter britain_weather_status 6 ;great_harvest
      raise bonus_level
     end_if
     
     ;do the same for region_economy_status
    end_monitor
    Note that we could also throw in some conditions that raise/lower bonuses on a faction wide basis and then check those values here before we move on to the next step.

    Then compare bonus_level and set the actual bonus to be read by the EBD.
    Code:
    monitor_event SettlementTurnEnd SettlementName london
     if I_CompareCounter bonus_level == 1
      set_event_counter bonus_level_1 1
      set_event_counter bonus_level_2 0
      set_event_counter bonus_level_3 0
      set_event_counter bonus_level_4 0
      set_event_counter bonus_level_5 0
      set_event_counter bonus_level_6 0
      set_event_counter bonus_level_7 0
      set_event_counter bonus_level_8 0
      set_event_counter bonus_level_9 0
      set_event_counter bonus_level_10 0
     end_if
     
     if I_CompareCounter bonus_level == 2
      set_event_counter bonus_level_1 0
      set_event_counter bonus_level_2 1
      set_event_counter bonus_level_3 0
      set_event_counter bonus_level_4 0
      set_event_counter bonus_level_5 0
      set_event_counter bonus_level_6 0
      set_event_counter bonus_level_7 0
      set_event_counter bonus_level_8 0
      set_event_counter bonus_level_9 0
      set_event_counter bonus_level_10 0
     end_if
     
     ;note you have to set each one EVERY single time or bonuses will stack up
     ;do this for each bonus_level
    end_monitor

    At this point we end the settlement processing for this settlement. What we need to do now is start plugging in numbers for the regional status and coming up with values for each building as we create the new trees. We can add as many bonus levels as we want, I havent ran into a cap on those yet.

    This is FAR from a finished outline, but I wanted to get some process down in writing so I have a good base to work from.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    As discussed via PM, each region will have a unique status set at slave TurnEnd. There are 11 regions.

    british isles
    spanish peninsula
    africa
    america
    middle east
    italy
    russia
    turkey
    romania - includes greece
    eastern europe
    western europe


    For weather/farming I suggest 5 options: normal, drought, severe_drought, good_harvest, great_harvest

    For income/economy I suggest 5 options: normal, recession, severe_recession, expansion, boom

    I will set them all completely at random at game start. After that we need to decide how to move between levels. If we do it randomly we could have a severe_drought one turn and a great_harvest the next, which while remotely possible might not be exaclty the way we want to do it.

    I suggest we either go up one level, go down one level, or stay the same.

    ~~~~~~~~~~~~~~~~~~

    I definitely agree with go up/go down or stay the same and I think it should be increasingly rare to go very high or go very low. So huge droughts and abundant harvests should be the most rare scenarios with normal being the most common. Bell curve style.

    ~~~~~~~~~~~~~~~~~~

    I set up a quick version of this, but it needs to be tweaked a bit. The region status is set randomly at the beginning of the game, 60% chance of normal 10% chance for everything else. It works but as you say severe_drought shouldnt have as good a chance as drought. Just the initial monitor alone is 665 lines of code but I might be able to trim that a bit.


    How about this for initial setup?

    1. 5% severe_drought
    2. 15% drought
    3. 60% normal
    4. 15% good_harvest
    5. 5% great_harvest

    1. 5% severe_recession
    2. 15% recession
    3. 60% normal
    4. 15% expansion
    5. 5% boom

    Then after that everything should normalize towards center.

    If normal (3) then 70% chance remaining normal 15% chance of going up/down.

    If 2 or 4 then 70% chance of moving towards center, 20% stay the same, 10% move to extreme levels.

    If 1 or 5 then 10% chance of staying the same, 90% chance of moving towards center.

    ~~~~~~~~~~~~~~~~~~~~

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    I think our merchants should extend from the resources. We can ignore merchants like cobblers and such that do not come from resources because they would be present in nearly city and generate little income. We can always add them later if we have room. I have broken up resources into the following categories and italicized premium resources (values are default but I think we will eventually adjust them heavily). I'll add a list from this of the various guilds/craftsman that would appear. For example, Timber + coastal access = Shipwright.

    Land Resources
    coal 4
    gold 20
    iron 9
    marble 10
    silver 12
    sulfur 5
    tin 6
    spices 12
    furs 3
    ivory 12
    slaves 8

    Agricultural Resources
    cotton 8
    grain 5
    silk 12
    timber 6
    tobacco 15
    wine 8
    wool 6
    textiles 8
    sugar 10
    chocolate 15
    spices 12

    Water Resources
    amber 12
    fish 5
    dyes 8

    ~~~~~~~~~~~~~~~~~~~~~~~

    What about something to do with Coin minting? In RS, I've branched mines for public and private ownership (for different bonuses) and smiths branch into weapons or gold smithing/coin minting. (We've only got 64 building trees, so I have to combine trees I'd rather have separate)

    Are these industries going to be tied to specific regional resources? I think it could add more of a strategic element to the strat map. Regions that were historically rich will be able to build more industries due to the presence of more resources. We have a 'capital' type resource in the major cities where any industry can be built, but you make more money off an industry if you don't have to import the raw materials. In RS, I have weapon upgrades tied to the quality of metal in the region. I realize iron/copper/bronze was often imported and exported, but I felt the additional strategic element was too valuable to pass up. I believe some cannons were made from bronze during this period, this can be simulated with copper+tin.

    Other things might be a construction guild (improve build times of buildings, maybe increase levy troops) as it requird a lot of organized labor to build massive public works. I believe that was how armies first formed, levying the harvesters in the fields, but I don't know if they fit in this era or not.

    One thing I do for the RS industry is allow a certain number of 'slots' for industry buildings. Every 'upgrade' for a city allows another slot. We have 8 types of industry, with only 5 able to be built in any particular city (as long as they have the resources) YOu may want more in your era (as you have more buildings to use) but it's something to consider. Make it so each city isn't built identical to the next one! It's how it happened in real life, we should be able to get that in game.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Hidden_resources hardcode maximum 64
    16 Default hidden_resources
    11 set aside for regions

    Normal Resources
    Grain extends Brewer, Baker
    Cotton extends Haberdasher, Draper, Milliner
    Wool extends Haberdasher, Draper, Milliner, Wool-merchant, Stockyard
    Textiles extends Mercer, Tailor
    Fish extends Fishmonger
    Gold extends Goldsmith, Mint
    Furs extends Skinner
    Spices extends Grocer
    Wine extends Vintner
    Sulfur extends Gunsmith (late era)
    Charcoal extends Gunsmith (late era)
    Iron extends Armorsmith
    Marble extends Mason

    Hidden Resources
    Honey extends Brewer, Grocer

    We have 9 levels per tree so for reasons of necessity, some things will have to be tied together. Like a gold Mines might extend into Goldsmith and then into Mints.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~

    A couple other issues I'm trying to resolve in RS:

    1. City Growth vs. Number of buildings

    My only experience with MTW2 is the SS mod for kingdoms, so keep this in mind. A notice the growth is better, but frequently there is little reason to construct buildings commonly found in cities, such as schools. I think an educated labor force should unlock higher tier industrial buildings. Furthermore, in RTW at least, cities get to the highest level fairly quickly, with most of the buildings unnecessary for this expansion. The AI as well, rarely builds most building because they have little effect. I mean, bonuses like

    'taxable_income_bonus bonus 10'

    or

    'trade_bonus bonus 1'

    Don't have a large impact unless there is huge trade happening in the cities. In SS, it might take me the whole game to get a profit off those trade buildings! They need to provide more tangible benefits, which is what I"m working on, and leads us to issue 2...

    2. Uniqueness of cities

    In Every RTW mod, EVERY CITY IS THE SAME. I build the best temple, best farms and health for the population, and I'm done. Cities like Carthage, Rome, and Byzantium should be huge centers of commerce, and yet rarely (unless they have a huge bonus at the beginning) reach a level of prospertity over their neighbors. With a larger amount of buildings available, it will force the player to (hopefully...) specialize between military and economic concerns. It might also be interesting if base resources, even without industry, provided small bonuses (areas with grain may farm better, amber doesn't necessarily need a whole indutry around it to generate revenue, etc.)

    The largest issue is balancing growth so cities don't expand too fast (thus not having the buildings they historically would have had), and not having too many buildings, overwhelming the player with options. I see no reason to quantify every type of industry available, especially for every city. Can we assume every province has some sort of blacksmithy available? I like to think the buildings as areas of specialization, as well as government intervention. However, without knowing the philosophy this modifcation has, it's difficult to come up with more ideas.

    What do buildings represent to you guys?

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------



    Economics Package - Extensions
    Spoiler Alert, click show to read: 

    Resource Depletion

    Basically, as resources are used at a higher and higher rate, resource depletion should become a factor. So for instance, take a gold mine.

    Set goldmine counters = 100000
    If goldmine level 0 then remove 0 counters from goldmine on turn end
    If goldmine level 1 then remove 50 counters from goldmine on turn end
    If goldmine level 2 then remove 100 counters from goldmine on turn end
    If goldmine level 3 then remove 200 counters from goldmine on turn end

    If goldmine counters <50000, goldmine produces -1 production
    If goldmine counters <25000, goldmine produces -2 production
    If goldmine counters <1, goldmine produces nothing.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    Traveling Merchant Band

    Basically in the Medieval era, small towns relied primarily on the roving merchant to do most of their trading with on a semi-annual basis. This is ideal initially but as the town grows, it becomes problematic.

    Local merchants simply cannot compete with the wares and pricing of the traveling band and so they run local businesses into the ground. It's a situation analogous to the modern-day Walmart, only the Walmart lives a year after all the mom-n-pop stores close.

    So basically, we would use GED's roving building mod. When the traveling merchants arrive, they boost the economy but damage all current merchants, so small net-gain / status quo for the settlement until they leave. At which point, all the merchants need large cash infusions (repair building) until they can work again.

    Once a city gets large enough (large_city+), the roving merchants ignore it because they can no longer compete with the large domestic market.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    Banking

    I have done some work on borrowing money and repaying loans that at some point would be good to include. Basically it works like the Hire Ancillaries script, but with more conditions. I may try to polish that up a bit and release it in the near future.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    War Exhaustion

    This is obviously a Total War game so it shouldn't play as big a factor as if it were Total Management, but I think War Exhaustion is still something to think about. A nation that is constantly at war is much more likely to decline in industry if it is a prolonged war since the resources are being invested in persecuting wars and not strengthening the economy. Even minor things like arrows cost money when compounded and not reused.

    This is somewhat represented when we consider that every troop has an upkeep proportionate to the number of men in the unit thus a cost per person to maintain per year. However it doesn't factor in to our economy system, so a nation in 20 wars could still have full industry potential and be expanding despite the fact the industry is being utilized to fund the war more so than to re-circulate and improve upon itself.

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    Technology

    The normal TW system of building trees where you just keep building, or having built for you, more and more advanced versions of something seems a bit to obtuse. Realistically you needed to have the technology that would stipulate the ability to invest in those improvements. This can be represented via a research initiative to improve various functions. It could be accessed by a shortcut by defining a new shortcut in the descr_shortcut file and using the event "ShortcutTriggered" in order to pop up a series of research scrolls navigated via Accept/Decline and "StealEscKey".

    Each research initiative would cost the player each turn for X amount of turns to try and develop, and would have a % chance of failing that could be modified by a variety of factors. This new technology then enables mass production of its usage.


    Economics Package - Notes
    Spoiler Alert, click show to read: 

    Some notes and stuff I wrote a long time ago, just so everyone can get a feel for where this is going.


    set_counter york_economy
    set_counter york_crime

    at SettlementTurnEnd
    if governor is present, swap if governor not present, you can also check governor traits
    york_crime -1
    york_economy +1

    if taxes low
    increase economy counter
    reduce crime counter

    if taxes normal then no change

    if taxes high
    decrease economy
    increase crime

    if taxes very_high
    decrease economy -2
    increase crime +2

    Once economy counter hits X for each settlement level
    spawn random number, if over Y then console_command create_building xxx

    For the crime counter the buildings produced give negative bonuses and cannot be destroyed




    I started work a few weeks ago on ways to improve the economics of M2TW. The goal is to make the economy more like a real economy. In a readl economy everything fluctuates; building prices, recruitment costs, maintenance, trade, etc. Now because all of this stuff is set in the text files as a fixed cost this is no easy task, and is going to require some serious scripting and some ingenuity. Here are my thoughts:
    Lower initial recruitment costs 25-30% in the EDU. Done
    Lower initial building costs 25-30% in the EDB.
    Tweak the initial resource costs.
    Rework Merchants.
    Use the Vices and Virtues to make costs rise and fall through scripting. This is the part thats hard. There are lots of bonuses and penalties that are currently applied to traits characters can pick up, and several that are tied to buildings. The way I am thinking of handling it is through the building side because you can use the tag faction_capability to apply it to an entire faction. I would create new buildings through monitoring events on the campaign script that make costs rise and fall. The buildings wouldnt show on the battle map but thats no big deal, the goal here is the economic side not the battle side.
    Some examples:
    faction_capability
    trade_base_income_bonus bonus -1
    This would reduce trade faction wide if we had something like a famine. When the famine was over the script would remove the building and normal trade would resume.
    I am going to have to do some testing to see what works and what doesnt but thats the basic idea of how I want it to work.



    And yes thats also one of my thoughts, although on the famine you automtically get a reduction in income because of the reduction in population. The problem with events is that you can only code events to a year or a set of years, you cant actually trigger a random event. At least I havent figured out how to do it yet. I have a whole list of events and traits and stuff like that, this is going to be a major project that will be able to be included in any mod, but especially in TW: Mod Squad packages.
    A few other ideas:
    Event: Merchant fined for Unsavory Business Practices, loss of money and loss of ability
    Event: Treasury Robbed, loss of money
    Event: Tarriff Imposed by <faction>, pay fine
    Event: Swindled, bought bad trade goods from...loss of money
    Event: Sucker Every Minute, tricked buyer, increase of money, increase in chance of getting fined
    All of these require me to find a way to trigger events not based on years. Probably they wont be true events as listed in the events.txt but will be scripted with some other form of trigger.
    When city reaches certain size all recruitment costs go up x%. This is where the building traits come into play and simulates the increase in costs as the economy grows. Lots of ideas here too I just havent had time to try everything. The entire last week has been getting the website laid out.
    There is still a lot of work I have to do and a lot of testing to see what works and what doesnt, I have tested some issues and not others. This is one of the reasons I want a complete list of triggers and conditions and traits and all that stuff which I am working on as we speak.
    Like the idea of a faction being able to instate a tariff. I wonder if we can make it an option for a faction leader to instate a tariff so that the player can gain money from it. Would be kinda fun. Can we make it so if the tariff event occurs that if your merchant is in their lands you get slightly less than if you had trade rights but more than if you didn't have trade rights. This would be to simulate the fact that the opposing faction is requiring you to pay to gather those goods.

    Thats one of the thoughts, also if you move a merchant into a region you dont have trade rights with it should lower the AIs opinion of you.
    Scripting something like imposing a tarriff on another faction would probably be the last thing I tried. The only place a modder has access to for something like that is to do it through the Show Me script and its a pain in the neck to do. But another option is to trigger it with a new building that applies a tarriff to a faction under certain conditions. I havent thought about doing it that way much and the conditions list would be pretty long, depending on faction standing and all kinds of things


    This applies only to the buildings that I am creating through the campaign script. The rest of the buildings that I add/remove that are buildable by player I will post in another thread. So far I have 18 buildings added and working to the EDB. I still need to add a few images and descriptions but I wanted to let you guys know how this works first.

    For these buildings there are 3 counters in the campaign script:
    revolt
    economy
    crime
    All 3 counters start at 0 and are incremented based on conditions in the settlements. When the counter hits a certain
    number it triggers a random percent. If the random percent is over a set amount then the building is built.
    Governor in settlement
    revolt 2
    economy 5
    crime 5
    No governor in settlement:
    revolt -5
    economy -2
    crime -5
    Loyalty = happy
    revolt -2
    economy 5
    crime -5
    Loyalty = content
    revolt 1
    economy 3
    crime -3
    Loyalty Disillusioned
    revolt 5
    economy -5
    crime 5
    Loyalty Rioting
    revolt 10
    economy -10
    crime 10
    Tax = extortionate
    revolt 10
    economy -10
    crime 10
    Tax = high
    revolt 5
    economy -5
    crime 5
    Tax = normal
    revolt 2
    economy 5
    crime -3
    Tax = low
    revolt -10
    economy 10
    crime -10

    Certain buildings will also change the values of the counters:
    Meeting house or greater created
    revolt 10
    Meeting House or greater exists
    revolt 5
    Thiefs House or greater
    crime 5
    Ale Shop or greater
    Economy 5
    Clothier or greater
    Economy 5


    Here are the chances the buildings will be built and their affects. Once the new merchant buildings are created by script then the player can upgrade them.
    Thieves and Crime
    Thiefs House
    50 Points
    20% Random
    law -1
    trade -1
    Illicit Business
    100 points
    15% Random
    law -2
    trade -2
    Den of Thieves
    200 points
    10% Random
    law -3
    trade -3
    Black Market
    250 points
    5% Random
    law -4
    trade -4
    Thieves Network
    300 points
    5% Random
    law -5
    trade -5

    Revolution Buildings
    Meeting House
    50 points
    30% Random
    law -1
    happiness -1
    Secret Society
    100 points
    15% Random
    law -3
    happiness -3
    Revolution Headquarters
    200 points
    5% Random
    law -5
    happiness -5
    Underground Activity
    75 points
    15% Random
    law -1
    happiness -1
    Anarchist House
    150 points
    10% Random
    law -3
    happiness -3

    Seamstress
    Clothier
    50 points
    25% Random
    trade +1
    Upgrades buildable by player
    Dressmaker, city, trade +2
    Seamstress, large city, trade +3
    Tailoress, huge city, trade +4

    Jewelers
    Jewelry Shop
    200 points
    20% Random
    trade +2
    Upgradeable by player
    Master Jeweler, large city, trade +4

    Breweries
    Ale Shop
    100 points
    25% Random
    trade +1
    happiness +1
    Upgradeable by player
    Brewery, city, trade +2, happiness +2
    Winery, Large City, trade +4, happiness +4

    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------
    -------------------------------------------------------------------------------


    One of the things we will need to check is how many trade partners the player has. I figured out how to do this today, for the player. The other factions can be coded if needed.

    This script moves a counter up every time the player gets a new trade partner, and down every time a trade agreement is broken. This is only the code to detect agreements between France and FactionIsLocal. The entire script will be 30 times longer after I replicate all of the factions.

    Code:
    script
    declare_counter trade_partners
    monitor_event FactionTradeAgreementMade FactionIsLocal ;fires when broken by player and when offered by AI
     and TargetFactionType france
      if I_EventCounter france_trade == 0 ;no treaty
       and I_EventCounter france_trade_change == 0 ;no change this turn
       set_event_counter france_trade 1 ;treaty accepted
       inc_counter trade_partners 1 ;trade partners goes up
       set_event_counter france_trade_change 1 ;change has been made this turn, disallow any changes
      end_if
     
      if I_EventCounter france_trade == 1 ;treaty exists
       and I_EventCounter france_trade_change == 0 
       set_event_counter france_trade 0 ;treaty broken
       inc_counter trade_partners -1 ;trade partners goes down
       set_event_counter france_trade_change 1
      end_if  
    end_monitor
    monitor_event FactionTradeAgreementMade FactionType france ;fires when offered by player or broken by AI
     and TargetFactionType FactionIsLocal
      if I_EventCounter france_trade == 0 ;no treaty
       and I_EventCounter france_trade_change == 0
       set_event_counter france_trade 1
       inc_counter trade_partners 1 ;trade partners goes up
       set_event_counter france_trade_change 1
      end_if
     
      if I_EventCounter france_trade == 1 ;treaty exists
       and I_EventCounter france_trade_change == 0
       set_event_counter france_trade 0
       inc_counter trade_partners -1 ;trade partners goes down
       set_event_counter france_trade_change 1
      end_if   
    end_monitor
    monitor_event FactionTurnEnd FactionType slave
     set_event_counter france_trade_change 0 ;set to 0 to allow changes next turn
    end_monitor
    wait_monitors
    end_script
    ~~~~~~~~~~~~~~~~~~~

    One question I have on this one. Is the second portion intended to cope with the AI asking the player whereas the first is to signify the player initiating with the AI?

    Also, the one small problem I can see happening with this one, despite the fact it may be nonsensical, is that if the player were to both make and break a treaty withing the same turn, wouldn't it break the progression? It seems at least to me upon first look that the trigger assumes that to have an agreement means the counter will be 1, and to not means it will be 0. But if the player makes it and it goes to 1, none of the others will fire until next turn. They can still break it though, and then if they make it again, it'd reset to 0 and be backwards since it doesn't look like it is distinguishing from having one or not having one, just the action of making the agreement one way or another.

    Correct me if I'm wrong, naturally.

    ~~~~~~~~~~~~~~~~~~~

    Actually I didnt think of that, good catch. A diplomat cannot make a treaty and then break a treaty, because they may only have one interaction per turn. I doubt a player would send two diplomats, one to create the treaty and then one to break it, and I KNOW the AI wont becuase it wont make two opposing decisions in the same turn. It cant because of how the decision tree is processed.

    However an act of war breaks the treaty (I think). So if you sent a diplomat to get a treaty and then attacked that same faction it would probably screw this up. What I should probably do is set another monitor that checks Transgression.

    Thanks, I will look into that.
    Last edited by Augustus Lucifer; October 05, 2009 at 12:15 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •