#2256 closed defect (fixed)
PATCH] Need to improve the AI handling of bartering
Reported by: | mimo | Owned by: | wraitii |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 16 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | wraitii | Patch: |
Description
When playing with several AIs, bartering quite often lead to ridiculous exchange rates where we can buy several hundreds wood, stone or metal with 100 food. Looking at the code in ai/aegis/headquarters.js it seems that the AI try to barter when it needs a resource, whatever the resource and whatever the exchange rate are.
As food is illimited, the AI should refrain to acquire food with bartering, but rather try to construct new farms when needed.
Then, when bartering, it should check the exchange rate, and not barter if this exchange rate is really too poor.
In addition, for higher AI levels, the AI could do preventive bartering selling its food excess when the rate is good (both to constitute stocks of resources and to bother its opponents by making food bartering less profitable for them).
Attachments (1)
Change History (10)
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Milestone: | Backlog → Alpha 16 |
---|
Moving to A16 or I'll completely forget about this.
comment:4 by , 10 years ago
Keywords: | patch review added |
---|---|
Summary: | Need to improve the AI handling of bartering → PATCH] Need to improve the AI handling of bartering |
Here is a patch for it.
comment:5 by , 10 years ago
headquarters.js at line 781 needs braces around the if (as the else if doesn't do what the indentation claims that it does).
by , 10 years ago
Attachment: | aibarter.diff added |
---|
comment:7 by , 10 years ago
Thanks for the patch mimo… I've given it a look and it seems good, but I fear your algorithm may be too clever (it assumes a human player and not the current AI). I'll use all your changes but write my own new "TryBartering" function to be cleverer. Might switch to this when the resource collection is improved.
comment:9 by , 8 years ago
Keywords: | review removed |
---|
Interesting input. I think I haven't really rewrote bartering for the new Aegis while I changed a ton of other stuffs, so incoherent behavior is not too surprising. Usually it's mostly done to overcome the AI bad resource planning.