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. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    hmm I've got no genius ideas for interface changes but I'll try to think on it!:king: If most units need to have Open Borders / Trade Pact in order to enter another civ's territory and trade, it could be cool to have a tag enabling a Smuggler unit that could enter any territory and trade anywhere :king:

    If there's something like a short term trade contract or quota, maybe would be best handling it as a Quest through Events XML. All in all some Quests making you produce and deliver certain yields to certain civs would be awesome :king:

    This would be especially good to make it more challenging to get minor civs to get friendly with you and eventually get them to become your Vassals. (it would be way cooler to complete some challenging Quests to woo them, rather than have them passively become impressed saying "wow orlanth is really far ahead, I think I'll give him free stuff to make him even further ahead!") :lol:;) If diplo relationships were influenced by quests and missions it could become an awesome hotbed of political maneuverings, where you'd have to make an effort to win their support, with other major civs competing against you for their favour. :cool::king:
     
  2. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    With multiple cities and multiple yields you would have to also have multiple traders, unless you can assign one trader to work multiple cities and yields. Which can easily be done. In my current setup a Wily trader with two moves can leave town, buy Tools from a neighboring town, deliver those tools, then be sitting in the another town waiting on his next turn, in other words one Unit can do quite a bunch given a good network.

    Regardless, I'll be testing all this over the next few days to see what can be improved.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, starting to remember now, what we need for sure is an OverView of what your Foreign Market settings are for all your cities. When you come back to a saved game (like I'm doing now) you may have no idea of who is doing what and why (I have no idea). So, a screen just like the one for domestic trade would be nice.

    I got the idea to use the TradeRoute.cpp because it auto added my Vassal cities, if it can do that then it can add the None Player Cities that are stored in Plotgroups now (I added that awhile back). Then all we need is to add some sorting code, a function for canAddCity() to prevent unwanted cities from being added and a function for shouldShowTradeRoute() so only appropriate trade routes will be shown, depending on what type of unit/screen is being selected/shown, Domestic or Foreign.

    Domestic Adviser already has enough info in it, it takes nearly 2 secs to load (in debug mode). So perhaps we could add all the Foreign info to the Trade Points Screen. Also, I guess when you add new Buildings or new Units it messes up the fonts as the icons and types don't match in Domestic adviser anymore.
     
  4. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I think you have a good idea, but possibly the wrong file. CvTradeRoute.cpp is more like the engine of a trade route. The ones we use are set up from CvCity.cpp.

    Changing DA was my first real python modding task and it isn't well planned (so unlike me). I think I will write a function to set up a page as fast as possible, which returns if it is called for a page, which is already set up. Whenever a page is chosen, this function is called. That way the init function will only have to set up one page and not all of them and we will not have a slow init.

    However there could be some logic in not having foreign cities in domestic advisor.

    I added this great XML tag to prevent precisely that problem... and then I didn't document it :p

    I will look into this and solve the problem soon and then I will give a detailed description of what I did.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Well, since the player only has one pile of trade routes to cycle through I thought we could just add a boolean to TradeRoute.cpp like isTrader() and then we can make checks to see what kind of route it is. In fact we can add all kinds of checks if need be, like isSeaRoute(), isAirRoute(), etc.

    I have never really used that Trade Route screen before and looking at it now I can see why. The screen is full of ugly "cancel" Icons and it doesn't even work like you would expect. If you click one of your Transports it does nothing. Only if a Transport already has a Trade Route assigned to it can you then only take away its current destinations, or add them back, and even then it is not working with most units. You would think you could click a Transport and start adding Destinations, but nope.

    It would be nice if the screens was split between different Domain Types, Land/Sea and at some point perhaps Air. Or you could have one screen with different domain categories perhaps. That way you could remove all those unsightly cancel buttons and make it easier to read. I see some improvements already...

    Vanilla Improvements
    -Split the Screens into domains, or list the domains separately
    -Make Units Selectable so you can add/remove all trade routes
    -Place the Units at the top of the screen so you don't have to scroll all the way to the bottom to see them
    -Use a different icon to represent if a Unit is on a route as all those unit icons are just confusing
    -Make the screen Scroll instead of resizing the Unit Icons


    M:C Improvements

    -Differentiate between AI Traders and other transports as well as Domain
    -Allow Serfs to take on the Porter Profession so they can transport goods as well
    -Remove Scouts Cargo, this isn't used for Hunting anymore
    -Make Hunter's Cargo only Unload-able, they shouldn't be considered Transports

    Those are some suggestions for starts:deal:

    Please do tell:thumbsup:
     
  6. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    Those sound like good steps to take. That is all I have to say :)goodjob: Air Domain)
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    BOOM!! Look at that sh[pissed].. all those cancel buttons just makes me want to click every one of them just so I can close the screen!

     

    Attached Files:

  8. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I'm done with the icon corrections.

    Here is how it works:
    1. CIV4GameFontInfos.xml lists the ID of the first icon in the row
    2. When XML have been read, iChar is assigned to info classes. This is a counter based meaning the first get the GameFontInfos.xml value, the next +1, next +2 etc
    3. if iChar is set in XML, #2 is skipped and the XML iChar is used instead

    What I did was fixing the wrong number for buildings in #1 and added iChar to the two new units (one of them called "A test"). I assigned the character 63 to those (that's ? for those who don't know ASCII values).

    I had to add iChar to the XML schema files. Somehow I forgot to do that when I added the ability to read those in the DLL :confused:

    EDIT: forgot to mention: I pushed the fix to TradeScreens branch.

    How to get GameFont IDs:
    Modify GlobalDefineALT to set DEBUG_GAME_FONT to 1. Enter Domestic advisor and click the far right button. (don't trust the 3rd row though. The detection is buggy). While working on this, I realized that I don't want those special keywords. I want some simple setup where the debug button(s) shows up on their own in DA if the DLL is compiled in Debug mode. Much easier to remember and we will never release a debug DLL by mistake (or we will quickly release a new DLL).

    Looping all traderoutes is a performance issue. It would be much better to have one list of domestic ones and one for foreign trade.

    I would love to split traderoutes into domains as well. However how will city A and B know which domain they are connected with? We can calculate it, but that would likely take too long.

    As for domains: they are currently hardcoded in the DLL and we have no air. Col2071 will need a space domain eventually. I'm not sure if we just add space for everybody (unused domain wouldn't hurt.... I think) or if it becomes an XML setup.
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Cool, the info for GameFont IDs should be posted elsewhere or pasted to the Blackboard.

    How much of an issue compared to how much work it would take to make separate trade route types for each current and proposed DOMAIN?


    Seems like you could simply do a isPortCity() to see if the City is a Sea Port, if not then only land based units can access it. It should check for same area already, or does it?
     
  10. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    and perhaps with air and space domains, we could add a building tag that sets it to accessible for those domains. A bit like what was once proposed for ports and bigger ships.
     
  11. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I thought of that while writing it. We should likely add it info like that to the wiki. I want to change how it works though, but a wiki can be updated :)

    Let me put it this way: you complained about performance in DA. RaR loops all trade routes when leaving Europe, which can take noteworthy longer. Ok, it loops all yields and in that it loops trade routes... or something like that, but still it's a performance issue.

    Besides making a domestic and foreign list of trade routes might be faster to code than jamming them all together and add variables to tell them apart.

    I can place two cities next to lakes, but that will not tell me if it's the same lake.

    Maybe we should make "terrain plotgroups". Rather than players, it will make one for each domain. That can be used to identify if islands are connected, lakes have ocean access and stuff like that. It would be pretty static, but placing cities at certain points could modify it, meaning it can change during the game.
     
  12. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    "terrain plotgroups"

    That sounds like a good idea, it sounds like it would compliment your once proposed ideas of transport of automations like the 'same plotgroup routes' automation. (I still miss that one when i play :D)
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I can't remember exactly how it works, but I there is code that set's distance to a Trade Screen Plot on every plot that can reach it. And I think I improved the code that checks for lakes without access to TradeScreen Plots. All needs investigated when we get around to it. Anyway, I'm sure we can use PlotGroups and what ever else to determine what trade routes a Unit has access to.
     

Share This Page