LoR SDK ModMod - Dynamic Difficulty, Better AI and More!

I’ll consider making defender withdrawal optional via an XML setting in the next release. I understand it’s not to everyone's taste. You say you like the concept but not the execution, what do you mean by that? How else could it work?

Like when the defender withdraws, my attacker would fight against the next top defender it seems, so I ended up losing a lot more 99% fights. IMHO if the defender withdraws, the attacker should as well.
That's doesn't sound possible. Each AA unit can only intercept once per turn, so they must have had at least 20 AA units to intercept your 20 bombers.

Even if they did have 20 AA units, the stacking effect of the chance to intercept only counts units that haven't already intercepted, so the chance to intercept decreases the more bombers that have already been intercepted. Also, bombers have a 15% chance to evade interception regardless. To have all 20 bombers intercepted would be quite unlucky.

In general though, if the AI has lots of AA units in a city then it's not usually a good idea to bomb it anymore. The point of the stacking code was to make AA units a worthwhile defense against this, so you will have to use other tactics. Try sending more ground forces and artillery instead, or bombarding from the sea if possible. The jet/stealth bombers can be more useful here since they have higher evasion chances. If you do decide to bomb a city with a lot of AA units, expect a high intercept rate, it's best to do all the bombing in one turn right before you attack to make it worthwhile.

I think he had destroyers and machine guns too, but I didn't count those.

The problem I see is AA is too good compared to fighters, since you can pile an unlimited amount per city as opposed to 8 fighters, and fighters take damage and can be shot down, AAs take no damage from interception and defends against ground units too.

P.S. another thing I noticed is I can build both ironclad cruiser and destroyer escort at the same time. Previously the latter obsoletes the former
 
Like when the defender withdraws, my attacker would fight against the next top defender it seems, so I ended up losing a lot more 99% fights. IMHO if the defender withdraws, the attacker should as well.

Looks like they had the same discussion on the thread for the original Mod-comp, the creator said it was realistic as these sort of tactics would have been used by armies at the time. I do like the way at works at the moment, I don't mind losing a few 99% odds fights due to the defender withdrawing I think it adds more of an element of risk. But if I make it optional then at least you can turn it off.

I think he had destroyers and machine guns too, but I didn't count those.

Ah ok, all ground and sea units with a chance to intercept have their chances stack.

The problem I see is AA is too good compared to fighters, since you can pile an unlimited amount per city as opposed to 8 fighters, and fighters take damage and can be shot down, AAs take no damage from interception and defends against ground units too.

Fighters do still have the advantage of covering a wide area and being able to intercept many times, and of course they can be used on the offensive too. AAs are better now, but can only defend a small area, even if a city is well defended you could still attack units outside the city, or you can bomb their improvements to remove their access to oil for example or try and sink their ships. Plus AA units are generally weaker than other ground units if they do have to fight them.

Overall I don't think AA units are now too strong. It never made sense to me that a whole stack of AA units still only had a 40% chance to intercept, no matter how many of them there were, for me the AA stacking code just makes sense. I had thought about making it so they could take damage when intercepting too to balance things out a bit, but I don't think air units should be able to kill ground units (unless they have an AirCombatLimit of 100% like the UCAV), and without being able to kill I don't think it would make that much of a difference for them to just be damaged anyway.

P.S. another thing I noticed is I can build both ironclad cruiser and destroyer escort at the same time. Previously the latter obsoletes the former

This is an intentional change, I describe it in the original post:

If a unit upgrades to another unit that requires a "non-core" building, the old unit is still build able in the city. Non core buildings are ones that would not be provided for free if you started the game in the future era. For example, cities with universities can now build paratroopers as well as special forces, rather than just special forces.

I made the change because I often wanted the option of building some obsolete units alongside the more advanced ones, and the more advanced ones generally require advanced buildings like drydocks, industrial parks, universities or labs. The XML could still be changed to force ironclad cruiser to become obsolete when the destroyer escort becomes available using the ForceObsoleteUnitClasses tag, so there is some flexibility for future modding. I may release a modified UnitInfos xml file in a later release. But I don't see the option of being able to build those particular two units together as a problem.
 
Report from my last game:
Dynamic difficulty seemed to prevent me to become dominant too early, however, the game was over in the early medieval (marathon on a tiny or small map).
I noticed the adjacent tile control feature once, and it felt very fitting.
I also got some compiler warnings, most noticable

1>CvPlayer.cpp(12945): warning C4551: function call missing argument list
(You forgot the parenthesis after a function call) and
1>cvteamai.cpp(2844): warning C4715: 'CvTeamAI::AI_anyMemberNukeReady' : not all control paths return a value

You'll get the others when recompiling.

Thanks for your work.
 
