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

Advanced Civ

Discussion in 'Civ4 - Modpacks' started by f1rpo, Apr 16, 2017.

  1. Montezuma12

    Montezuma12 Chieftain

    Joined:
    Apr 13, 2014
    Messages:
    14
    Hey, just a random bug. When i found a religion, the game then makes me found all remaining religions in the same city. Happens with both the 18 and 50 civ DLL. Took me a surprising number of games to realise this was happening.
     
  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    @Montezuma12: As a quick test, I've started a game, gave myself 4 Settlers through WorldBuilder and then beelined to Meditation, Polytheism and Monotheism. Got three different holy cities. Any special settings?

    @xyx: Thanks. The savegames are working, even with my development version – Mansa Musa does cancel the deal. (If these saves are from a mod-mod, then the changes must be subtle.) The resource density is quite high in some parts of the map. I don't think that's my doing; if anything, my changes (id 129) should result in fewer clusters. But Totestra has its own BonusPlacer ("bp" in the snippet below) and, I think, bypasses CvMapGenerator.cpp entirely:
    Code:
    def addBonuses():
        bp.AddBonuses()
        return
    Same with the StartingPlotFinder:
    Code:
    def assignStartingPlots():
        # ...
        spf.SetStartingPlots()
    I did change the calculation of how many civs should start on a given landmass (id 027 and –merged from Kek-Mod– dlph.35).

    Will have to get back to you tomorrow or so about the other questions; and I'll look into Mansa Musa's cancel decision in the debugger.
     
  3. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    20
    Sorry, wasn't clear about it. This is plain AdvCiv (pangea map) and heavy WB use to be able to initiate many trades, so as to provoke the trading issue happening. The resource density is thus just because I added a ridiculous number of resources.

    The starting location thing is probably totestra related, sorry to bother you.
     
  4. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    Ah, that's good. I was thinking, with 20 resource trades, cancellation must be really constant and annoying. :lol: Thanks for the assistance then. It turns out that there was actually a bug: In one of the cancellation checks, I had mixed up the two sides of the trade. This had had the strange effect of canceling a deal when the giving side had more than two copies of the traded resource (i.e. at least 3 copies in total). Glad to have that fixed. I've also added some logging code to make the remaining problems with canceled trades easier to diagnose.
    The AI computes a war utility value for itself and for the other side. That's also the case in BtS (CvTeamAI::AI_endWarVal), but BtS end-war values are always positive; they don't indicate if the war is ultimately worth continuing, and really only the difference between both sides' values is meaningful.

    The AdvCiv AI does have a notion of whether a war is worth fighting (war utility greater than 0 or not) and may decide to continue despite negative war utility if the other side's war utility value is is even smaller (more negative) – in hopes of getting paid for peace. This doesn't apply if the other side doesn't have anything to give, and also, if the other side refuses to pay, the winning side will eventually stop insisting on payment. (For reference, here's the code for human-AI peace: WarAndPeaceAgent.cpp#L1549 and for AI-AI peace: WarAndPeaceAgent.cpp#L631)
    I'm not sure either. The trade screen is hidden away in the EXE, so I had assumed that this is out of my hands and can also happen in BtS. But, now that you mention it, I suspect that an AdvCiv change in CvPlayer::buildTradeTable is responsible. I'm excluding "you-must-be-joking" resources there (to unclutter the trade table). So I guess the empty table would happen when the AI gains "native" access to the previously imported resource. If that's how it works, then I can fix it the next time I see it happen.
    Edit (Saturday): Verified. Was actually easy to test. Will fix.
     
    Last edited: Jul 13, 2019
  5. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    20
    great, thank you!
     
  6. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    20
    Here is a screenshot of the rather common issue with the AI placing a heavy weight on foreign units in own territory during peace evaluation.

    Spoiler :




    I (red) am at war with green and orange, brown is my vassal. I just conquered three major cities of orange. Orange has just one city left (Nijmwegen). I have some stacks of 40+ units inside and close to the border of green. Powerwise, I am about twice as strong as green. Now, I would expect orange to beg for peace. Instead, orange demands electricity (a fairly expensive tech at that time).

    As I said, I don't think that this is sensible. I also thought about the reparations thing, but historically it is typically the winner who demands reparations, rather then the loser.
     
  7. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    @xyx: That's a nice example. I hope that the tweak to the war utility computation that I have in mind (factor in the abstract possibility of a later invasion) is going to make orange accept a square peace treaty in such a situation. At least Willem shouldn't be so stubborn as far as personality is concerned.

    There's probably another quirk of the AI at work here that I hadn't thought of when I wrote my earlier replies: Civs are assumed to go after one war enemy at a time. Of course, green is going to be your primary target here, so orange has nothing to worry about until you put land units in their borders or (maybe) conquer an adjacent city.

    Electricity: Perhaps you have no cheaper tech that the AI could demand. That said, whatever gold you have is apparently not considered sufficient payment by the AI. (Not quite sure right now, but I think gold is considered before tech when the AI makes a peace offer.)
    Though peace without payment by either side was not uncommon I reckon, especially when it's a separate peace that allows the winning side to focus its efforts on the remaining war parties and lets the winner keep all the conquered land.
     
  8. Montezuma12

    Montezuma12 Chieftain

    Joined:
    Apr 13, 2014
    Messages:
    14
    Hey, as far as the religion thing is concerned, I usually play with choose religions, no tech trading and no vassal states as my settings. Alternatively, I play rise and fall with raging barbarians and choose religions.
    Could one of those be the culprit? I suppose choose religion is the only common setting so I should try with that off first.
     
  9. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    :cringe:
    I had meant to :shake: try it with that option too but then took another look at the foundReligion function and thought it really can't make a difference. Which is true — the actual error is in my code for killing redundant popups. The choose-religion popup triggers a change-religion popup and, in trying to kill any excess change-religion popups, my code ends up relaunching the choose-religion popup that is still being processed. Will be fixed in v0.96, i.e. soon. It seems that all my earlier tests with Choose Religions were on AI Auto Play (no popup then).
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    oh no.....
    v 096 is up :)

    so much work i have with it now....hehe :crazyeye:

    kidding, thanks for the update my friend.
    i guess ill bug you soon ...
     
    f1rpo likes this.
  11. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    by the way,

    what solution did you come up with to the worker thing you told me about?
     
  12. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    I made a bunch of changes (Git commit), however, with those particular settings – Modern-era start, Archipelago, Tropical climate – some AI civs still train and scrap too many workers. It's tough because a new city on a small jungle-covered continent with free initial population from the start era immediately needs a high number of workers, and, 20 turns later, when the city is fully improved, that continent will have far too many. Also, in the Modern era, cities can produce new workers very quickly if the AI thinks that a continent has too few; much faster than Transports can ferry them. When Transports do arrive, they may carry 4 or 5 workers at once.

    I've just run 150 turns on AI Auto Play with these settings (and Prince difficulty) in unmodded BtS (well, just the Auto Play mod) and K-Mod for a comparison; screenshots attached. K-Mod looks the worst (Augustus has deleted 84 workers), but at least the K-Mod AI manages to clear the jungle (and wins a Space victory shortly before the 150 turns are up), whereas BtS ... see BtS2.jpg. :sleep:
    AdvCiv still deletes 28 workers (and doesn't win as quickly because tech costs are higher). The changes I've made seem to be working as intended, but the benefits in terms of saved workers aren't that great. I guess the AI would have to produce some more Transports for civilian purposes (UNITAI_SETTLER_SEA).

    Anyway, never deleting a worker may well be suboptimal on this map. If 20 more are deleted than necessary, then the wasted production is equivalent to the cost of the Pentagon – not such a big deal. Note that the screenshots show the civ with the highest number of deleted workers in the game; most delete only a few (also in BtS and K-Mod). My improvements should also help the AI on less exotic maps. One small change I've added to my list of bugfixes that other mods could adopt.
     

    Attached Files:

  13. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    cool research youve made on the subject.
    i guess there are many factors to take in the worker logic.

    bts...darn its bad.
    im sure that in time along with more live plays, your code will evolve, im sure.

    i actually like civ6 approach to workers, limited use, then they die. maybe such idea could be nice to civ 4, thought, probably some ai work is needed.

    nice that you collected the fixes for other mods.



    gonna start my merge soon , and i await my game with it.
     
  14. Drakarska

    Drakarska Epic Dadness

    Joined:
    Jan 4, 2010
    Messages:
    2,542
    Location:
    Twilight Zone
    Ermm, Kel, lol, VIP mod and C2C mod both use limited workers. Pretty much since the inception of their respective mods :)
     
  15. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    Drakaska,
    hey,

    well, all depends on AI usage. if limited ai can get stuck or do crazy stuff.
    f1rpo does quite deep research on AI behavior.
    i know many have written worker AI, i now that dune wars also did some work there,
    but, i will always trust kmods based mods and today advciv to be the best of them all , stable in both single and MP.

    :)
     
  16. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    :love: karadoc has made a great number of high-quality changes especially to small-scale AI behavior. Obviously I appreciate his work very much. As for Caveman2Cosmos, I understand that, for a while, the project was short on AI programmers – but, currently, there are several very proficient ones with some ambitious plans. Of course they're also facing a much greater challenge than karadoc and I.

    Some rambling about limited workers:
    Spoiler :
    Limited worker charges have been on my wish list for some time. I didn't know that C2C and VIP have this. If I ever implement this, I'll be sure to take a look at their AI code. Mainly, I think, the AI would have to leave workers idle when there is no worthwhile task. A simple way to accomplish that could be to add probability tests to the low-priority worker routines; e.g. build a "territory road" only with a 10% probability. And the workers-available/ workers-needed computations would have to take into account remaining charges.

    I expect that some balance changes will also be necessary. E.g. Forts can't cost so many turns anymore. Jungle should be looked at. Serfdom will be too powerful (extra worker speed plus K-Mod's Farm commerce ability). Switching between improvements gets costlier, which is good as that reduces micromanagement; but not so good when it locks players e.g. in Caste System because the Workshops are too expensive to replace. And probably some unforeseen repercussions too.

    Some incentive would be needed for depleting workers. Otherwise, players may keep almost depleted workers around for scouting, holding up an enemy unit for a turn or just in case that something needs to be built extra fast. Imp. Knoedel's LoR mod-mod (link) allows sacrificing workers to grow Cottages for example (implemented all through XML as far as I know). I was thinking of a simple production "refund" to the nearest city, like chopping. E.g. 50 charges and 10 production upon depletion (or deletion). To discourage scouting with workers, every turn spent outside of a city should consume a charge. Each worker turn would then effectively cost 1 production (or food) and a worker would normally live for 50 turns, resulting in 8 generations of workers if the game goes until turn 400. That might be a bit much (too few charges that is).

    A refund alone (i.e. unlimited charges) would already help against worker underemployment, which is the main problem I'd like to solve. Finding tasks for workers when there is nothing important to do is a terrible drag. So such a mechanism could also be a (cheap) alternative to limited worker charges.

    In the larger scheme of things, I dislike that whole fiddly principle that every action on the map needs to be carried out by a unit. At least Civ 4 is pretty consistent about it, but I wish Civ 5 had already abandoned that entirely and taken the workers, spies, GP and missionaries off the map.
     
  17. Drakarska

    Drakarska Epic Dadness

    Joined:
    Jan 4, 2010
    Messages:
    2,542
    Location:
    Twilight Zone
    The way VIP mod does it, is that the worker depletes after a certain construction happens. I.E. Worker builds a cottage, then the worker is used up. This puzzled me for a few as to the mechanics, then I realized I needed to build a route 1st, then the improvement before the worker vanished.
    In C2C, the mechanics are similar in the Neo Era, build a path 1st, then the improvement. Although, I believe once you hit the Ancient Era, workers revert back to normal mechanics. I actually like the idea of workers as a depleting resource, as it gives workers more value in game. Not to mention build priority and protection of a now very valued asset.
     
  18. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,519
    Location:
    israel
    In the xml,
    It is definiable via a kill tag,
    Building this kills worker.
     
  19. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    511
    Location:
    Germany
    I see, like a Workboat. Doing that only for some special build (e.g. a Village without having to go through Cottage and Hamlet) is an interesting consideration, especially for any XML-only mod. Having to use single-charge workers for nearly everything doesn't sound as appealing to me. Though It may well work in C2C along with other major changes.

    On a different note, quoting/ linking my own post from a month ago for reference:
    I've gone ahead and (re-)implemented the defender randomization module. GitHub link
    This is strictly for the combat modpack that @devolution and I had been discussing – not for AdvCiv, or at least not any time soon.
    (I'm not expecting devolution to respond to this. He let me know a while ago that he has a full plate of more serious matters to deal with for the time being.)
     
  20. Montezuma12

    Montezuma12 Chieftain

    Joined:
    Apr 13, 2014
    Messages:
    14
    Hey, is there a reason that when I change improvement yields after techs are discovered (e.g. astronomy gives fishing boats +1 commerce), that would crash the game on launch? Apparently it doesnt match the "improvement info".
    Definitely adding it the exact same way that other tech changes are done (eg chemistry +1 hammer to workshops)
    If this is too unrelated, happy to move the post somewhere else.
     

Share This Page