How to mod the game to include unit limits?

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
cazfi
Elite
Posts: 3093
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to mod the game to include unit limits?

Post by cazfi »

Sanguivorant wrote: Mon Oct 31, 2022 11:42 amIn the Ruleset, the units that are defined as "DefendGood" seem to be overprioritized by the AI.
Now that you mention that, I should check what that role even does in the code level. Maybe it's completely redundant, or worse, only causing AI to miscalculate (as you experience indicates), nowadays. AI calculates actual defense usability of the units quite (relative to how much simplifications and assumptions it otherwise does) accurately, so does the "DefendGood" only add want on top of the correct value?
Ignatus
Elite
Posts: 644
Joined: Mon Nov 06, 2017 12:05 pm
Location: St.Petersburg, Russia
Contact:

Re: How to mod the game to include unit limits?

Post by Ignatus »

As I could find out, "DefendGood" is just doubles the want of building city defender that is calculated for "DefendOk" (without either flag, a unit is not considered one... wait, where do all these battleships come from?); also, "DefendGood" serve as king's bodyguards. I doubt AI can calculate all the ballance issues to produce sensible hosting without hints, but it may well happen that the current system of hints is not sufficient.
Sanguivorant
Posts: 11
Joined: Mon Apr 25, 2022 12:54 am

Re: How to mod the game to include unit limits?

Post by Sanguivorant »

cazfi wrote: Tue Nov 01, 2022 1:22 am
Sanguivorant wrote: Mon Oct 31, 2022 11:42 am
cazfi wrote: Sun Oct 30, 2022 3:41 am
For that one I have a patch in testing.
I would be willing to test it honestly.
If you can build freeciv yourself, the patch is attached to that ticket.

Otherwise, what Operating System are you using?
I'm using Linux.
cazfi wrote: Wed Nov 02, 2022 1:16 pm
Sanguivorant wrote: Mon Oct 31, 2022 11:42 amIn the Ruleset, the units that are defined as "DefendGood" seem to be overprioritized by the AI.
Now that you mention that, I should check what that role even does in the code level. Maybe it's completely redundant, or worse, only causing AI to miscalculate (as you experience indicates), nowadays. AI calculates actual defense usability of the units quite (relative to how much simplifications and assumptions it otherwise does) accurately, so does the "DefendGood" only add want on top of the correct value?
From days of experimenting it seems that the AI calculates based primarily on four things:
The DefenceGood tag
Defence
Hitpoints
Firepower
Between two units of the same defence level, the AI will choose the one with the tag DefenceGood. So for example, even if a Legion has the same defence as a phalanx, it will always prefer phalanx because it has the DefenceGood tag. If you give the Legion DefenceGood, it doesn't seem to change anything until you add extra hitpoints.

I also did it between Phalanx and Archers. Despite archers having 1 defence, if they have the DefenceGood tag, and phalanx do not, the AI will build them. I might try a ruleset where I remove the tag entirely and see what the AI decides to do.
cazfi
Elite
Posts: 3093
Joined: Tue Jan 29, 2013 6:54 pm

Re: How to mod the game to include unit limits?

Post by cazfi »

Sanguivorant wrote: Thu Nov 03, 2022 1:28 pm
cazfi wrote: Tue Nov 01, 2022 1:22 am
Sanguivorant wrote: Mon Oct 31, 2022 11:42 am
I would be willing to test it honestly.
If you can build freeciv yourself, the patch is attached to that ticket.

Otherwise, what Operating System are you using?
I'm using Linux.
So flatpak would do? The patch just went in, with the little testing it has received, so will be in the nightly in a couple of hours: https://files.freeciv.org/nightly/S3_0/flatpak/
Post Reply