Feature Requests and Discussion

I downloaded the Microsoft 2007 XML editor, and I thought I would start with something easy - just switching Sandalphon from Industrious to Philosophical (I think you agree with me on that change Magister!). I tried just editing the text ''trait_Industrious'' to read ''trait_Philosophical'' and saved, but on start-up even this produced a ton of XML errors. I also tried deleting the Industrious node and copying in the philosophical one from another leader, but this did not work either. I didn't make any other changes. Do you have any clue what I might be doing wrong?
 
I assume that you actually wrote it in all caps in the file rather than like you did here, but if not then case sensitivity may be the problem.


I don't know much about Microsoft 2007 XML editor. It might be changing some formatting stuff. Why not just use a plain text editor like notepad?


I usually either use Notepad++ or else PyScripter. (The later is the program I use to debug python codes, as it finds syntax errors for me without having to launch the game even if it is not so great at catching undefined variables and even if it always claims there is an error in CvUtils.py. It does not have any real advantage over Notepad++, although it is better than normal notepad, but it is more convenient sometimes to have all the modding files open in the same program.)
 
Thanks! For some reason using MS XML editor didn't work, but the same thing in Notepad++ worked perfectly.
 
I was sure I had already posted this minor worldbuilder update back in September, but I don't see it so I'm doing so again.

I have not gotten around to fixing the issues with saving and loading scenarios yet, but won't have time to try until next week.
 

Attachments

  • World Builder 4.17b for MNAI v 2.7Beta5.zip
    1.5 MB · Views: 247
Last edited:
Hey Tholal,

I'd very much appreciate it if you could add in two new Tags to CIV4BuildingsInfos.XML:

- One which allows you to add a required buildings list to any building (In the city, not in the empire like the current vanilla <PrereqBuildingClasses> Tag), i.e. to have building require the presence of other buildings.

- The other Tag should do the opposite, it should prevent construction of a building if another building from the list in the tag is present, i.e. to make it so that only one of a set of buildings can be built in any one city.

It is a bit of dll work but both should be quite simple to write in, at least from my understanding.

Those two are highest on my wish list as I have been modding the Erebus out of Magister's Modmod (which as you would know is based on MNAI) and I suddenly ran into a wall when I found that I couldn't do this. I figured I should go right to the source (pun most definitely intended) since your changes would naturally be reflected there (I assume I can just take a newer .dll from you and replace my current one).

