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

AI/Auto Traders and Promotions

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Jan 12, 2015.

  1. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I fixed a bug in the spinbuttons and pushed it right away.

    Each spinbutton has an id, which is essentially just an int.

    The normal threshold have the values 0... (NUM_YIELDS - 1)
    The trader export has NUM_YIELDS...(2*NUM_YIELDS - 1)
    Trader import ended up with NUM_YIELDS +1...(2*NUM_YIELDS)

    This mean that import food ended up with the same spinbutton as export luxury food. Clearly that is not what we want. I changed the import range to (2*NUM_YIELDS) to (3*NUM_YIELDS - 1)

    I also updated some comments in CvCity. The code is correct, but the comments had copy paste errors and I don't like comments not matching the code. It can easily lead to confusion and bugs later on.
     
  2. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, cool, thanks for that. I still haven't figured out the spinner and stuff fully yet. I pulled your changes and pushed mine. Just working with the AI trying to remember all I forgot.

    There are two ways (I had forgot) to push a mission, either stepwise or endpathplot which with stepwise the Unit will move one spot, check conditions, then move to next plot, endpathplot just moves the unit to the mission plot with no checks for conditions.

    With the Stepwise we can send a Unit to Foreign Cities to buy Tools, once it has Bought some it will pick another City and begin to travel there.. if it happens to cross its Home City it will Unload its Tools there before continuing on to the Next City. With stepwise we don't have to check for HomeCity whereabouts too many times, plus we can check for other conditions if need be.

    I am learning again how the missions work and am attempting to get the AI Traders to Buy/Unload like a Human would. So, I will need several different possible scenarios that the Player could have. Currently, I have two Native Villages with the Home City in between them so the Trader will unload each time it crosses the Home City. There will also need to be AI placed for situations where you have bought 50 Tools so far and there is a City a few turns away that has 20 more, but will it be better for the Trader to return home and unload or continue to buy more. Decisions decisions :p
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I have started thinking what could be a better interface for the Traders/Trade Routes. I really like being able to just right click a yield to set its options though, so that is super awesome. Night mentioned would could split the domestic Threshold for Import and Export in two. Then for the Right Click menu we can stack the new Domestic/Foreign commands on top each other as in the edited Screen shot. Except it would be labled liked...

    Domestic Import
    Domestic Export
    Foreign Import
    Foreign Export

     

    Attached Files:

  4. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Actually, now don't quote me on this... but it seems that since the Code for Domestic trade and Foreign trade is already split up in the AI, so that Domestic transports have no clue what the Foreign transports are doing, since this is the case we can have one setting for both on Imports.

    If a City is Demanding Spice, does the City really care where it comes from, foreign or domestic? The Player just has to know what he has in his warehouses. If he has no Spice, he knows he will have to use an AI Trader, but he can still set Spice to simply Import. Then the AI Trader knows to buy Spice for that City. I don't see having this split between Foreign and Domestic will help since the choice is in the Unit selected. At least for Imports, export is another matter as you don't want your Furs sold off when your Town next door could use them.


    I also notice with Vassals that their Demands show up on the Assign Trade Routes command, like it says Weapons from Canterbury to Jenne (A native town). So this probably needs adjusted so that Only Human Towns on your Team will be selected. We could also add AI Traders to this list. The trade route code could find Native Cities that have Imported goods for sale, and will display them when you click Assign Foreign Trade Routes. Exporting again is a different matter as the Trader simply finds the best city to sell his goods at and doesn't need and city selection for this.

    I am trying to make matters simple, so what we need is..

    AI Traders use Import settings of its Home City to determine what to Buy.
    AI Traders need Import Threshold settings so it will stop Importing at a certain point.

    AI Traders need a Foreign Export setting for Yields, so it knows which ones to export.
    AI Traders need an Foreign Export Threshold settings and will export goods above that Threshold.

    In the city Export/Import Governor display we can have Foreign Export yields displayed there as well with an extra symbol next to it so we know it is a Foreign Export.
     
  5. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Is there away to assign, reassign the home city?

    Is it a case of move trader to city, join city, turn back into trader?
     
  6. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Merging domestic and foreign imports is a bad idea. Say you have a city with poor food production. You add raw material production, such as ore and silver, but no units in buildings. Instead you transport all the ore to blacksmiths living in farming cities with plenty of food. If you produce enough ore from the mining city, you really want to tell your blacksmith city to import free ore domestically without also telling it to pay for foreign ore. We need two settings to make the city able to tell the difference.

    You are right that the city will not care where the ore comes from, but your budget will, which is why you can give orders to your cities on what to do.
     
  7. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Yeah I agree with night I think.

    You want to set foriegn import to say a limit of 50.

    So you buy from 0-50 because at this point you might be desperate for the extra ore.

    But your domestic imports are set to 300(or max storage or whatever the heck number)) because you want as much ore as possible in your blacksmith/metal town.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Thanks for not quoting me on that ;) Ok, yeah, I didn't think of that for some reason (half asleep). That's why I like to post stuff on here for you guys to look over, you guys are awesome. I come up with these totally cool ideas all the time, post them on here and you guys make me realize that what was totally cool is really not all that cool:nono:

    Yes to first question, no to second, that's been there sense day one. Assign Home City is a command on any unit with Transport or even a Treasure unit. And then there is the Return to Home and Unload command, where have you been? :D
     
  9. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Where you are half asleep I am always at least 4/5ths asleep!

    I am really lazy with my transport units, I used to make more use of the various commands, but now I just do fully automate transport or 'go to trade screen'.

    :D

    I will always tell you when you are not being cool, I am an expert at not being cool.
     
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Introducing the Alpha stage of the New Import/Export Popup Screen. I am wanting to keep the popup nice and tidy and keep buttons and info to a minimum. As you can see I sorted the Domestic Import, Export, Distribute (Feeder Service), and Minimum Threshold above the Foreign counterparts.

    Correct me if I am wrong again, but can't we just use the same Minimum Threshold for domestic and Foreign Exports? Then Domestic and Foreign Traders will leave the minimum when Transporting or Selling wares.

    The checkboxes and spinwheels are just about maxed out for Domestic and Foreign options, if we add any more the screen will not look as nice. We could always move some of the options to a new Row however, although it will require a scrollbar to see all the info. Anyway, I am trying to figure out what to do with the Foreign Spinwheel...

    Since we can use the Domestic Minimum Export Threshold for Foreign as well (hopefully) then perhaps something else. So, what about Maximum Import? The AI would stop Buying wares once you hit the Maximum Threshold, but how useful would that be? What if you are Exporting goods out from the city but the Trader sees a max so he stops, next turn a Supply Wagon hauls off most of the goods, now the Trader is behind in buying more.

    It could be used for the Minimum Player Gold Threshold, where the AI will stop buying once you hit this Gold amount, like he want spend anything under 1000 gold.

    The Art displayed I only worked up for Grapes and don't plan on adding more anytime soon. I did that just to see what it would look like and it looks quite well.

     

    Attached Files:

  11. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    I think the problem of having the same import, export value is again the same problem as before..

    My head hurts so I might be wrong too.

    I tried to write a scenario to illustrate but I could not get my head to wrap around it..

    I am struggling at the moment to comprehend the window info..

    The top row is the same as the old governor setup right?

    Import Export Feeder and keep X in warehouse.

    The second row is:

    Buy It Sell It and Buy Till You Reach 500 (Don't Go Above) OR Sell Until You Reach 500 (Don't Go Below)

    Depending on which box you check.

    Is that right?

    Also that graphic looks amazing, do you have a template of that border with a transparent middle?

    So all the Various Yield images can just be slotted in and exported ready for in game?

    I could probably do those for you, ready for the big shabang!
     
  12. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I noticed by accident that you could get spinbuttons on top of each other, but doing it that way meant you couldn't use the rest of the row (essentially the row became horizontal. Eventually I might start to experiment to figure out precisely how each popup window command works and how it can be used in an unintended way to see how diverse we can make the windows. Having two spinbuttons on top of each other without space in between would allow more settings without forcing the window to introduce a scrollbar.

    It does look great and it sure fits your original goal "not just a vanilla reskin". This is truly a M:C unique eyecandy.
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yes, the top row is the same. I renamed feeder to Distribute, which I haven't put more thought into a better term yet. This is the Right Click Menu you bring up when you click a Yield on the Resource Bar.

    Well, Buy it, Sell it, and the spinwheel isn't used at the moment as I am still deciding what to use it for. For Exports/Sell it, they should use the same Threshold. Or would it makes sense to say Export until you reach 100 Yield, and then Sell it until you reach 50 Yield? I think that a option like that would be used minimally if at all.

    Yeah, I'll attach it to this post. I didn't want to take the time to do that right now, but you can have at it. I'll have to add a popup art attribute to the XML for this, then we'd be good to go once all the art is done, that's the time consuming part.

    It doesn't have to be unique to M:C, feel free to use it in your endeavors. I really like the right click menu, much faster. I am trying to figure how to let the player know what Yields he has set to Foreign Export/Import. Night has changed the color of the Yield name in Export/Import screen to Red for when Feeder is turned on, so can't change colors any more. We could add an Extra Icons perhaps next to the Yield Name to show if Foreign Export/Import is on.

    I kinda like the idea of adding buttons to the Resource Bar, like what I did for the Sell on Market Icon, or using different click types as mentioned before. Like if you Shift-Click the Yield will be set on Export and a little Export Icon appears over it, if you click this Icon it turns it off. We could do things like that.
     

    Attached Files:

  14. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Kailric is corrected :spank:

    We want to tell that we want to empty our domestic storage in other cities before we buy from foreign cities.
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    This isn't about buying though, its about selling. Say we have a City overflowing with Lumber and we want to Transfer the excess elsewhere, but we want to keep 100 just in case we should need it, so we set the Threshold to 100, and check Export. Now our Transports can pick up the excess down to 100 yield. But then, we realize a few turns later that we really don't need Lumber anywhere else so we want to sell it all up to the Threshold, so we check Foreign Export, and Assign a Peddler to peddle out the Lumber, down to the 100 Threshold. My question, what would be the scenario where having a separate Domestic and Foreign Export Threshold in a city would be really beneficial?

    Edit: That feels good by way. I'll give you 30 minutes to stop that;)
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    And by the way, if you find some better looking border art you can post for us to check out. I didn't search all that extensive for what I found as I was just wanting to through something together pretty quick.
     
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    It would still make sense to have two thresholds.

    Imagine the scenario where you import and export domestically at 50. Selling to foreign cities is set to 100.

    Because the city imports without using feeder, it will gather all overflowing lumber. It exports domestically meaning it will most of the time not have more than 50. If it is allowed to stockpile to even reach 100, it indicates that no domestic city is currently importing lumber and it is overflowing your cities. That is the key to sell lumber for profit.

    If both domestic export and foreign export are set to the same value, you could end up selling lumber while you have cities not producing hammers because they can't import lumber. Having two different thresholds will not entirely prevent this from happening. If you do not have enough domestic transport capacity, lumber could stockpile in some cities and run out in others.

    New idea: checkbox for foreign export, which tells that it will only export if all cities in the plotgroup are not importing this yield.
     
  18. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    I think that border art you found fits perfectly, the brown tint to it goes perfect with the HUD colour, and the silver make it look all decadent and rich.

    I think it looks made for it!
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    That would be bad AI planning by the Player:p Anyway, I am going to work on the most important check boxes/spinwheels first, as each one will need to be coded/tested and that takes time.

    Export Excess, that would actually be a good idea. I plan to have an actual command for Selling Wares, so that if you load a Unit you can select Sell Wares and it will Sell all it has, that is the way it works currently for selling. Perhaps the Export Excess could check the stockpile vs consumption ratio to see how valuable the Yield is to your current domestic economy, and if things are running good it will Sell, Sell, Sell!!!
     
  20. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Ok, here is a quick go at the Yields.

    I am not 100% Happy with all of them, I think some might need a little work to keep them 'Unified' in style.

    I haven't got a Chainmail or Coats yet.

    Anyway, you are welcome to take or leave at your leisure.
     

    Attached Files:

Share This Page