Command and Conquer Planning Thread

I was basically worried that I might end up in a situation where the AI just does nothing but sits around mindlessly not even teching up because I didn't fill out some file or something.
 
Normally if XML tags exist, AI was already taught how to handle possible settings then. So there should be no need to adjust AI logic in the DLL if you balance reasonably. :thumbsup:
As I said, normally only if you want to program really new game mechanics you need to worry about adjusting AI logic - otherwise it is in most cases just (reasonable) XML balancing.
Normally, but there are some exceptions, e.g. giving :strength: value to workers will cause all sorts of issues, CTD IIRC. You can ask the C2C crew about it.
 
e.g. giving :strength: value to workers will cause all sorts of issues, CTD IIRC
That is a Civ4BTS specific issue then. :dunno:
(Since I do not mod Civ4BTS I know nothing about it.)

In Civ4Col that issue definitely does not exist.
(Every single Unit has at least iCombat of 1 in our mod.)

Also if this is the case it should be pretty easy to fix the code if it was already analyzed and the issue is as clear as you describe.
(Analyzing the cause of such an issue is like 90% of the work. Fixing the code is normally just the remaining 10% of work.)
 
Last edited:
That is a Civ4BTS specific issue then. :dunno:
(Since I do not mod Civ4BTS I know nothing about it.)

In Civ4Col that issue definitely does not exist.
(Every single Unit has at least iCombat of 1 in our mod.)

Also if this is the case it should be pretty easy to fix the code if it was already analyzed and the issue is as clear as you describe.
(Analyzing the cause of such an issue is like 90% of the work. Fixing the code is normally just the remaining 10% of work.)
Unless the issue comes from a difference in the EXE. I don't know what's the exact cause of the issue but IIRC the C2C crew didn't fix it, though they have programmers too.
But I don't want to derail the topic.
 
Normally, but there are some exceptions, e.g. giving :strength: value to workers will cause all sorts of issues, CTD IIRC. You can ask the C2C crew about it.
Oh, why so? I have done that in my mod for one civilisation...?
EDIT: And I definitely have not encountered a CTD in all the years of having this implemented.
 
Oh, why so? I have done that in my mod for one civilisation...?
EDIT: And I definitely have not encountered a CTD in all the years of having this implemented.
This is what I was told in RoM-AND forums. I'm not sure if it really was a CTD or an infinite loop but something. It was some conflict with the unitAI. Better ask the C2C guys. But I'm almost certain that Archmage @f1rpo knows the answer too. He knows everything :lol:
 
It was some conflict with the unitAI. Better ask the C2C guys. But I'm almost certain that Archmage @f1rpo knows the answer too. He knows everything :lol:
I don't know, but I seem to recall that Dawn of Civilization has Roman military units that build roads and that some minor AI change was needed to really make that work. Maybe the issue in C2C involves code added by C2C. But, generally, any unconventional XML change (e.g. non-naval cargo units) may well cause some AI or UI issues in the DLL.
[...] and I intend to give some units ranged attack capability. But that's an XML thing so I assume the AI can handle it?
AI support for ranged attacks is very rudimentary, some 20 lines of code in CvUnitAI.cpp. Ranged units will shoot at units that happen to be near them, and the choice of the target (if multiple are in range) is based on combat odds ... I don't even remember what that boils down to when the survival odds are always 100%. @keldath has spent a lot of time e.g. getting ranged units to seek safety sometimes rather than always firing and to select targets more intelligently. (But he also experimented with changes to the range-attack rules, so I doubt that his code is easily portable.)
[...] and making sure that the AI can figure out to build war factories in order to build tanks and stuff. But it handles missionaries just fine so it should be fine?
At least CvCityAI::AI_buildingValue doesn't look encouraging: CvCityAI.cpp#L3364
The lower part of the loop body only deals with missionaries. The upper part seems to assign some utility only if 0 units of the same UnitAI type exist on the city's landmass. I suppose that's also aimed at missionaries. Oh, and I see that the BBAI mod has helpfully added a comment:
"TODO: Smarter monastary construction, better support for mods"
Just setting an AI weight in XML isn't going to work well because, as you say, you want the AI to specialize - and construct war factories only when having gone with the vehicular techs. But, then, adding AI code that perhaps just adds some fixed value for every (non-missionary) unit type enabled by the building shouldn't be much effort; could be good enough. Edit: And mods with buildings that enable military units may have already added some AI code, e.g. Rise of Mankind probably has such buildings.
 
