Quick Modding Questions Thread

Thank you - I don't currently have a late game save to check; do you have a suggestion for what I should add to the AIWeight to simply get it to make more fighters and bombers without it getting bad for gameplay? A human player can decimate essentially any AI simply w air superiority late game and Im looking to help that not be the case
 
Since iAIWeight is simply additive to the final result, it is a rather blunt tool, as unless you explicitly forbid those, it might force a square peg into a round hole, making a unit "fit" for a role it wouldn't normally be considered for.
The "real" solution is to modify the C++ code to handle all cases properly. The issue is that it has already been announced that this is a too difficult technical approach. iAIWeight has the benefit of working without recompiling. Compiling has always been too difficult and it is my impression that it has always hurt the modding community. C2C and WTP comes with scripted compiling and doesn't need people to set up the compiler in order to compile. I wish that would be the default for all mods, but the scripted approach is not trivial to set up.

I had at some point AI exploring with battering rams. :lol:
Well it's not like it won't work like it didn't manage to explore. The AI can be stupid at times. The perhaps worst I have seen is the AI deciding that cutting down all forests would be good. Since this was in We The People (maybe back when it was called RaR), no forests meant the city could no longer build buildings. This has since been fixed and the current AI is way better than vanilla in developing cities so the AI can be improved given the options we have. It's just not technically trivial to do so.

One side note. The screenshot confused me at first. Real Kyoto is where Edo is placed. Real Osaka is one plot further south and real Edo is on the rice south of Kyoto (it was renamed to Tokyo in mid 19th century). Sapporo is however placed correctly (maybe it should be one post to the west. Not sure). Ironically noticing Sapporo first gave me some sort of expectation of real placements, so it would be less confusing if it had been placed elsewhere :lol:
 
Perhaps there is not even any adjustment needed. I would take a look at the tooltip Walter Hawkwood recommended and see if the cavalry and air units you want to be in an upgrade chain have appropriately different AI values. If they do, I think you're fine as far as the upgrade AI goes. Messing with AI weights is always a risky endeavour because it's such a blunt tool. We don't want the AI to suddenly think that air units are the greatest thing ever and neglect building a land army.
 
The issue is that it has already been announced that this is a too difficult technical approach. iAIWeight has the benefit of working without recompiling.
Yep, I was working off that assumption and hence suggested a different XML tag to edit, which wouldn't require recompiling either.
Well it's not like it won't work like it didn't manage to explore.
Oh it was absolutely terrible at exploring. It was slow and would become a snack for the first wolf it came across.
One side note. The screenshot confused me at first. Real Kyoto is where Edo is placed. Real Osaka is one plot further south and real Edo is on the rice south of Kyoto (it was renamed to Tokyo in mid 19th century). Sapporo is however placed correctly (maybe it should be one post to the west. Not sure). Ironically noticing Sapporo first gave me some sort of expectation of real placements, so it would be less confusing if it had been placed elsewhere :lol:
Sapporo (or rather the barbarian city that becomes it when captured) is the only one of those pre-placed on the map, the rest is AI Japan founding wherever it pleases. As RI is not centred around the world map scenario (however, some players might like that to be the case), I am not spending hours upon hours hardcoding all the tiles with the city names for them. So yeah, most of those locations are random (though if I switch Kyoto to be the first city in the list, it will also get placed properly, as to my knowledge AI always founds the first city on the starting spot).
 
Additional question regarding my previous question to those who are adept at reading c++ logic; do you find that the AI adequately uses bombers and fighters when it has them? For example; if an AI invades a human player, it is easy to absolutely shred the AI to pieces with bombers or fighters. Does anyone notice whether the AI does this adequately? Its hard to know how well the code is written bc the lack of fighters and bombers for the AI is very real. The end game, militarily, should really be determined via air superiority on the land masses.

EDIT:
.
I have added a screenshot of a late game save. The civilization picture has flight and radio [fighters and bombers], and it has 3 bombers and 1 fighter in the city I have the cursor over. But, as you can see, the AI unit class weights doesn't even list either unit and I placed a 50 value on their weight as a test [so, shouldn't it be at least 50?], as well as made cavalry upgradeable to fighters or bombers ... and it also does not list air units under unit combat type units ... what gives?
.
Edit2: None of the other civs with the ability to build either unit has done so
 

