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

Feedback and Suggestions

Discussion in 'Civ4Col - Medieval: Conquests' started by Kailric, Aug 11, 2013.

  1. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    Just a little update on how this is going. I managed to make the city aware of yields needed for a building and it will turn on imports accordingly. I noticed it wouldn't actually tell you what it decides on so I made a python interface to the new number and updated the city screen accordingly. Getting a visual example feels so much better when showing progress :cool:

    When there is only one number in parenthesis, then it is the number you selected. If there are two numbers, then the first is the one set by construction while the second is the one you selected. It will only show both if the current construction demands more than the user set threshold.

    Exports still ignores this setting and I managed to get it to stop imports just before taking this screenshot because somewhere it needs to make a threshold test when changing which building it will construct.

    Last I need to cache the construction demands. It is called rather often and recalculated each time. However I think the cache will be in a future commit. Having one commit without cache and one with cache will make it easier to go back later and figure out if the cache is the cause of a bug (if we get a bug in this)
     

    Attached Files:

  2. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    I pushed the first commit to github. It increases threshold according to the building/unit currently under construction and traderoutes honour the increased threshold.

    It's not done though. It needs to cache the output of CvCity::getProductionNeeded() and CvCity::getAutoMaintainThreshold() in order not to slow down the game. In fact caching those two will make the game even faster than it was before this commit.

    It does precisely as I had expected, but while testing I noticed something, which could be better. It only look at the building/unit currently under construction. I tried to build a stockade (needs 50 lumber), but it only had like 40 when it was finished. I had imports, exports and feeder on and threshold set to 0. Now that the stockade wasn't the first in line to be build the traderoute started to use 0 as threshold and moved away all the lumber and as a result the city never reached 50 to finish the construction. I came up with the following plan:

    CvCity::getAutoMaintainThreshold(YieldType eYield) should return a cached value. This value is calculated by looping though everything in the construction queue, the player set threshold and the finished constructions like the stockade (wherever that is stored). The value getAutoMaintainThreshold() returns is the the highest number encountered while checking all that (this is done for each yieldtype). That should take care of the almost finished construction issue.

    getProductionNeeded() will just return the number it returns now, nothing special. The only difference is that it should be cached as it is called inside loops when the AI tries to find the best trade route for a unit (this goes for fully automated human transports as well).

    Another issue. During testing a ship decided to load 200 tools and head for the spice route while I was short on tools in other cities. If nobody objects I will prevent human controlled fully automated transports from going to "Europe".
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Awesome improvements!:goodjob: I have no objections. Never really used or liked that "feature".
     
  4. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    I made a cache for auto threshold and set it to max of user set threshold and production queue. It still failed to detect my finished stockade and its need for lumber. I added finished buildings to the list and now it works. However now I wonder if I should remove the production queue.

    In short, which of the following conditions should be considered when setting the auto threshold?
    1. user set threshold
    2. current production
    3. entire production queue
    4. buildings with finished hammers, but lacks other yields
    The auto threshold is set to the highest number it encounters when looping though those conditions.

    We could set an on/off switch on each of them, but that leaves the question what the default should be and how to implement control of the on/off switch. I'm not sure such a control is a good idea.


    While working on this I noticed that I allocate memory for all yields while virtual ones will always be 0. That gave me the idea to add a just-in-time array type for cargo yields. This will reduce memory usage by 28 bytes for each array. Not much, but it is a 20% reduction. Even more interesting is if we use length() (part of just in time) when looping though an array, we reduce the times the insides of the loop is called by 20%, which is an interestingly high number of saved CPU cycles. If we look at units, then only the first 1/3 are of "colonist" type. I have decided I will look into this later. The only real downside to this is that it affects savegames. This mean that old savegames will break, but the error will be that they contain a known number of garbage bytes at known locations. Modifying read() to skip some bytes should be doable.
     
  5. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,776
    That sounds good, but you might not need to look through the entire production queue. In most cases it'll take quite a few turns to get through that, the AI won't need to move that far in advance & not having to do so might improve its gameplay by making more available for immediate needs like buildings/units waiting for yields to complete. As talked about earlier you could also try including a "buffer" for the number of yields needed to adopt any profession that requires yields so the AI will be able to adopt professions, but I'm thinking in practice that might have adverse effects, particularly in M:C where there are multiple expensive yield types needed for adopting many professions, it won't be feasible to stockpile sufficient amounts of everything everywhere simultaneously (and yet if it doesn't it can't adopt the professions). Also maybe automated ships going to the spice route/Europe should be allowed only for yields of group AI_Sell_to_Europe.
     
  6. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    My main concern with this is that it will deliver tools to a city, which needs tools for the third thing in the queue while not delivering to the almost finished building needing those tools. However I think that can be solved by messing with priority. This is controlled in CvPlayerAI::AI_transferYieldValue() (in CvPlayerAI.cpp).

    One thing I noticed is
    Code:
    if (iStored > 0 && iStored < iProductionNeeded)
    {
    	iValue *= 150 + 100 * [COLOR="Red"](iProductionNeeded - iStored) / iProductionNeeded[/COLOR];
    	iValue /= 100;
    }
    It will move to the city with the highest iValue meaning we should boost this value if we want the cargo to go to this city. However imagine we have two cities both needing 50 tools and we move 20. If we simplify into just the red part, then we get:
    Column 1 Column 2 Column 3 Column 4
    City stored calculation iValue
    A 20 (50-20)/50 0,6
    B 40 (50-40)/50 0,2

    This mean city A has a higher priority to get from 20 to 40, than B has. I'm thinking of giving a bonus if
    Code:
    if (iAmount + iStored) > iProductionNeeded && iProductionNeeded > iAmount;
    This way B will get the tools while A will have to wait. I think that would be best, specially if it is the AI moving this and it will have to pick up tools in Europe because it lacks ore.

    However I haven't figured out how that bonus should work. I think it would be best to rethink the whole function at some point. If we do that, we should make it work with floats rather than int because
    Code:
    iValue=int(iValue * 1.5);
    is actually faster than
    Code:
    iValue = iValue * 150;
    iValue = iValue / 100;
    They will provide the same result. However if iValue itself could be a float. After all the only thing we need the result for is to compare the return values for all potential traderoutes and find the highest one. Finding the highest float is just as easy as finding the highest int.

    This can be solved using AI code rather than traderoute code.

    -Cache max yield required as this is the amount the AI needs to store.
    for all cities having at least max and the first one not having max:
    enable feeder and enable a new bool telling that this city needs to store for professions.
    Unset this new bool for all remaining cities.

    When figuring out if imports should be enabled or not (current feeder function): if this new bool is set, then enable imports if stored is less than the max cache.

    This way the AI will try to gather to make everything in city 1, then 2, then 3 etc. That will allow the AI to gather to make all professions in all cities while gathering rare resources in one or a few cities to prevent spreading them too thin to make any of the expensive professions.

    It's a rough draft and if coded precisely like I wrote, then it will have the problem that it will still pick up yields needed for professions. However the concept is there. At the same time it will depend on a few checks of an empty just-in-time array for human players meaning virtually no performance penalty there. In fact the performance of this appears to be decent.

    The bad part about this design is that you can figure out that the expensive units comes from city 1-5 and then you charge city 13 knowing that they can't make new good soldiers with the resources in the cities in that area. I'm not sure what to do about that without spending too much CPU time on this issue.

    That solves half the problem. The other half is the fact that all of a sudden I was missing my ship for 2*travel distance+travel distance to spice route access. This meant the ship around my cities were ready for manual transports in any city within 2 turns all of a sudden needed 7 turns to go to the city I wanted it to go to manually. Imagine I had to move troops due to an invasion or something like that.
     
  7. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,707
    Location:
    UK
    Ah man!! A bunch of saracen raiders arrived right before I was about to buy up a load of weapons and armour and get a load of peasant to make a defensive army!!
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    They wipe you out?:eek: That's ma boys:goodjob: You have to be quick, they start to show up in the Viking Age.
     
  9. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,707
    Location:
    UK
  10. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Grrr:p

    You can't get lax in M:C. You have to start building defensive early and training your soldiers. You should stock pile Tools as well, as Tools are used to form the early military units. Tools are easily traded with the locals. This is the Dark Ages you know:viking:
     
  11. Lib.Spi't

    Lib.Spi't Overlord of the Wasteland

    Joined:
    Feb 12, 2009
    Messages:
    3,707
    Location:
    UK
    yeah, I did a bit better the second time through, but they got my ships so I am desperately trying to trade up enough money in the tribes and fair to afford kogges...

    I also just figured out how archers work...

    The other thing that I really have to remember is I don't need weapons, as archers can use tools.
     
  12. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Our new friend, ethernidee, sent me a PM about the M:C mod. I moved the convo here to keep up with it better.

    Yeah, there are a bunch more that simply download and never make a post. That is why we really appreciate your feedback and comments.

    I played the original too, loved it as well, and that is what brought me here. I don't recall in the orginal that the player was the only one who could get Fathers? How did they balance that? If the player was the only one allowed to have FF's in the new game, gaining FF's would become redundant and no strategy in it, plus the player would have a great advantage. Are you sure this is what you would like?


    For some reason barbarian land purchase cost seemed quite larger than vanilla, so I am going to check into this. I don't know if that would make them more mad at you. Anyway, one thing about M:C is depending on your starting location and proximity to Saracens and Marauders you could really have have a hard time. That's the randomness of M:C and the randomness of the times.

    I need to better explain, in tutorial perhaps, about how some Professions could require the Unit to be trained first. The capturing peddlers is fixed in the development version as this was not an intended result.

    Animals are not really there for combat purposes they are there as an alternative means to gain Luxury food. While some peasants had to fear wolves and such most times the wild life was not a threat. They will attack lone travelers at times though.

    Tools are always good to buy as the early professions can use them for defense. What exactly do you mean by remembering what goods each village needs? The players village or the barbarian villages? Barbarians buy finished goods like Coats and Wine, and they will show an icon of what the desire most. Concerning the raider ships, perhaps their strength is a bit much?
    This would be an easy fix in the DLL, but you are the only one I have ever heard make this request. I wouldn't mind making a special DLL just for you though :)

    The Git version contains a fully compiled DLL and as well as the source code. All you need is the Art, Sound, and such files. There are a few extra Art files to download in the Art download thread.

    Yeah, I should make sure the Peddlers don't attempt to trade in times or war or dangerous situations.

    This aspect is still setup same as vanilla. They require the player to trade to them Armor and Weapons, but this part will assuredly be adjusted and Barbarians or better put Minor Civs, will advance themselves but at a slower pace.

    Barbarians use Food to produce new Units. I think this is set it UnitInfos.xml under the UNIT_BRAVE.

    Yep, that's me. Not an expert but I have come a long way:)

    Thanks again for your feedback. If you can manage to set up the Git version you can help test out the Dev version. Look in the download section for instructions. We have a few branches going at the moment, like the new Civic Screen is in its own branch but we have a merge coming in a few days to merge all back into the master.

    Edit: Concerning Animals, the current setup allows for unbalanced animal placement. You could wined up having 25 polar bears on a map in the Pole areas and no dears and such. This has been address in an updated version.
     
  13. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    I don't see ethernidee posting here, yet Kailric speak with him. Kailric sure is older than I thought :old:

    As for disallowing founding fathers for AI: how about being able to pick founding fathers even if other civs already have that one? It would solve the issue regarding bonuses for compensating the lack of FF and it will prevent the AI from taking somebody you want. It goes without saying that it should be a game option.

    Land price:
    The game calculates the price based on a number of factors. One of them (I think) is potential yield production. If plots are too good, then the price will go really high. I haven't looked much at this part of the code, but we should be able to balance it if we want (which I assume we will eventually).
     
  14. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Yeah, I wrote most of that twice because I left it on my Mac, when I got back my Mac had died and for some reason erased my original post I was working on. Anyway, in my orginal post I said something like...
    How about if the AI has your FF you can use a Envoy Profession Unit to get him to join your side, at a cost of course :D

    Yeah, I compared vanilla Land prices with M:C and M:C is way way higher, even at the onset of a game. So before I start another session I am going to fix this issue.
     
  15. ethernidee

    ethernidee Chieftain

    Joined:
    Apr 24, 2014
    Messages:
    23
    -) Game target is not to make Human and AI equal. That would have no sense. It's human who enjoy and who runs the game (rides the history). AI should make game challenging and lose gracefully.
    -) AI can be perfectly balanced with output production coefficients, amount of starting gold and units, prices in Europe, etc.
    -) Original game didn't allow AI to provoke independence or join founding fathers.
    -) Original game allowed Human to take all founding fathers to Congress and still each European country was quite powerful enemy producing dragoons and canons, privateers and frigates. It was risky to declare war against two countries at once. AI simply did what he is intended for: building colonies, forts, fortresses, improving economy, occupying your territory during wars.
    -) In original game you could fortify unit within 1 turn and get +50% defense bonus. So you first used to occupy a plot, then fortify and actually remove the plot from colony production. That's was a siege.
    -) In original game you could produce all kinds of goods yourself.
    -) In original game you first decided the path to play (warrior, trader, religion man), considered new ideas and ways of organizing your colonies in chains, then realized your dream. You didn't compete with AI for founding fathers or independence time. There was no time limit.

    The idea has been totally screwed in Civ4: Colonization. Just one more note. How could hammers be converted into religion/political/battle points for Founding Fathers? Hammers made of trees! Seems like a dirty patch for weak mechanics.

    I played DOS version many times and have it now. If there is a way to make modern Colonization function more or less as the classic one did, I would be happy.

    Up to 11000 per tile. I have 30-50 usually )

    Seems not. I started on the hardest level now. Animals and bandits are just food, sometimes noisy food, but not a danger at all. Same with natives. After you made 2-3 archers ) But the speed of research and town growing is low, yep.

    What was devastating are the ambushes. Once I just lost veteran archer because of moving to rock. Save/load heals such cases. Random damage perhaps is not so funny in economic game, especially when you have ability to train units like in RPG.

    On my third play I bought hides and tools before declaring war ))) So you're right.

    Perhaps I didn't notice such icons. One village needed weapons, the other one tools, etc. I tried to sell grapes and wheel and mostly got "no need" reply. Still I don't know how natives calculate reasonable prices. How these prices are connected to local prices. Maybe there is a range or formula.

    2-3 raiders here and there, about 4 total. To start trading I need to have a powerful naval fleet with 6 powers each ship at least. Otherwise there is no interest in sea paths. It's much safer and faster to deal with local buyers. If human can construct guarding vessels more or less fast, it's ok.

    Quite reasonable. My first rule is to never sell arms to natives. Once the French did it in Civ4: Col and I spent about 50-80 turns before I could wipe out an aggressive village with 3 power per unit and +95% attack bonuses :)

    If this aspect can be controlled via XML or does not require too much code (so I could make changes and compile myself without spending a day or two on investigations) please point me out to sources to look at. That would be very kind of you.

    Fair solution. Same principal is applied to inventions and buildings. If one did it, you can do it too. Perhaps, later in game but still.

    Thank you for replies, guys.
     
  16. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    There is a time limit in the original colonization. However it is so far into the future that it is actually quite hard not to have won or lost long before that. The same goes for the first civilization btw. If you don't like the time limit, you can make a custom game and disable whatever victory condition you want. I usually disable time as I too find the game to be too short.

    It's a very valid point regarding converting hammers into crosses and stuff. I never really though about disabling those, but I don't think it would be that hard to do. The question is what to do with overflowing hammers. Another question would be if it should be optionally turned off. Also the really easy solution is just not to use it :lol:

    You can still siege cities. Plots can't be worked if there is an enemy unit present on them.

    AI is something which needs some work, but it is my impression that the majority of people want the AI to do the same as humans. I don't think it would be hard to make a game option to disable gaining FF and stuff like that, but I wonder what it would do to game balance.

    Animals used to be really hard as they kept coming in way too high numbers. Now they are so rare that it is way too hard to collect enough luxury food to gain even a single page through hunting. There is a serious balance issue there.

    The goal of Medieval Conquest has never been to mimic colonization. TAC was made as "what civ4:col should have been like". It still isn't what you ask for though.

    Don't get me wrong. I too would like the original colonization with a new engine, but it is a rather big task to make it and I don't have that kind of time on top of coding M:C.
     
  17. ethernidee

    ethernidee Chieftain

    Joined:
    Apr 24, 2014
    Messages:
    23
    I don't ask you to do anything that requires 10+ lines of code. Perhaps, I should download the sources and study them myself in the future. It should not be hard to allow reusing FF for everybody and at least temporarily enable spice growing for humans.
     
  18. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,354
    I want to make the FF option available to the player in XML, or better yet: game options. I just need to find the time to look into it.

    Everything regarding spices will have to be XML only. Before the source code became modder friendly, it hardcoded a bunch of yields. Last year we decided to move all those decisions to XML. A few decisions should still be hardcoded for performance reasons, but then the hardcoding should be moved to yield specific files. The moving work is almost complete, but 4-5 yields still has hardcoded meanings, which shouldn't be hardcoded. Looks like spices is one of them. This mean the decision will be in XML eventually. It's just a question of when it will move.

    Vanilla special rules for some yields, like food will remain hardcoded and they aren't in the count.
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,095
    Location:
    Marooned, Y'isrumgone
    Yeah, Animals and Bandits are not changed by difficulty. This is on the to do list.

    Ambushes? You mean the ones from exploring Ancient Ruins? There shouldn't be any other ambushes I know of. Hmm, maybe this is from Bandits and Marauders going into hiding for a time? I don't remember if I added that or not but I was going too.

    Native prices are all set in the Yields.xml. They will take just about any finished good, but the one in the Village Icon is their desired yield and they will give you more gold for that yield.

    Well, again, there is only one Civ at the moment that even produces Saracen and they only start during the Viking Age, so just depends on your proximity to a Saracen base. By the way, Saracen can move all terrain and will change to a Raider ship when moving across water. I plan to add Magyar and Viking invaders as well for a really historic difficult time, all moddable of course:D

    I am one of those people. I like a really good change and also a really good AI that makes you think you are playing against a real player. Also, the more life like AI is the more immerse the game can be.

    Yeah, they were devastating. They would even conquer whole villages and cause the game to crash when the poor animals tried to setup their city administration :lol:

    I think the balance of animals should be better with my latest pushes. Like I mentioned in another thread the Polar Bears kept spawning in the pole regions taking up an "animal slot" but never migrating south to be killed, so I hopefully adjusted this.

    Exactly, this is a very different game altogether so start thinking outside the box ;)

    Yes, it would be a very simple addition. All you need to do is add the red code in CvTeam.cpp:

    Code:
    void CvTeam::changeFatherPoints(FatherPointTypes ePointType, int iChange)
    {
    	FAssert((ePointType >= 0) && (ePointType < GC.getNumFatherPointInfos()));
    
    	if (iChange != 0)
    	{
    		if (hasColonialPlayer() [COLOR="DarkRed"]&& isHuman()[/COLOR])
    		{
    That is a simple solution, there are more complex ones that you can do that turns this off in the XML.
     
  20. ethernidee

    ethernidee Chieftain

    Joined:
    Apr 24, 2014
    Messages:
    23
    Right, it seems like invisible unit attacked you when you moved to plot (no visible battle process). Didn't know that hidden units exist.

    Now I see. I was able to kill 2 ships at once by ruining the village where they moved the previous turn :)

    There is possibly a map or array holding fathers assigned to players. To allow AI and Human reuse the same father I would probably need to allocate a map per each player and store/load this info in saved game too. Anyway, thanks for info.
     

Share This Page