Last edited:
Edit: And mods with buildings that enable military units may have already added some AI code, e.g. Rise of Mankind probably has such buildings.
Yes, RoM-AND has some units requiring buildings but these are mostly late game stuff, where it isn't considered so important whether the AI is using them or not. E.g. mechs, nukes and other futuristic stuff.

But you can dodge this issue by a civ-ish approach: War Factory is not a requirement for tanks but a booster building granting +2Xp and double production speed for tanks. AFAIK the AI understands the use of Barack-like buildings, since that is vanilla feature.
 
I don't know, but I seem to recall that Dawn of Civilization has Roman military units that build roads and that some minor AI change was needed to really make that work. Maybe the issue in C2C involves code added by C2C. But, generally, any unconventional XML change (e.g. non-naval cargo units) may well cause some AI or UI issues in the DLL.AI support for ranged attacks is very rudimentary, some 20 lines of code in CvUnitAI.cpp. Ranged units will shoot at units that happen to be near them, and the choice of the target (if multiple are in range) is based on combat odds ... I don't even remember what that boils down to when the survival odds are always 100%. @keldath has spent a lot of time e.g. getting ranged units to seek safety sometimes rather than always firing and to select targets more intelligently. (But he also experimented with changes to the range-attack rules, so I doubt that his code is easily portable.)
Is DOC related to KMOD? Because I took that as my starting position so there might be some stuff there. And if not at least more easily ported.

As for seeking safety that's not a priority for me for now as the only units that will get ranged attacks are artillery and battleships. Artillery will, I hope, be sitting in stacks and battleships don't need to run. Well, them and turrets. But turrets can't move at all so that's mute. As long as the AI is smart enough to shoot at anything that comes near it before charging in I am happy.

At least CvCityAI::AI_buildingValue doesn't look encouraging: CvCityAI.cpp#L3364
The lower part of the loop body only deals with missionaries. The upper part seems to assign some utility only if 0 units of the same UnitAI type exist on the city's landmass. I suppose that's also aimed at missionaries. Oh, and I see that the BBAI mod has helpfully added a comment:
"TODO: Smarter monastary construction, better support for mods"
Just setting an AI weight in XML isn't going to work well because, as you say, you want the AI to specialize - and construct war factories only when having gone with the vehicular techs. But, then, adding AI code that perhaps just adds some fixed value for every (non-missionary) unit type enabled by the building shouldn't be much effort; could be good enough. Edit: And mods with buildings that enable military units may have already added some AI code, e.g. Rise of Mankind probably has such buildings.
Thanks. I will look into that definitively. If all else fails I'll dig into FFH submods. Those definitively have building requirements for all sorts of stuff and even a game option to let the AI ignore them. Of course, I'd love to avoid this work but how hard can it be?

Yes, RoM-AND has some units requiring buildings but these are mostly late game stuff, where it isn't considered so important whether the AI is using them or not. E.g. mechs, nukes and other futuristic stuff.

But you can dodge this issue by a civ-ish approach: War Factory is not a requirement for tanks but a booster building granting +2Xp and double production speed for tanks. AFAIK the AI understands the use of Barack-like buildings, since that is vanilla feature.
I definitively want hard requirements because it's supposed to be a strategic tradeoff. All production buildings (except the barracks) come with [IMG alt=":yuck:"]https://forums.civfanatics.com/images/smilies/civ4/yuck.gif[/IMG] points to discourage spamming them in each city. The idea being that only your production cities that specialize in building units are going to have a massive army base full of buildings in them. And the rest might have one or no military buildings. Kind of how in C&C not every mission lets you build all the stuff up front.
 
hey there,
@f1rpo, hey friend :)