Attachments

  • 20250806_230059.jpg
    20250806_230059.jpg
    497 KB · Views: 10
Last edited:
Additional question regarding my previous question to those who are adept at reading c++ logic; do you find that the AI adequately uses bombers and fighters when it has them? For example; if an AI invades a human player, it is easy to absolutely shred the AI to pieces with bombers or fighters. Does anyone notice whether the AI does this adequately? Its hard to know how well the code is written bc the lack of fighters and bombers for the AI is very real.
Wouldn't be able to help you there, as air unit AI is very heavily modded in RI, sorry. Actually, given you don't modify the DLL yourself in any case, have you considered adopting K-Mod as the base for yours? I'd bet it improves air unit handling by AI.
I have added a screenshot of a late game save. The civilization picture has flight and radio [fighters and bombers], and it has 3 bombers and 1 fighter in the city I have the cursor over. But, as you can see, the AI unit class weights doesn't even list either unit and I placed a 50 value on their weight as a test [so, shouldn't it be at least 50?], as well as made cavalry upgradeable to fighters or bombers ... and it also does not list air units under unit combat type units ... what gives?
I did a quick test myself, and air units don't get their values displayed there, for whatever reason. So I might have misled you on the usefulness of this for air units specifically.
 
Hello; yes, my mod is run off KMod as its base. And if air units aren't displayed there, do we think that means they are not taken into account at all? That the AIWeight has zero effect no matter the setting?
 
Additionally [hopefully Leoreth or Nightinggale can expand on the previous air unit posts], I have updated MMod but need to somehow link to it so it can be uploaded by others on this site. What is my best method of doing that?
 
Additionally [hopefully Leoreth or Nightinggale can expand on the previous air unit posts], I have updated MMod but need to somehow link to it so it can be uploaded by others on this site. What is my best method of doing that?
mega is a simple way to upload things
 
Additional question regarding my previous question to those who are adept at reading c++ logic; do you find that the AI adequately uses bombers and fighters when it has them? For example; if an AI invades a human player, it is easy to absolutely shred the AI to pieces with bombers or fighters. Does anyone notice whether the AI does this adequately? Its hard to know how well the code is written bc the lack of fighters and bombers for the AI is very real. The end game, militarily, should really be determined via air superiority on the land masses.
I think you are answering your own question - if you observe inadequate use of air units then that is a more valuable observation than what you can glean from the code. After all, if it was easy to tell from the code that it wouldn't be successful at ensuring adequate use of air units, it wouldn't have been written that way.

How units are used is difficult to improve without improving the DLL code itself. It's possible that KMod hasn't done much in that regard because modders often tend to not focus on mechanics that get introduced only in the modern era, because most games don't last that long.
 
Leoreth;
.
Would you surmise, based on the screenshot I provided and Walter confirmed, that the AI doesn't consider air units in the weights and therefore changing the weights doesn't even matter?
 
Leoreth;
.
Would you surmise, based on the screenshot I provided and Walter confirmed, that the AI doesn't consider air units in the weights and therefore changing the weights doesn't even matter?
You should/could try ai auto play with and without weight changes. You'd learn much more that way than just talking theoretically.
 
Have you tried changing the weights before taking that screenshot? My understanding is that they are applied to all units, but there are also some conditions that may cause the AI not to consider certain units at all. Especially with K-Mod I do not have any experience with the code base that I could speak from.
 
You should/could try ai auto play with and without weight changes. You'd learn much more that way than just talking theoretically.
The screenshot was AI autoplay, yes. Based on what I was seeing, and the air units tag missed on the lists to the left, it would be my guess [without knowing the code], that the weights do not apply at all to fighters/bombers
 
Last edited:
The screenshot was AI autoplay, yes. Based on what I was seeing, and the air units tag missed on the lists to the left, it would be my guess [without knowing the code], that the weights do not apply at all to fighters/bombers
I meant to AI autoplay the same save twice: with and without AI weight changes. If the results are the same (very similar) than AI weights aren't considered.
 
Back
Top Bottom