Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#969 closed enhancement (fixed)

[PATCH] Territory support for the AI

Reported by: Jonathan Waller Owned by:
Priority: Should Have Milestone: Alpha 8
Component: UI & Simulation Keywords:
Cc: James Baillie, lexa Patch:

Description

This patch gives the AI a map of the territories in the game.

The main issue with the patch is that territory data is regenerated each turn which is inefficient. I have tried looking at the DirtyID for the grid generated but it is always 0.

As historic_bruno mentioned build restrictions data needs to be added to the gamestate. Currently I don't think is is urgent since only docks and CCs are different and they need special handling already by an AI script.

There is a post on the forums here.

Attachments (4)

AI Territories.patch (4.8 KB ) - added by Jonathan Waller 13 years ago.
AI Territories23-9.patch (6.2 KB ) - added by Jonathan Waller 13 years ago.
ai_territory_support-09282011.patch (6.5 KB ) - added by historic_bruno 13 years ago.
ai_buildrestrictions-09282011.patch (19.5 KB ) - added by historic_bruno 13 years ago.

Download all attachments as: .zip

Change History (11)

by Jonathan Waller, 13 years ago

Attachment: AI Territories.patch added

comment:1 by historic_bruno, 13 years ago

Milestone: BacklogAlpha 8
Summary: Territory support for the AI[PATCH] Territory support for the AI

Thanks :)

For the DirtyID problem, we can take a cue from CCmpRangeManager which stores a local DirtyID and calls CCmpTerritoryManager::NeedUpdate(DirtyID) to test if a new territory grid is available. CCmpAIManager could do the same. (The internal grid for territory manager gets deleted on update, causing the new grid's DirtyID to be reset to 0, but the actual value is returned by NeedUpdate()).

I also think map should be renamed to passabilityMap to better distinguish it from territoryMap.

by Jonathan Waller, 13 years ago

Attachment: AI Territories23-9.patch added

comment:2 by Jonathan Waller, 13 years ago

I have used the method you suggest for the dirty testing. It seems to work now. I also renamed map to passabilityMap in various places, the C++ code is now completely switched to the new name.

In the base.js file I currently set both .map and .passabilityMap so that AI scripts don't break immediately. I thought it would be best to make the transition easier.

comment:3 by historic_bruno, 13 years ago

Cc: James Baillie added
Keywords: review added

Uploading some new patches for review that add territory support for AIs, based on the above. The first updates the API to support territories. The second patch changes existing AIs (Jubot, Testbot) to take advantage of this.

by historic_bruno, 13 years ago

by historic_bruno, 13 years ago

comment:4 by historic_bruno, 13 years ago

Cc: lexa added

comment:5 by infyquest, 13 years ago

Keywords: patch added

I would like to see this patch sooner so we can have better AI bots

comment:6 by ben, 13 years ago

Resolution: fixed
Status: newclosed

(In [10408]) Adds territory map to AI GameState, based on patch from quantumstate. Fixes #969. Updates testbot and Jubot to support basic build restrictions.

comment:7 by historic_bruno, 13 years ago

Keywords: review patch removed
Note: See TracTickets for help on using tickets.