Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#4003 closed defect (fixed)

[PATCH] Adapt the AI for #3930

Reported by: mimo Owned by: mimo
Priority: Should Have Milestone: Alpha 21
Component: AI Keywords:
Cc: Patch:

Description

ticket #3930 adds a TechCostMultiplier? to the ProductionQueue? components. The AI has to be adapted to take it into account.

Current behaviour of the AI: both research plans (queueplanResearch.js) and training plans (queueplanTraining.js) create a generic plan (queueplan.js) which computes the costs of the produced entity. Then the plan accumulates some resources, with the sharing of the available resources between the different plans being done by the queueManager (queueManager.js). Then when the plan has gathered enough resources, it is started and only then looks for the best ProductionQueue? to be used.

To adapt the AI to #3930, research and training plans should already look for the best ProductionQueue? when they are created, pass it to queueplan.js so that it can computes the right costs. And then, when the plan is about to start, check what is the current best ProductionQueue? and its current cost (as the previous ProductionQueue? may have been destroyed or some new auras may have changed the cost), and then check that we can really start. If not, we should update the costs of the plan and let it continue to accumulate resources according to the new cost.

As in its present state, #3930 only decreases the costs, the AI will still work even if not adapted (although being a bit inefficient as not taking profit of these auras) and thus this ticket can be splitted from #3930 and commited after.

Attachments (2)

t4003-part1.patch (9.4 KB) - added by mimo 18 months ago.
Takes the cost multiplier into account for AI researches.
t4003-part2.patch (5.8 KB) - added by mimo 18 months ago.
second (and last) part of the patch, dealing with cost of trained units

Download all attachments as: .zip

Change History (9)

comment:1 Changed 18 months ago by mimo

Keywords: simple added

comment:2 Changed 18 months ago by mimo

Milestone: BacklogAlpha 21

comment:3 Changed 18 months ago by mimo

Keywords: review added; simple removed
Summary: Adapt the AI for #3930[PATCH] Adapt the AI for #3930

Remove the simple keyword as the patch is more involved than anticipated. This first part of the patch fixes the tech case.

Changed 18 months ago by mimo

Attachment: t4003-part1.patch added

Takes the cost multiplier into account for AI researches.

comment:4 Changed 18 months ago by mimo

Keywords: review removed

t4003-part1.patch has been commited in r18333

Changed 18 months ago by mimo

Attachment: t4003-part2.patch added

second (and last) part of the patch, dealing with cost of trained units

comment:5 Changed 18 months ago by mimo

Keywords: review added

comment:6 Changed 18 months ago by mimo

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 18353:

completes the ai adaptation to cost multipliers, fixes #4003

comment:7 Changed 18 months ago by mimo

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