Report from my last game:
Dynamic difficulty seemed to prevent me to become dominant too early, however, the game was over in the early medieval (marathon on a tiny or small map).

OK, I was worried of the opposite that the effect might be too strong. Perhaps I should make it configurable somehow. It's harder to get the balance right on smaller maps I think since the situation can change quicker. I'm also going to add a few more AI improvements, so hopefully this will help keep things challenging.

I also got some compiler warnings

Yeah I'll sort those out for the next version. There were already some warnings I think but I can at least get rid of the ones I have introduced.
 
I hope Dave UK continues to make the final improvements or stabilization or whatever on this. It is my favorite Civ IV mod. Thanks!
 
@Dave_uk
Sry for the necro.
I just have to say, this is a fantastic modmod, congrats :king:
Which is a huge accomplishement, considering LoR is already awesome :)
Can't believe I didn't find it earlier!
 
@Dave_uk
Sry for the necro.
I just have to say, this is a fantastic modmod, congrats :king:
Which is a huge accomplishement, considering LoR is already awesome :)
Can't believe I didn't find it earlier!

LoR is for me the best base mod to develop on because not only it is a great mod, but also because it has a great Multiplayer. I played LoR MP for years (roughly from 2010 to 2014), and had many great Multiplayer games (with Simultaneous Turns) with a few OOSs (mind I liked to play on the biggest map setting and on Marathon speed, which are prone to more OOSs then other configurations).

I've never tried this modmod, but after playing C2C I'm much more inclined to make that mod playable in MP, then trying to upgrade LoR.
 
Soooo is this for 0.9.9b or the 1.0 version that allegedly is around somewhere?
 
This is for 0.9.9b, I don't think a version 1.0 of LoR was ever released. Pleased to see this forum is active and people still use this ModMod, I still play it and make improvements every now and then so I hope to release a new version soon.
 
Have you considered merging the Balance Tweaks Mod that's also in this forum? I tried my hand at it but SDK modding is hard and confusing. :(
 
Hey new version is up, it should be considered in BETA (needs testing), so I've left the old version up too.

Regarding the Balance Tweaks Mod, the XML and Python changes should be compatible with my SDK changes if you want them to use them together. As for the SDK changes, which do you think I should incorporate? The only change that really interested me was the culture not disappearing when a civ was eliminated, but I seem to remember testing it and finding it didn't have the effect I thought it would - it didn't actually make revolutions more likely as they only changed a few functions and there were still cases were the culture of dead civilizations was being ignored.
 
Last edited:
Excellent, Dave uk! I really appreciate all of your work. I will give you some feedback soon!
 
Can someone give me advice or instruction on installing this mod? I have the latest version of LOR and would love to enhance it with the LOR SDK ModMod. Thanks!
 
Hey Dave!

Thanks for reviving this little gem :goodjob:
It seems that I'm late to the party, I 'm having a hard time grasping why I didn't discover LoR earlier :cry: I

Now, let's get down to business:

I am in the process of making yet another submod based on K-Mod, but I now realize that there's so much content in LoR that I simply cannot resist an attempt at basing my mod on LoR instead.
As of now, it's mostly XML balance stuff, but also some new SDK features. I was wondering if you could make your latest code available somehow (github etc) so that we could maybe share some of the code or even collaborate. I am primarily an AI guy, so that would be my focus since I am planning to make some pretty significant changes to the combat system (I'd rather cut features that the AI cannot use rather than introduce features that it uses poorly). I'm also strongly considering importing features from AdvancedCiv (another K-mod submod) since it has many improvements, in particular to the diplomatic AI, and it seems to continue where K-Mod ended (Although Karadoc recently released a preview of K-Mod 1.46)
 
Last edited:
Hello,

I tried installing this and running the 300 BC scenario as the Qi and got a crash. Any idea why? I have the crash dump if that would help. Windows 11, Lenovo T490s, latest version of BTS installed, base LOR ran fine.

Any help is appreciated!
 
I happen to have this mod installed (with the Knoedelicious XML changes on top), so I gave it a try and got a Python crash (not a crash to desktop) with the stack trace indicating that CvPlayer::initCity (in the DLL) crashes when it attempts to initialize any city for the human player. So I bit the bullet and compiled a debug DLL, and that gave me a division by 0 in this block of code in CvCity::calculateColonyMaintenanceTimes100:
Spoiler :
Code:
    //iNumCitiesPercent *= GC.getHandicapInfo(getHandicapType()).getColonyMaintenancePercent();
    //CD Tweaks - Dynamic Difficulty
    int iColonyMaintenancePercent = GC.getHandicapInfo(getHandicapType()).getColonyMaintenancePercent();
    if (GC.getDefineINT("DYNAMIC_DIFFICULTY") != 0 && GET_PLAYER(getOwnerINLINE()).isHuman() && GC.getGameINLINE().getPlayerRank(getOwnerINLINE()) == 0)
    {
        int iScore = GC.getGameINLINE().getPlayerScore(getOwnerINLINE());
        int iNextBestScore = GC.getGameINLINE().getPlayerScore(GC.getGameINLINE().getRankPlayer(1));
        int iLimit = std::min(150,iColonyMaintenancePercent + 30); //limit to 3 difficulty levels up, but no more than 150% (deity)
        iColonyMaintenancePercent *= iScore;
        iColonyMaintenancePercent /= iNextBestScore;
        iColonyMaintenancePercent = std::min(iColonyMaintenancePercent, iLimit);
    }
    iNumCitiesPercent *= iColonyMaintenancePercent;
    //CD Tweak end