While the two mentioned above are priority there are a few other small .dll edits that would make a massive difference to how much can be done without .dll editing, for example adding the PrereqTrait tag from buildings to units would allow for a lot of interesting things (currently I've managed a work around for this one at least).


Hopefully you get around to checking this sometime soon ^^.
 
I am concerned about performance if those tags are implemented. Whenever the city screen or the choose production popup open, the game will need to check each building that can be constructed against all buildings currently in the game. Doing that every time for every building could get quite expensive quickly. In fact, my attempts of profiling More Naval AI performance left me with the strong suspicion that most of the delays (both when opening windows during your turn, and while waiting for the AI turn) are spent doing loops of checking M existing ingame entities against N CvInfos, and other similar stuff.

There is an alternative, though. You can specify custom building requirements already, via scripting in Python. I don't remember the exact place, but if you look for things like the Infernal only buildings or the Shrine of the Champion in the Python code you should be able to find them easily.
 
Just against the buildings currently the city and only if the tag appears (which it won't often), it is no worse that the existence of the current requires trait or requires bonus tags and it is a lot less strain than the current <PrereqBuildingClasses> which does search the entire empire for buildings, naturally there is no excusing the fact that it would obviously add some load, but I don't think it would be as much as you are worried about.

Other major mod for FfH2 (MoM etc) and major mods like RoM:AND (and all its split offs like Cave2Cos) have have the the feature, though I suppose none of those can exactly be held up as paragons of short end turn times ^^'.

I'll look into those custom building requirements scripts you mentioned, I was hoping I would be able to sort this out via python, but it seemed to me like the kind of thing that would need a .dll change for sure, hopefully I'm wrong on that account.

Thanks for your input, solid help as always Trekhen ^^b


Edit: Well crap, I may very well be soon standing corrected (though I would be quite happy to be doing so), it seems like the code you mentioned (which was in CvGameUtils.py btw) may just have solved this issue and maybe even a separate one I was looking for a work around for ^^!
Still testing if it all actually works, I'll update when I know.

Edit II: I stand completely and most elatedly corrected, this worked like a charm, thank a bunch Terkhen ^^b !

And with that... feel free to completely ignore my previous request then Tholal ^^.
 
Last edited:
I am concerned about performance if those tags are implemented. Whenever the city screen or the choose production popup open, the game will need to check each building that can be constructed against all buildings currently in the game. Doing that every time for every building could get quite expensive quickly. In fact, my attempts of profiling More Naval AI performance left me with the strong suspicion that most of the delays (both when opening windows during your turn, and while waiting for the AI turn) are spent doing loops of checking M existing ingame entities against N CvInfos, and other similar stuff.
I don't see this to be the case if the tag is implemented properly, i.e. not the "bts way" with a array of bools, but with a list/vector of required/blocked buildings. Then it would just cost a bunch of hasBuilding() (or whatever it's called); for buildings without any required buildings it would cost almost nothing - just a check whether the list/vector is empty.

That said, did you ever identify which loops/variables specifically may cause performance problems? There might be some optimization space.

it is a lot less strain than the current <PrereqBuildingClasses> which does search the entire empire for buildings, naturally there is no excusing the fact that it would obviously add some load, but I don't think it would be as much as you are worried about.
You're making a false assumption here. The game doesn't "search the entire empire", but the number of buildings of each type a player has is cached.
 
You're making a false assumption here. The game doesn't "search the entire empire", but the number of buildings of each type a player has is cached.

Ah that makes sense, guess it isn't so bad at all then, thanks for clearing up the misunderstanding there.
 
That said, did you ever identify which loops/variables specifically may cause performance problems? There might be some optimization space.

Hey! There is certainly space for improvements. Everything I am going to say after this paragraph is just part of my initial impressions after profiling the dll for a bit some time ago. I don't believe that this information is enough to act on it: for improving performance we need more accurate tools and test cases so we can check the evidence, and how our changes improve performance.

I plan to port/implement/test them in the future (the notes can be seen at https://bitbucket.org/Terkhen/extramodmod/issues/269/profiling-and-performance-improvements although I plan to apply them in More Naval AI first, not directly in my mod).

Having said that, with my initial comment I meant the huge number of instances in the game code that are similar to CvCity::getBonusHealth, CvCity::isHolyCity or CvPlayer::getProductionModifier just to name a few. These methods have a code that is roughly similar to this:

// I want to know if the current player has a certain trait.
for (int iI = 0; iI < GC.getNumTraitInfos(); iI++)
{
if (hasTrait((TraitTypes)iI))
{
// Do stuff with the trait, now that I found about it.
}
}


The efficiency of this loop is O(N) with N being the total number of traits in the game. If players had an actual list that contain only the TraitTypes that the Leader they are using has, the efficiency would be O(n) with n being the total number of traits that a leader can have.

A single point in the code doing this would not be a problem, but since this is present everywhere, the different loops accumulate very quickly. Edit: As I said I would still need to profile the app and prove it though. After following a similar process, Realism Invictus optimized all of these loops away some years ago.
 
Last edited:
Hey Tholal,

Just a quick question concerning the AI in MNAI, I wanted to know if they consider Revolution Chance changing values when picking what to build, i.e. would they know to build a building that would reduce their local revo chance if that city is likely to revolt? Furthermore would the AI still want to build such a building if it had some negative effects as well, such as negative happiness? I wanted to know for the sake of a modmod (modmodmodmod technically ^^') I am working on based on MNAI.
 
Last edited:
Could you please make it so that promotions can allow units to move through rival territory?
Ideally I'd like to have the ability to have promotions grant either bCanMoveLimitedBorders or bRivalTerritory, but the only thing I really care about at the moment is allowing Hidden/Invisible units to move unseen in rival territory. I'd be happy enough if you just make the <bInvisible> tag for promotions also mark the units as bRivalTerritory. Actually, I'd probably be happiest if their ability to move through rival borders without an agreement only worked when the unit is actually unseen and did not function when a Floating Eye or unit with Perfect Sight had detected their presence.


It seems silly that a limited duration AI or automated unit will often use the "Fortify Unit Healed" option when the time it would need to remain inactive is longer than its duration. Can you block that behavior, so that the AI (particularly players wiht the Summoner trait) will use their summons more effectively?
 
I'd like the unit defeat/loss audio cue to be disabled when a rival's Great General is killed. It's rather unnerving to start a turn with the sound of a unit's defeat and the panic of looking for barbarians roaming about your territory, and seeing the goblins, lizardmen, and skeletons still on their forts/ruins/graveyards because you haven't had a chance to clear them out yet.
The yellow text 'A great general has been killed' is sufficient notice; the audio cue is less than needed.

The other bothersome issue are the auto-cancelling treaties after x turns (embassies, non-aggression pacts, open borders, vassalage, resource trades). That leaves reestablishing alliances a multi-turn affair -- full open borders get auto-cancelled, then embassies and rights of passage need to be restored, allowing non-aggression pacts and open borders, and defensive pacts to be restored the following turn. The treaties that should expire automatically after x turns are cease fires, peace treaties, and tributes; the others should be manually cancelled (and the AI is generally good at doing that if you're not their best friend).
 
The other bothersome issue are the auto-cancelling treaties after x turns (embassies, non-aggression pacts, open borders, vassalage, resource trades).

What version are you playing?
There was a bug that caused deals to auto-cancel after 20 turns, but it should be fixed in MNAI v2.71.
 
the impact of looting structures is slightly too impactful. Especially in multiplayer games you can try to loot some graveyard near the enemy capital just to kill that civilization outright when 3 savages appear on turn 20.
Additionally I feel there are not enough animals roaming around in standard settings.
 
I agree. That's why I added code to my installation that made it so you can't explore lair until you have at least 3 cities. It has drastically cut down on the number of times I see a civ dieing near the beginning of the game. It does lead to some strange behavior with the AI stacking troops on top of structures sometimes though. I also made it so you can only explore lair in your or neutral territory. That's mostly to stop scouts from destroying lairs I'm using to farm xp.
 
Hi guys, I have to ask, does this mod work for Fall Further or Rise from Erebus? And if it doesn't, is it necessary?

I prefer having more civs/features but I despise the AI present in vanilla FFH2, so if the AI is terrible in the modmods I prefer using this mod with vanilla FFH2.

Thanks for your time.
 
MNAI is it's own standalone mod so if you wanted to merge them then you would have to edit a fair bit of code to make that work. Most of the changes in MNAI do preserve the spirit of FFH2 so it's probably the closest to it of all the modmods but it does have some new features and certainly a better AI. AFAIK both Fall Further and Rise from Erebus are no longer being developed though there are some modmods of those that are being worked on or have stable final releases. There are also modmods of MNAI that are pretty good too that you might want to consider.
 
Top Bottom