Page 1 of 1

Why won't the AI make nukes or aircraft?

Posted: Mon Jun 16, 2025 6:01 pm
by Sanguivorant
Okay, I can understand the AI massing phalanges, pikemen, musketeers, riflemen.

But the AI does not make aircraft, doesn't make nukes and by the modern era it becomes way too easy to take on the AI. Is there a way to change this, or should I look into playing multiplayer?

Re: Why won't the AI make nukes or aircraft?

Posted: Tue Jun 17, 2025 3:23 pm
by Ignatus
Shortly, yes, you should look for playing multiplayer, AI sucks and that won't change soon. (Well, there was an experiment with strong AI playing Freeciv, but that is not going to be supplied with the regular distribution and that was not an AI you can launch on your old laptop.) About aircraft, Freeciv military advisor limits considering military units for build to "simple" types that excludes fueled ones. Also, if nothing has changed since I've looked at it, AI does build helicopters (units losing hp in the open) but does not use them in any way unless it gets UNO wonder to stop them losing hp; yes, that's stupid. About nukes, I don't know; probably for AI a nuke is just a regular missile with 99 strength, and its calculations show it is ineffective in cases when you would apply it. Also, AI does not know that bombardment is different from regular attack ... I can continue long, so return to the start of my post.

Re: Why won't the AI make nukes or aircraft?

Posted: Wed Jun 18, 2025 3:59 am
by Dino the Dinosore
Can you say more about that "experiment with strong AI"? I have something more powerful than an old laptop and would like to try it out.

Re: Why won't the AI make nukes or aircraft?

Posted: Wed Jun 18, 2025 6:45 pm
by Sanguivorant
Ignatus wrote: Tue Jun 17, 2025 3:23 pm (Well, there was an experiment with strong AI playing Freeciv, but that is not going to be supplied with the regular distribution and that was not an AI you can launch on your old laptop.)
Anywhere I can download or use this strong AI? I've seen a few studies and would like to try them out:

https://web.stanford.edu/class/aa228/re ... inal51.pdf

Also, I don't know how to program AI, but this project seems to allow you to:

https://github.com/chris1869/freeciv-bot

Re: Why won't the AI make nukes or aircraft?

Posted: Thu Jun 19, 2025 4:01 pm
by Ignatus
Sanguivorant wrote: Wed Jun 18, 2025 6:45 pm Anywhere I can download or use this strong AI? I've seen a few studies and would like to try them out:

https://web.stanford.edu/class/aa228/re ... inal51.pdf
hehe as I can see all they could is playing in line with builtin Hard AI. I meant another kind of AI, it played much better, but that's not what you can download for free and run at home. About recent development, all that I have heared of is that in Freeciv-Web, there is GPT advice, but afaik not GPT opponents.

Re: Why won't the AI make nukes or aircraft?

Posted: Mon Jun 23, 2025 4:29 pm
by Sanguivorant
Guys, I think I found out how to make the AI capable of building planes.

I was looking through the files in /ai/default/aiair.cpp, and it seems like this line of code disables the AI from making airplanes (line 436):

// This AI doesn't know to build planes
if (has_handicap(pplayer, H_NOPLANES)) {
return false;
}

Where can I find this handicap and remove it from the AI? And once I do that, do I have to rebuild from source or how do I get that feature updated?

Re: Why won't the AI make nukes or aircraft?

Posted: Mon Jun 23, 2025 7:15 pm
by cazfi
That handicap is set on "restricted", "novice", and "easy" difficulty level AIs.
E.g.:

Code: Select all

/help easy
...
  Doesn't build air units.
...
Higher difficulty levels do not have that handicap.

Re: Why won't the AI make nukes or aircraft?

Posted: Mon Jun 23, 2025 7:42 pm
by cazfi
Anyway, it's not hard to get AI to build aircraft (just remove whatever guards there is protecting AI from that), but it would be very hard to get AI to use those aircrafts sensibly once it has built them, i.e., not to lose masses of them to out-of-fuel.

Re: Why won't the AI make nukes or aircraft?

Posted: Wed Jun 25, 2025 12:31 am
by Sanguivorant
cazfi wrote: Mon Jun 23, 2025 7:42 pm Anyway, it's not hard to get AI to build aircraft (just remove whatever guards there is protecting AI from that), but it would be very hard to get AI to use those aircrafts sensibly once it has built them, i.e., not to lose masses of them to out-of-fuel.
How do I remove those guards? I am completely lost in coding changes for the AI, I've spent a few hours looking at the AI codebase and it's honestly confusing as many things are abstracted. Is there a good resource for deciphering how it all works?

From what I have tested, the AI seems to know how to use fighters and stealth fighters really well. That's all I want, for them to build fighters.

Re: Why won't the AI make nukes or aircraft?

Posted: Thu Jun 26, 2025 5:28 am
by cazfi
The problem is in in fuel usage, so look for checks against building fuel using units.