Opened 13 years ago

Last modified 10 years ago

#973 closed enhancement

Add naval / water map support to AIs — at Version 21

Reported by: alexhultman Owned by: Darth_Malloc
Priority: Should Have Milestone: Alpha 17
Component: AI Keywords:
Cc: wraitii Patch:

Description (last modified by Darth_Malloc)

[PATCH] The AI should build a dock, train a boat and then attack when it feels like it has a strong army.

Change History (22)

comment:1 by historic_bruno, 13 years ago

Milestone: Alpha 8Backlog

This is a more general problem with the AIs and not specific to Jubot: they assume that every point is reachable from every other point. That means they fail in lots of situations, but especially water maps where resource and enemy targets can be unreachable by land units. The easier part of the problem seems like providing the AIs information about which parts of the map are reachable (and by what types of units), and the harder part is the logic to actually handle docks, boats, trading, and invasions.

comment:2 by historic_bruno, 12 years ago

Component: Core engineUI & Simulation
Summary: JuBot doesn't get that it takes a boat to attack another islandAdd naval / water map support to AIs
Type: defectenhancement

comment:3 by Darth_Malloc, 11 years ago

Owner: set to Darth_Malloc
Status: newassigned

in reply to:  3 comment:4 by historic_bruno, 11 years ago

Replying to Darth_Malloc:

Any progress on this?

comment:5 by Darth_Malloc, 11 years ago

I am working on getting qubot to build docks. Will have code to post on the weekend. Sorry about the back-to-work button. Got a bit lost in the code and was not sure about asking for help.

comment:6 by fabio, 11 years ago

Cc: wraitii added

Is wraitii also working on this on aegis? Also is qbot planned to be removed?

comment:7 by wraitii, 11 years ago

I am working on this on Aegis. It looks fairly good. I plan to remove qBot in A15 if all goes well.

comment:8 by fabio, 11 years ago

Milestone: BacklogAlpha 15

comment:9 by Darth_Malloc, 11 years ago

Which part of this task are you doing far aegis? I was going to improve the common to allow naval functionality. Should I ignore qbot, or go ahead editing it as planned?

in reply to:  9 ; comment:10 by historic_bruno, 11 years ago

Replying to Darth_Malloc:

Which part of this task are you doing far aegis? I was going to improve the common to allow naval functionality. Should I ignore qbot, or go ahead editing it as planned?

All AIs except Aegis are deprecated now. You really shouldn't do any work on qBot if it can be avoided. For Aegis, as I understand, a major rewrite is in progress for A15 or later, so it may simply be a bad time to do AI work, unless you want to write a new AI. (though perhaps wraitii can do the work on Github or something, and then you can collaborate and avoid wasted effort)

in reply to:  10 comment:11 by Darth_Malloc, 11 years ago

That sounds like a good plan. In the mean time, I will focus on correcting the pathfinding algorithm for naval units so that they are able to "come about" in a realistic manner, since I think that this issue will be an important consideration in developing the AI naval strategies. I should tell you that I will be traveling from the 25th to the 30th, and while I will work on it before then, I may not post anything until after my trip.

Replying to historic_bruno:

Replying to Darth_Malloc:

Which part of this task are you doing far aegis? I was going to improve the common to allow naval functionality. Should I ignore qbot, or go ahead editing it as planned?

All AIs except Aegis are deprecated now. You really shouldn't do any work on qBot if it can be avoided. For Aegis, as I understand, a major rewrite is in progress for A15 or later, so it may simply be a bad time to do AI work, unless you want to write a new AI. (though perhaps wraitii can do the work on Github or something, and then you can collaborate and avoid wasted effort)

comment:12 by wraitii, 11 years ago

Darth_Malloc: sounds good. I know my AI code well enough that working on AI-naval side will probably be easier, but anything that the AI would not act upon directly is out of my scope right now.

comment:13 by Darth_Malloc, 11 years ago

Fair enough. I have no training in AI programming, but I feel capable of learning as I go, and would like to do so. Any thoughts on how we ought to divide the task?

comment:14 by wraitii, 11 years ago

Well I've started working on "transport plans" which would basically handle AI transportation over water… There is some code for placing docks but it could be refined. It'd need code for naval fighting and stuffs like that if you're interested.