Scores are still 0 at this point. Straightforward fix is to use:
Code:
    iColonyMaintenancePercent *= std::max(1, iScore);
    iColonyMaintenancePercent /= std::max(1, iNextBestScore);
I'm attaching a DLL with this bugfix. I've used a more recent project setup for compiling; hopefully I didn't muck anything up when I plugged that in. Might be safer to stick with dave_uk's DLL and to just disable DYNAMIC_DIFFICULTY in GlobalDefinesAlt.xml.

edit: Also attaching my project setup. Local paths need to be set in Makefile.settings.
 

Attachments

  • CvGameCoreDLL.zip
    1.9 MB · Views: 21
  • project_and_source.zip
    2.8 MB · Views: 14
Last edited:
I have been playing the dave uk modmod, as fighters are too powerful in LoR, and the AI doesn't do well at air combat type stuff.

I have been getting quite a few CTDs, and some hanging, that I didn't get on LoR. It might be because I'm playing on a larger than huge earth map(GEM).

It seems like the AI is different. I play with unrestricted leaders and have Ragnar as Japan. On the map Japan has so many resources, he's building a lot of wonders and wiping out or vassalling his neighbours! When I tried playing as America, when I made it to Europe, it had been half taken over by rebels! In some games even London had been captured by rebels, which didn't ever happen in LoR. The map needs some work possibly.
 
Been playing this solidly every day now, no more crashes or hanging.

The AI is definitely better than standard LoR. They like building wonders and using explorers for combat. I've seen Monty build the Oracle and Napoleon build wonders too.

Still in Classical or Medieval era so looking forward to the nerfing of range bombard in the later game, which is really over powered in LoR.

It"s a shame dave uk isn't active anymore as his mod really adds to LoR playability.
 
I happen to have this mod installed (with the Knoedelicious XML changes on top), so I gave it a try and got a Python crash (not a crash to desktop) with the stack trace indicating that CvPlayer::initCity (in the DLL) crashes when it attempts to initialize any city for the human player. So I bit the bullet and compiled a debug DLL, and that gave me a division by 0 in this block of code in CvCity::calculateColonyMaintenanceTimes100:
Spoiler :
Code:
    //iNumCitiesPercent *= GC.getHandicapInfo(getHandicapType()).getColonyMaintenancePercent();
    //CD Tweaks - Dynamic Difficulty
    int iColonyMaintenancePercent = GC.getHandicapInfo(getHandicapType()).getColonyMaintenancePercent();
    if (GC.getDefineINT("DYNAMIC_DIFFICULTY") != 0 && GET_PLAYER(getOwnerINLINE()).isHuman() && GC.getGameINLINE().getPlayerRank(getOwnerINLINE()) == 0)
    {
        int iScore = GC.getGameINLINE().getPlayerScore(getOwnerINLINE());
        int iNextBestScore = GC.getGameINLINE().getPlayerScore(GC.getGameINLINE().getRankPlayer(1));
        int iLimit = std::min(150,iColonyMaintenancePercent + 30); //limit to 3 difficulty levels up, but no more than 150% (deity)
        iColonyMaintenancePercent *= iScore;
        iColonyMaintenancePercent /= iNextBestScore;
        iColonyMaintenancePercent = std::min(iColonyMaintenancePercent, iLimit);
    }
    iNumCitiesPercent *= iColonyMaintenancePercent;
    //CD Tweak end
Scores are still 0 at this point. Straightforward fix is to use:
Code:
    iColonyMaintenancePercent *= std::max(1, iScore);
    iColonyMaintenancePercent /= std::max(1, iNextBestScore);
I'm attaching a DLL with this bugfix. I've used a more recent project setup for compiling; hopefully I didn't muck anything up when I plugged that in. Might be safer to stick with dave_uk's DLL and to just disable DYNAMIC_DIFFICULTY in GlobalDefinesAlt.xml.
Thank you! I tried but the 300BC map still crashed. I was able to start a normal game though, and its going great so far! Loving this mod! :)
 
Top Bottom