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

Minor Civs, Nation States, and AI

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, May 26, 2014.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Here we discuss the new Minor Civs, Major Civs and their AI

    I moved this conversation here:

    Some excellent Ideas orlanth, and I really love the idea of missionaries adding research and I'll add that in pretty soon. I'll make a check to see if they have a research project then add some bonus research form the missions, for Natives and Minor Civs.

    Also, Natives do auto simulated trade with most of their goods. Those goods are turned into cash, so its not all wasted. They will also simulate moving goods around from one Village to another so if one village has a stock pile of Weapons some can be auto moved to another village.

    Edit: I have already added new Professions for Natives/Minor Civs, they can use Tools now for Military Professions like the player does.

    On Nation States (major civs). Byzantine will be my first convert. I discovered that if you add AdvanceStart points to a Civ, that AI civ will always start out advanced. So, getting the Byzantines up and running will be no problem.

    I have a special idea with the Byzantines and people who play them. According to history, in the year 447 AD, a series of catastrophic earthquakes rocks the city of Constantinople, leaving their once impregnable walls exposed. Attila the Hun, gets wind of this and begins to assemble his army to assault the city. It is up to You to repair your walls and prepare for this imminent invasion(in actual history they managed to do so just in time). Once, that is done and you survive you must then find a way to survive the next coming invasion, the Ottomans and their devastating Cannons.

    AI Nation States will be part of the playing field and can not win a Conquest victory. They will have advanced techs that they will guard closely.
     
  2. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    How about if building a Mission in a native city actually constructed a Mission Building in that city; this could give the city a small amount of research points and/or Crosses which could be modded as desired in XML. (This would also have the advantage that this could make a mission building graphic appear within the city realistically, instead of a superimposed cross icon and no building). Once the barbarian civ ruler gradually accumulates enough knowledge and decides to start a process of converting, there could also be a Monotheism Tech or Civic choice that unlocks an Acolyte Profession that can work within the Mission building to generate more Research/Crosses for that civ.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    That could work to orlanth. Establishing trading posts actually adds the building to the town too, maybe that building could help in ways also because trade stimulates ideas.

    I've had this idea also. It would virtually be the same as "summoning" a unit except as you say you would need good standing. These units could only be military and perhaps cost gold per turn. Or, to go with the "barracks" idea they could teach promotions to other units.

    About Natives giving gifts. This should probably be changed to not happen unless they are in awe of your civilization. They already "gave" you a plot of land and that's probably more than what you'd expect from rival barbarians:)
     
  4. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I have made some progress on this. Doing some trial and error I discovered that if you give the Pope some Advancedstart points and remove his "isEurope" tag he will spawn on the Map with several cities.

    I did a search of all places that is "isEurope" and thankfully there wasn't that many. I adjusted were it needed adjusted and now the Pope will spawn with several advanced Cities, with Rome his Capitol. He will also spawn a REF as before.

    I am thinking we can still make it impossible to declare war on Rome until you are at 50% Fealty as always. But you have a choice, you can attempt to appease the Pope and keep him happy or plot to take him down. If you declare war on the Pope, or if He declares war on you the REF will spawn as normal, perhaps reinforced with the Pope's sympathizers. So, it will be important to use your diplomatic skills to turn as many Leader's against the Pope in order to reduce the size of his REF.

    I sadly discovered that we can't dictate which Leaderheads are in the initial setup as that is all handled in the exe file. We can add players after all the initial ones are in place but this causes issues with finding starting plots as the initial world gets populated with Natives and such. So, I will have to do some magic coding to get these features to work bug free.

    For a Victory Condition, once you Declare war on the Pope or the Pope crowns you Emperor a REF will spawn to attempt to take your crown. Historically the Byzantines under Emperor Nicephorus I protested the coronation of Charlemagne whereby "Nicephorus ravaged the coasts with a fleet, initiating the only instance of war between the Byzantines and the Franks." So, this would seem to fit historically also.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I am beside myself in excitement, perhaps only a programmer could appreciate. :clap:

    Ever since I started coding Land Starts I have had issues with the None Natives finding a good place to start because of all the damn Natives populating every corner of the whole map. So, I finally took some time to see how things were built, then in a stroke of genius I set it up so that the Civs are setup in reverse order. None Natives are placed first, then them land hording Natives. Who cares if some Native Civ has 8 towns instead of 9 right?

    That is until I discover this breaks something else, let's hope not :D
     
  6. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, I have added all together 3 new attributes to Civilizations:

    Players: these are the Civs that compete to win. I add this for clarification.

    Minor Civs: Advanced Natives
    Nation States: should start the game with several Cities, they do not compete to win but are part of the playing field. They can be set up in XML to be very advanced.
    Religious Centers: This is also a Nation State, but if a game has a Religious Center, then there is no need for <DerivativeCiv> and they should be set to NONE. The Game will assign all appropriate Civs the Religious Center Player as their Parent. Parent players work as before, they doPrices which causes the prices to fluctuate. However, each Player's buying and selling will effect Prices for every Player instead of individually with separate Kings/Popes. There should only be one Religious Center and you will get a Failed Assert if there is more than one.

    Each Player Civ will still have it's own REF as these units are stored per player on not on the Parent. So, I am thinking that the "Revolution" will still work as before and you still win when all your REF has been eliminated.

    Can anyone think of any wholes in my ideas so far, or potential problems?
     
  7. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    whoa u are blowing my mind with all these outside-the-box developments Kail!:wow: :cooool:

    In vanilla I thought REF units are stored on the Parent not per player, but I'm assuming you changed this specially for this feature. If there is a Religious Center player who is Parent of several of the civs, is it still possible to have other civs which have their own unique King as Parent?

    One flaw is that it would be a drawback for the realism of the economy that all the pricing lists in every city of every catholic nation become totally linked together, and the vanilla system of semi-random price shifts with parent civ doPrices is lame anyway. Is it possible to let there be an independent price list for each Plotgroup which gets affected by local supply/demand in that plotgroup, and also an independent price list for each Trade Screen which gets affected by sales into that Trade Screen? This would make trade way more interesting if prices were really determined by local supply/demand, and give an important balancing feature by depressing local prices where you're minting money too easily by oversupplying a good, pushing you to seek out undersupplied markets elsewhere.:gold:

    For Parent civs that have some cities and units on the map, it would be cool if their "child" civs can ask them to attack other civs through the Diplomacy interface, though this would come at a cost in gold and relationship (just like asking other civs to declare war in the vanilla diplo system, only it would be analogous to petitioning to call a Crusade against one of your foes.)

    Awhile back several people had posted some ideas about making a game option to play as a Europe King player. :hmm: That wouldn't work in vanilla, but maybe if a Parent player can have some units/cities on the map it could be an interesting twist to play as them (ie enabling your subordinate civs to grow and pay you Taxes, while not letting them become too powerful to declare independence and beat you :king:) Also it would be a unique and interesting challenge to play as a minor power or advanced natives and attempt to win.

    Not true. Speaking as the Siamese twin of a cloned alien cyborg, I am literally beside myself all the time :borg::borg:
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    In vanilla the REF is stored per player, not on the Kings. It only stores Class and Profession and only creates the units when the war starts.

    The code really wasn't all that complicated, and I was glad of that.

    Your ideas on the economy are great but that will be in the next project, but keep them coming:)

    Yeah, I thought about the linked markets. I been looking at making the markets per player, and I think that will work for the moment. I think all I will do for this release is adjust the Price adjusting code, maybe use a formula that you suggested.

    I haven't tested it yet, but the new religious centers should work like other Civs. They are no longer labeled as "Europe" and therefore are not restricted in all those areas. They will have lot more options for diplomacy. The Pope may not like you very much depending on your Civic choices, so if you want to remain under his blessing you best be a good little pious peon:)

    Hmm, playing as the Pope or King, that does sound like an interesting twist. It could be more about Diplomacy than anything else. That gives me the idea though, when the Pope increases your tithes, all tithes paid actually go to the Pope player for him to spend as he wills.

    And yeah, you'll be able to have the derivative civ set up as before. I am attempting to preserve as much of the vanilla options as possible.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, progress, there is a new Civ type, Invasion Civs.

    InvasionEra: if a Civilization has an Era set here they will appear at that time. Any number of Invaders can bet setup. They will appear with their Units and start to setup base camps to spawn new Raiders. This is all setup in the XML.

    So far I have reprogrammed the xml of the Scandinavian Vikings to act as these Invaders during the Viking Age, starting at Sea. We can already adjust the LeaderHeadInfos to make sure Invaders are very unfriendly, anti diplomatic, and more inclined to War.

    I am thinking we can make these guys Playable also. If you play as a Raiding Civ, the game will autoplay to the specified starting Era, such as the Viking Age, then you can begin your carnage. We can set up Victory Conditions specific to Invaders, perhaps you need to Conquer a certain percent of the Territory, or a Number of Civs, along with Gold Looted perhaps. Then when you play against these guys you have to Prevent them from winning as well.

    I am going to set it up so that you can have a land start also with Invaders, ala Mongols. They will start in the Silk Road territories as if Crossing from the Mountains and Barrens.
     
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Welcome to Rome my friends, 476 AD. Maybe I should set it on fire, as it was just sacked actually :devil:

     

    Attached Files:

    • ROme.jpg
      ROme.jpg
      File size:
      199.3 KB
      Views:
      231
  11. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    "InvasionEra: if a Civilization has an Era set here they will appear at that time. Any number of Invaders can bet setup. They will appear with their Units and start to setup base camps to spawn new Raiders. This is all setup in the XML."

    Collapse of the Dark Ages here we come!! :D

    Some exciting stuff coming out here :D
     
  12. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Progress Report:

    Nations States or Civs with no Parent(Europe) can now begin Trading with the Trade Screens. I had to make several changes and additions to get them to function as all Europe Trading was associated with a Parent Civ.

    I need to add code to the XML for Advanced Civs to start with some essential goods as they start with nothing. Anyway, I gave them some goods in the DLL but I need to make this XML values for FreeInitialCityYields. I also am going to give them a XML number of free Techs, instead of choosing which techs and making a huge long list I'll just set a max number they can have for free and let the AI choose for themselves. Perhaps some techs can be set as None Free so they will have to research them. I need to do this for Trade Techs also.

    I am thinking it will be an easy Fix to get the AI Civs to use the different Trade Screens. We can create a new function that looks for the best price with travel time and cargo space as factors. And once a Trade Screen is chosen just apply it to the Unit like we do with the Player.

    We could setup Trading Civs and that is all they do. Think Chinese Junks appearing, buying and trading goods, then selling off over the horizon.

    The Question is, should the Minor Civs (Natives) be allowed to start trading? Only makes since that they should. With everyone Trading it would perhaps create a really cool Economic Model for us to play in :)
     
  13. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    wow, sounds awesome as always:cool:

    Sure, getting AI traders stopping by from time to time sounds like a fantastic twist:king: It seems that it would take a lot of work to get working smoothly though; are the traders able to plan their trips reasonably to bring goods from low-priced cities to high-priced ones? Do trade agreements like Open Borders affect their ability to trade like this? Would be kind of cool if they did (could choose to let foreign traders in to supply your citizens, versus using embargos or Mercantilism to close off foreign trades and keep tight monopoly over your local economy).

    About your native question, it would be cool if primitive natives with really high diplo relationship with you could still have a good chance to Give Gifts (especially to weak/new neighboring players just starting out, or if you have a Tech or Father with a bonus to gift-getting); but as the natives get more advanced (maybe discover Barter techs etc) they become more apt to send traders instead to haggle with you :gold::goodjob:

    For Advanced Start, I wonder if there is some way to tweak the vanilla Advanced Start Setup system (which is really kinda cool btw) to also let you choose to "buy" some yields to start out with.
     
  14. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    There are two issues to consider here:
    1: which dock do the immigrants appear on? (if they appear on a dock)
    2: The AI buy yields after selling.

    What could happen (if we don't plan ahead) is that the AI produce mainly 4 specific yields. They happen to be more expensive at trade screen A than on trade screen B and the AI always head for A. Tools and weapons and half price on trade screen B, which is also where the immigrants appear. If the AI only considers the sale price of the yields it wants to sell, it will never head for B.

    You are thinking in the right direction. However we need to figure out some "lure" for trade screens with immigrants waiting and stuff like that. In fact the AI may want to send empty ships there to pick up cheap yields/people.
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    The way I work the AI is until we have the Human way of doing things set in pretty good solid stone I don't attempt to get the AI to match with humans, so I allow them to cheat. Having them not cheat is my goal, but it all takes time and effort. At the moment we are working on what's cool for Humans.

    Anyway, what I will probably do, for #1, is just allow the AI to pick up Immigrants no matter what Trade Screen the AI is in.

    For #2, How did the great Traders of the day decided which trade route to take their goods? They had to weigh all the factors; time, costs, danger, etc. I figure we can simulate this for the AI and have them use Trade Screens a bit random, even if they would make more profits at a single trade screen, they will sometimes use others.

    I should port in my Pirates mod. In that mode you could prowl the high seas and actually intercept units as they where trying to cross the oceans, that would make them think twice about which trade screen to visit.:mad:
     
  16. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    We agree on that part and that isn't the question. You proposed a change and I note a few potential issues with the change. I'm all in favor of getting the AI use features made for humans without special rules, but adding one feature and break two is not really an option.

    That should certainly be optional, either by XML, game option or both.
     
  17. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    I see what youre both saying in that it's probably the hardest aspect of modding to really get the AI to plan appropriately especially knowing what to transport and when. But the vanilla AI has been so bad in this area that if it's possible to carefully work out how to really improve its yield and transport planning in a generalizable way, it would be a great modding achievement worthy of raising both your Knight Dubbing Weights for sure:cool::king::gold:

    So here are some overall ideas about possible ways to address whats been mentioned (which I realize may be too vague or too hard to implement, or both:p):

    * when it is planning transport trips between cities on the map, my impression is that NG got it to consider Yield needs when planning the trip and that this did help a lot. Ie it effectively remembers what its needs are for Yields (IIRC this is done by considering net yields being used by professions in the city, yields needed to complete buildings/units under construction in the city, plus a buffer for yields used by possible professions that could be adopted). It can then be able to plan a transport trip between somewhere with a large supply of Yield X, and the city where Yield X is needed. If this kind of thinking is already involved, maybe a similar approach could be used to help in planning for potential tradescreen trips.

    * Since you're planning to make trade between cities on the map a bigger part of the mod, in many cases it could be able to satisfy many of its needs through this kind of trade/transport; but it could also still occasionally have situations where it would make a Tradescreen trip to import yields that are currently hard to find on the map. (the perfect case in point in M:C being Spice, where having high unfulfilled Spice needs for awhile would start raising the likelihood of making a Spice Route trip. It might also need to make such trips from time to time for Tools or Weapons yields in cases where enough cannot currently be easily obtained from its cities or others on the map.) If there are Immigrants waiting at a particular Tradescreen, that would also be a factor that could affect it likeliness to make a trip there to pick them up. Conversely if it has a lot of another Yield that it wants to sell, that could also be a factor making it more likely to consider traveling a Tradescreen with a high price for that.

    * A possible way to achieve this could be:
    For each player, store a single array of all Yields which represents the degree to which that Yield has an overall oversupply or undersupply on the map. Ie when it sees a lot of YIELD_TOOLS needed to complete buildings under construction but cannot find a way to transport this from other cities on the map, this would add to its perceived undersupply of YIELD_TOOLS making its cached value for YIELD_TOOLS a negative number. (ie it would effectively be thinking "can't find Tools anywhere! need more Tools!". Then when the time came when it could consider a Tradescreen trip, the need to import Tools from somewhere would be something that can enter into its decision appropriately.)

    When it was time for it to plan a Tradescreen trip that could import needed Yields/citizens, it could pick the Yield where it currently sees the most global undersupply on the map, then iterate through the Tradescreens its currently eligible to travel to and rank these in order from most expensive to cheapest price for that most-needed yield. Then you could use some formula along these lines to consider which Tradescreen is best to travel to:

    yieldcheapnessrank * (1+units waiting in tradescreen)^2 / (time to travel to tradescreen)

    Once it decides to go to that tradescreen, it could check the oversupply cache to see if there's an oversupplied yield it could bring along to sell at a good price there. Or if you want you could try a more complex weighted average where it would consider undersupply and oversupply of every Yield and weight these to determine the single best Tradescreen to go to at that time. Anyway you probably wouldn't end up using exactly this system, but this kind of thing where it remembers yields with global undersupply / oversupply , then considers this and units awaiting transport when planning a trip, might be overall way to think about helping it plan for transport. :gold:
     
  18. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Some good thoughts orlanth. Man, why aren't you programming? You think like a programmer, may as well go all out :) How much do you already know anyway?

    I'm not sure what all we can do for the Advance Start and it's interface, but I'll look into it.
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, I am wanting to do some AI improvements to get the AI to better handle the Pope being on the Map and needing to capture Rome. I remembered there being some AI improvements in TAC and looking through the docs I see these potentially..

    Also, I saw...

    Which is funny cause I did not write the Custom House code, it was Aymerick. But they gave Aymerick soul credit for the Whaling mod which I mostly wrote the code for so we're even ;) I miss Aymerick, wonder were he went off too. I remember he was in school to learn programming.

    Edit: Actually, looking back at the whaling thread, the whaling code may be a good base for the Wrangler profession I mentioned. Totally forgot about that.
     
  20. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I have put it on hold right now as I'm looking into making a savegame format, which is more failsafe than the current one. If we had this already, then 2.5.3 wouldn't have been released as the bug would have been caught right away.

    It turns out that I need a JIT array of JIT arrays to do that. I decided make one (called it 2D JIT array) and it sort of works, but it still needs a lot of work before it can be used for anything. There is a reason why I postposed it plenty of times before. I will make a post about it in the DLL thread once it actually works as a few words on how to use it would likely help quite a lot.

    I have considered something like that as well and it is likely the best solution. There is one drawback through. Either it is slow or it will need some clever cache. I'm thinking something like having a cache in each city and whenever a city updates the cache, it will update the player cache with the difference between the new and old values for the city.

    There are a number of different people involved in designing new features.
    1. Game designers
    2. code planners
    3. programmers
    4. gameplay testers
    It may come as a surprise that people in 2 can't always do 3 and vice versa.

    Having said that, I would welcome any coder at any skill level as long as the motivation is present. Sure I may have more work proofreading inexperienced code, but that's not the worst problem we can end up with.
    Sometimes even the simplest code can be beneficial. Look at imports/exports in cities. They can be red/green depending on feeder service. Adding small graphical additions to tell data, which is otherwise unreadable in the GUI may not be a hard thing to do from a coding perspective, but it sure helps in gameplay.
     

Share This Page