in reply to:  14 comment:15 by Darth_Malloc, 11 years ago

That sounds good. I was already working on a few ideas to improve the process for placing docks, one of which would a function by which the terrain pathfinder would isolate coastal ocean tiles (adjacent to shore) to make it easier to select dock spaces. Do you think this would help. I would be very keen to work on the naval combat functionality, as well as the fishing behaviour. AI work is still new to me, and for the next little while things will be a bit hectic with travelling and graduate school, so things may be a bit slow, but I will do my best.

Replying to wraitii:

Well I've started working on "transport plans" which would basically handle AI transportation over water… There is some code for placing docks but it could be refined. It'd need code for naval fighting and stuffs like that if you're interested.

comment:16 by wraitii, 11 years ago

Work will slow down for me too once I get back to school so that's probably not an issue. Current dock placement by the AI is similar to this but I guess it could always be improved. I'd certainly be interested by what you come up for fishing and naval fighting. I'd recommend you start by a conceptual idea, so that I can tell you how easy it'd be to do with the current architecture/how to hook it up more easily.

in reply to:  16 comment:17 by Darth_Malloc, 11 years ago

Sorry about the silence at my end. I am back now. In terms of fishing behaviour, I would add a seeking function for fishing ships. It would basically be a modified version of TerrainAnalysis.prototype.findClosestPassablePoint insofar as it would use a spiral algorithm to search a location that corresponds to the location of a resource entity that is of the fish type, with the loop terminating when a fish resource is located. The ship will repeat this whenever it is idle, i.e., when it is first created, and when it has polished off the current fish resource. An aggressive AI would venture ever further as long as there were still fish resources, while a cautious one would limit its reach. Still trying to come up with some good plans for naval combat behaviour.

Replying to wraitii:

Work will slow down for me too once I get back to school so that's probably not an issue. Current dock placement by the AI is similar to this but I guess it could always be improved. I'd certainly be interested by what you come up for fishing and naval fighting. I'd recommend you start by a conceptual idea, so that I can tell you how easy it'd be to do with the current architecture/how to hook it up more easily.

comment:18 by wraitii, 11 years ago

Darth_Malloc: FYI currently AIs can see in the FOW so you could just go to the fish directly, but it's good if you have a good solution to avoid that cheating. We'll have to make sure it's reasonaby fast.

You can check what I added for naval support in the "Further AI Development" thread in the development forum.

in reply to:  18 comment:19 by Darth_Malloc, 11 years ago

I think that what you have done on the the transport functionality looks good. I am doing some coding on the fishing behaviour, though I am a noob when it comes to AI, so I am not fully certain that I am doing it correctly. My thinking, however, is this: when a new dock is built, it should get a queue of fishing spots from closest to farthest. Fishing ships should have a homePort attribute with the ID of the dock that created them, and they should follow the queue of that particular dock. I will try to come up with a way to implement LOS and FOW, and if I succeed, then the queue would be restricted to that which is visible to the AI, updating as the map is explored.

Replying to wraitii:

Darth_Malloc: FYI currently AIs can see in the FOW so you could just go to the fish directly, but it's good if you have a good solution to avoid that cheating. We'll have to make sure it's reasonaby fast.

You can check what I added for naval support in the "Further AI Development" thread in the development forum.

comment:20 by historic_bruno, 11 years ago

Description: modified (diff)
Milestone: Alpha 15Backlog

Any progress on this, any patch or git fork we can see that shows even the least active development?

by Darth_Malloc, 11 years ago

Attachment: naval-manager.diff added

in reply to:  20 comment:21 by Darth_Malloc, 11 years ago

Description: modified (diff)
Keywords: review patch added
Milestone: BacklogAlpha 16

Replying to historic_bruno:

Any progress on this, any patch or git fork we can see that shows even the least active development?

Sorry for the delay. Things have been quite hectic at school. I have made some changes to naval-manager so that it should account for the naval options of all existing civilizations. The only snag that I have hit is that I am unsure of a quick way to determine if an entity (namely a dock or a fishing spot) is in the boundaries of a particular region. If someone would be willing to clarify this, I would then be able to enhance the naval-manager to determine accessibleSeas, and to implement the algorithm that I have been planning to coordinate fishing.

Note: See TracTickets for help on using tickets.