Latest Posts

Topic: The AI vs. fleets and shipyards

tothxa
Avatar
Topic Opener
Joined: 2021-03-24, 11:44
Posts: 452
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2024-01-18, 23:56

While tweaking the navalwarfare-ai code, I've found that AI code seems to simply count all ships and all ports, without regard to fleets. So if there are more than one oceans or lakes with portspaces on a map (of the official maps, Calvisson is like that), the AI seafaring code is likely to get utterly confused. Is that correct? (Fortunately most seafaring maps are not like that, so we can leave this for v1.3.)

Only tangentially related, but I don't want to start 2 topics:

I also saw that the AI is explicitly not meant to build more than one shipyard. However that makes it extremely slow to defend ports. (it's already too slow starting up an economy to the point of building ports and ships) I haven't checked why it is prevented from building more, but I intend to. What should I watch out for that made this necessary? Is there any chance we could allow it to build 2 shipyards when it's strong enough (e.g. has 2 ports) without too much complication? (meaning in v1.2) I'm willing to give it a try, and will probably attempt it, I'd just like to know what to expect.

Edited: 2024-01-19, 00:01

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2682
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2024-01-19, 09:32

Well I made some precautions to make the AI aware of building a ship in an ocean where it has no port, but this were only workarounds, as the AI is not aware of fleets (and I don't know how to make it aware of that).

The restriction for one shipyard is more ancient then me starting to dig into the AI code. I believe it was a precaution of preventing it from building endless shipyards as no measure was implemented to determnine the needed amount.

for v1.2 I beleive we won't get to the point of the AI handling naval warfare very well. my only goal was to make it build some ships and distribute them to enable single players to get an impression of the new feature. But if you would try to implement such measures, feel free to do so.


Top Quote
tothxa
Avatar
Topic Opener
Joined: 2021-03-24, 11:44
Posts: 452
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2024-01-19, 12:47

Thank you! face-smile.png

hessenfarmer wrote:

the AI is not aware of fleets (and I don't know how to make it aware of that).

Well, I guess it should just do what it does now, but for each fleet separately. Are there any known obstacles to that?


Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 22:16
Posts: 2682
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2024-01-19, 19:05

tothxa wrote:

Thank you! face-smile.png

hessenfarmer wrote:

the AI is not aware of fleets (and I don't know how to make it aware of that).

Well, I guess it should just do what it does now, but for each fleet separately. Are there any known obstacles to that?

Well it does simply not have the concept of the fleet. It does not have any concept of the map as well, so it does not knopw about continents, oceans, mountains and similar concepts.


Top Quote
tothxa
Avatar
Topic Opener
Joined: 2021-03-24, 11:44
Posts: 452
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2024-01-19, 21:36

hessenfarmer wrote:

Well it does simply not have the concept of the fleet. It does not have any concept of the map as well, so it does not knopw about continents, oceans, mountains and similar concepts.

Yes, but ships, ports (through portdocks), and I believe shipyards too know their fleet, so we can easily create a FleetObserver struct to hold all data belonging to a fleet that is currently in the DefaultAI struct directly, and a fleets deque.


Top Quote