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

M:C Main and City Screens

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Feb 11, 2015.

  1. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Adding buttons is tricky in DLL based windows. On the other hand a checkbox is easy to add.

    Hmm... distribute a yield evenly between all cities... that would be something like enabling feeder service and export everywhere and a dynamic threshold. Something like an awareness of warehouse capacity and storage of that yield in all cities and then each city will request it's own share. This would require some clever caching setup. One thing I can think of is setting a threshold in CvPlayer and then apply it to all cities. We can then have a counter for how many cities are actively importing the yield. When the counter reaches 0, increase the threshold until cities import again. Not sure what to do regarding lowering the threshold though.
    One way to set the threshold is to use the yield cost of the most expensive profession. This is currently cached, but not used as I haven't made the AI aware of this cache (the plan is to make... well something like this).

    Feeder service:
    Auto enable/disable import based on storage only. The player sets a threshold and the computer will import as needed to maintain this level.
    Rules are that it will stop importing if storage goes over 100% of the requested level and it will start importing again if the storage drops to below 75% of that level. In between the current import state is kept. In other words it's a system with hysteresis.

    The reason why it doesn't just trigger at 100%is that it would toggle on and off way too often. If the city is set to import and export something, it uses 3/turn and has a threshold of 100. It will fill to 100, wait until it drops below 75 (9 turns) and then fill up again.
    If it triggered on 100% both ways, it would fill up to 100, next turn it has 97 and it will use a transport to obtain the missing 3 and stop importing. Next turn it uses a transport again to gain the missing 3 and so on. Moving between 75% and 100% is an attempt to use the transport more efficiently and not make them move tiny amount of yields.

    Consumption multiplier:
    This is an auto threshold setting. It calculates how many yields you need each turn to supply your buildings if they are all full of units with no modifiers. Consumption multiplier will then set a threshold of that number multiplied by the consumption multiplier setting. In other words it is a setting asking for how many turns you want to stockpile for. This number will go automatically up when you construct a new building with more worker slots.

    Feeder service also has other sources of auto threshold. It will always try to import to meet the requirements for the buildings you have in the building queue. There is no GUI to modify this behavior. It's just always on if feeder service is on.


    EDIT: the forum just informed me that I should read this thread because I haven't read the newest post :badcomp:
     
  2. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
  3. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    No. This topic was highlighted as unread even after I read what you had written. The forum really assumed that I haven't read what I wrote.
     
  4. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I don't think it is that tricky. We add a "gDLL->getInterfaceIFace()->popupAddGenericButton", then add a "pPopupReturn->getButtonClicked()" in the return code.

    When you do the "gDLL->getInterfaceIFace()->popupLaunch(pPopup, true, POPUPSTATE_IMMEDIATE);" The "true" part tells if where to bCreateOkButton. In the Import/Export this is true. So, we keep that as true but add our extra commands just before this line. Like I said, this is only done in the Single Yield Option popup. Which, now that its all working, it is the only popup I use. Now, if I had several Yields to issue commands to at once I would use the Multi Yield popup.

    Ok, so this isn't something already coded, but yeah, it would be a neat feature. Also, I have a Ship docked at one of my cities loaded with Chainmail and Horses from the Spice Route. It would be cool if I could included that as part of this distribution system. Either Wagon trains would take from my Ship, or my Ship will unload automatically as needed.

    I'll add the Feeder etc. info to the opening post.
     
  5. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    I am going to add to the Hover Help Text to make sure this system is fully understood. So, you are saying that for Consumption, if I say input 3 turns and need 12 Grapes per turn it would stockpile 3*12 = 36? Also, looking at the code 25 turns would be the max, is all this correct?
     
  6. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Great.

    Yes.

    There is no technical reason for this limit, nor did I think much about it. We could set it to whatever we want, though it might make sense to cap it at warehouse capacity meaning it shouldn't try to maintain 120 when the warehouse can only hold 100.

    Speaking of which, the shared warehouse capacity from RaR would be nice to add. RaR even made it optional based on XML.

    Another thing I didn't think much about is the name. If anybody can think of a better name than consumption multiplier, now is the time to speak your mind. I would prefer to stick to a name once it has been released but this name only exist in the development versions.
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yes, I would say it needs a limit so you don't end up with overflow. Perhaps we can set the limit to std::Min the Storage or the Product(3*12), regardless of what the player inputs.

    Yeah, I'll think on a name. I actually renamed Feeder service already to "Distribute", but now that I more fully understand what Feeder is doing the name don't really fit. Something like "Regulate Imports" would be more fitting, because you are automating imports, but "Automate Imports" sounds more robotic.

    We can assume that we are giving orders to our Governors/Stewards with these commands so having titles that represent this would be best. Perhaps something like "Administer Imports", or "Govern Imports", or oversee, monitor, etc. So, for Consumption which automates threshold, we can call it "Administer Threshold", or perhaps "Monitor Threshold", that way if we use "Administer Imports" the two commands will not be confused.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, Night, this is what I was talking about. The new command "Export from here" will turn on Exports for that Yield at this city, and sends a task to turn on Feeder Service at all other cities. That way you can quickly setup an Export City. How does that sound?


     

    Attached Files:

  9. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    It's an interesting idea, but I'm not too happy about it. The problem is if you have some other city, which you do not want to feed. You can't make it feed to 4 out of 5 cities. You might not notice that you start feeding yields to a city, which you don't want to feed to and it isn't on screen when you do so.

    However adding such buttons gave me an idea for another button. How about "feed everything", "export everything", "feed and export" and "clear all" buttons? You do it based on individual cities, but you don't have to click hundreds of checkboxes to set up all your cities.

    Perhaps we should make checkboxes (or whatever) for those, meaning that is the role of the city, which can then update automatically to changing allowed yields.
     
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Player's should be informed of what the command does so they know when they issue it all other cities will turn on Automatic Imports. If you know what the command does there is no chance that you will not notice a city getting this turned on. There may be a city you don't want to issue the command too, then you just have to remember to change to that city and turn it off. If you have more than one city, then perhaps this isn't the command to use. This is mainly for those instances when you want to turn on all but one cities, when you have one city producing Horses and you want to send those Horses to all other cities. It has a widget so we can even make a help text popup when you mouse over the command.

    Those are good options too, although I haven't had a city that I would want to export everything yet. Perhaps with a multitude of cities this option would come in handy. With a small amount of cities most cities will be specialized and need certain resources.

    The "clear all" button sounds good, this button could actually, just uncheck everything and then reload the popup so you can either close it out or re-set it up the way you want.
     
  11. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, I just added the clear all button, quite nice actually, and came in handy pretty quick in my game. I had tools in one city set to all kinds of things, but now all I wanted it to do was import.
     
  12. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,671
    Location:
    UK
    I think a clear all button should have a n 'are you sure' type check pop up.

    Otherwise I can see a great deal of faff work being undone with an accidental mouse click!!
     
  13. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    It only undos that one Yieid in that one city. Plus, look at that last screen shot. That is how the popup will look when it pops up. You will have to actively scroll down to issue the clear all button.

    Now, we can add this to the Multi Yield Popup as well, and the Clear ALL Button could be placed at the very bottom of the list so you have to scroll through them all. Which you can do very quick by dragging the side bar. We could also add a "are you sure" popup to that.

    If popups are given a default OK button to close the screen, then that button appears by itself and is unaffected by scrolling, it stays in the same spot. But, I turned that off for the Single Yield Option popup so that all the buttons will appear at the bottom of this screen. That's why I had to add the "Close" button.
     
  14. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    I think we might be looking at this the wrong way. Perhaps the answer is to make an advisor, which sets up details for us.

    Something like a Domestic Advisor screen for yields where we have settings for all yields for all cities (settings stored in CvPlayer). Possibly like the debug screen, except there will be proper text and yield icons :)

    Orders could then be (just proposals)
    1. No orders
      Current behaviour
    2. Spread evenly
      Stockpile weapons/horses/whatever widely across your cities to fill up all warehouses and always have some nearby
    3. Send to best production city
      Automatically send raw materials to the city with the best consumption of this yield. If full, it selects the second best and so on.
    4. Export all unneeded
      All cities turn on export if they have more than they need. You can then make one city ignore orders and import
    5. Send to trade hub
      All excess yields are send to a city you have given trade hub status. Your traders can then operate from here with a greater supply to sell.

    A city can then have a checkbox for not following the global orders for specific yields.


    This mean you can spread weapons evenly and in case of war, you can switch weapons to export and set one city to import regardless of rules. That way all the weapons you have across your empire will end up in that single city where you arm your men.

    A nice bonus would be that it isn't unrealistic to make the AI able to use those global orders. Particularly #3 could be interesting for improved AI economy.
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Yeah, something like that would be extremely useful. Of course, not on the books for this release. The buttons I added only took a few minutes of coding and are there to be used if need be. Like the clear all button, only took what, 8 min?
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, so until we have a better interface I've added those buttons. I changed the button text to read "Export to all other settlements". This will turn off Feeder and Imports, turn on Exports for that city. It will then turn on Feeder to all other cities. This will be useful if you have one city produces Horses and want to Export them to all other cities.

    I also added "Import from all other settlements". This will turn off Export and turn on Feeder at the city. It will then turn on Exports from all other cities. This will be useful if you have one central city that uses Ore and you want all other cities to ship ore there.

    Note: none of this effects Foreign Imports/Exports as that is on a different system.

    There is one issue however, all this does is set the import/export and such for all those cities. It doesn't actually assign any Transports to actually do the work. You still have to set all that up manually. It would be nice if we could do all that also, right there in the city screen. I aim to have some of this doable in that you can command Transports that are at that city with a right click on the unit or command units assigned to the city in the Settlement Transport panel. I still have some issues to work out on that.

    Also, we could add a Clear All button somewhere on the Import/Export panel that you can click to clear all settings, perhaps with a warning message.

    And I added some help text to the mouse over yield menu in cities, "Right Click for Yield Options" is displayed in yellow just below the Yield Name. I discovered that if an Icon is set to Draggable it will ignore Left Clicks. So, you have to right click for the Yield Option Menu on the resource bar, but you can left or right click the Yield Name on the Import/Export panel.
     
  17. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    If they have a threshold of 0 (the default), then they will not import because they already reached their threshold. The threshold should be increased to say 80% of warehouse capacity or something.

    Why use feeder? If you want ALL ore to go to a single city, just import it without checking if it is overflowing. Feeder is designed for allowing multiple cities to import the same yield without ending up with all the yields in a single city.

    Either the threshold is the issue or you did it incorrectly. If it is done correctly, automated transports should start to work on what you have set up. Naturally if they have too much work, they have to pick and by chance it might ditch the work you just told it to do.
     
  18. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Now, I am confused... the vanilla threshold setting is for Exports right, how does this effect Imports? It only exports yields above this value?

    I thought of this, but if Feeder is on it will turn off Imports to that city when it is full correct? What if you don't want to waist those extra yields that may get lost next turn? If just set to Import, won't they just keep pouring in yields and the over flow gets lost or sold?

    Yeah, I didn't think about the "fully automated transports". I haven't been using those. When you have 15-25 trade routes setting all your transports to fully automate may not get your "priority yields" delivered first, so I have been manually setting my transports on what routes to take. What's your thoughts on this?
     
  19. Nightinggale

    Nightinggale Chieftain Supporter

    Joined:
    Feb 2, 2009
    Messages:
    3,986
    Feeder service will import until the warehouse contains the import threshold and then it will stop importing. This threshold is 0 by default meaning just enabling feeder service will do nothing.

    Well there is the exception that the city will automatically increase the threshold to whatever your building construction needs. The same goes for consumption multiplier. If those are active, it could make sense to use feeder service together with a threshold of 0.

    One (very useful) way to use feeder service is to turn feeder service and export on for tools while keeping the threshold of 0. That way the city will automatically import the tools needed for construction (provided there is a city exporting them), but it will not store more than it need. Any excess is exported.

    Feeder service is designed with fully automated transports in mind. In fact they aren't designed to work with manually assigned traderoutes.
     
  20. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Ok, I don't know about this Import Threshold. All I've got programmed is export threshold. Not at home to check. Is this in M:C?

    Yeah, we could have a command for Transports so they only work with cities with Feeder turned on. That way you can use your designated Transport setup, like to haul only Food, and then Feeder transpors will ignore those routes.
     

Share This Page