so,
My Doto is based off advc.
Indeed i have spent many hours on ranged attack code. in my escapades with it, i was able to create a nice system that the ai knew how to work with.
It is quite complicated to catch all the places where the ai needs to evaluate wheatear to attack or not. which i wrote some functions to do so, according to the rules i thought of.
In the end, i decided to go with existing ai logic and not do per say ranged attack, but rather a system of attack that will make the siege units more powerful.
the base of this code is, ranged attack strike and cannot get damage from the unit it attacked, like in a normal combat. it involves more rules, but thats the idea.
it worked nicely. still got some ai tweaks on how much siege units ai should build and risk eval for using those units in combat.

if you are using advc code as basis, you can import code from my mod, i kept it clean and with comments for each component.

i will suggest another go for ranged attack,
Vincent, from VIP mod, wrote a pretty good ranged attack system. which i used as reference point at the start.
from its source code, its really not so difficult to port it to you code.

if you need some help, let me know.
 
Thanks. Will do. My plans were basically to give certain units the ability to strike the tile next to them. Primarily have battleships attack land targets this way. But also turrets. I plan to port the FFH leash system for those so they need to be able to effect tiles around them somehow.
 
By the way, the AI logic for ranged attack that I want to implement is and I quote: If you can do it, do it. Every time. Always. Forever.
 
Another thing. I intend to post a new and revised tech tree by the end of the week. Can I count on the readers here to take one look and make sure I didn't include something too stupid, out of place or just erroneous such as for example having a tech with too few prerequisites (or too many) or something? Shouldn't take you more than 10 minutes. It's just that I've been staring at that chart for so long that I tend to no longer notice things that a fresh set of eyes might pick up.
 
Minor comment on the tech tree from a 2 second glance. While industrial agriculture makes sense to me, I don’t see what Industrial Hunting would be other than a path to species’ extinction. Would it not make sense to allow construction of camps (which would not be as efficient as the industrial improvements) from the start of the game? Some type of conservation (tech) of species, so they’re not over hunted, could allow a boost to the camps later.
 
Minor comment on the tech tree from a 2 second glance. While industrial agriculture makes sense to me, I don’t see what Industrial Hunting would be other than a path to species’ extinction. Would it not make sense to allow construction of camps (which would not be as efficient as the industrial improvements) from the start of the game? Some type of conservation (tech) of species, so they’re not over hunted, could allow a boost to the camps later.
Industrial hunting may be a bit of a clumsy term. But it's the best one I could come up with to adequately describe the sort of insane mass scale hunting practices that emerged during that period where people were hunting animals in near industrial quantities to provide for the growing urban food markets. It exploded in popularity at about the same time and for the same reasons as industrial scale fishing and whaling. And it was just as insane.

How insane? Well at their height these practices involved things like killing entire heard of buffalo and stuffing them onto trains loaded with ice and using giant shotguns to kill entire flocks of birds in flight. And that is just kind of cool for all the wrong reasons.

And yes, you are absolutely correct to say that it is unsustainable and leads to species going extinct. Much like with whales many of the species targeted, for example the american buffalo, were in fact driven to near extinction before we were forced to stop. And forced is the operand term here. We only stopped because we killed so many animals that populations became so small that the practice became unprofitable.

It's just one of those episodes in human history we don't often think about. And one I thought would make a fun pedia entry for that reason.
 
Last edited:
Another short update. I've been looking at the unit tree and thinking, do we really need the marine unit? In vanilla CIV marines are just regular infantry but better in every way. They get a bonus vs siege, machineguns and naval attacks. So they are effectively heavy infantry.

Now in my mod, the role of machineguns is taken by turrets. And the counter to turrets are supposed to be tanks and heavy infantry (tesla troopers, chrono legionares, brutes etc.) So I'd have to take away those ancillary bonuses leaving just the naval attack. And at that point is it really worth it? Maybe I should just remove the marine branch altogether and just give those bonuses to heavy infantry. As in, have tesla troopers and their equivalents have +vs tanks and turrets.
 
I am officially stuck on the tech tree issue. Expect an update when and if I resolve my problems.
 
Short update. I came down with something fierce last week and am still recovering.
TLDR. Am sick, might die, stand by.

PS. That second sentence was supposed to rhyme. I think it does. Just read it like it did.
 
Top Bottom