Unciv icon indicating copy to clipboard operation
Unciv copied to clipboard

AIs can offer trades with Gold they don't have

Open touhidurrr opened this issue 3 years ago • 10 comments
trafficstars

Platform Android 11

Version 4.0.8

Describe the bug I declared war and started destroying AI units up & down. After 10 turns they offered me a trade of 612 golds for peace. But when I went to trade menu I saw something like this on AIs side: Gold 300+ Gold -612

Which means AIs can give copies of gold that they don't have. This is a major issue cause this means that AIs cannot calculate their golds properly. So, good trades from players are rejected.

touhidurrr avatar Apr 22 '22 08:04 touhidurrr

might be caused by: https://github.com/yairm210/Unciv/blob/f613bba7d4fe2301a93efae83915f7355d7b587b/core/src/com/unciv/logic/trade/TradeEvaluation.kt#L44

alexban01 avatar May 28 '22 22:05 alexban01

Oh, yairm210 fixed this issue with a commit and shared it in Discord. I might have forgot about this issue.

touhidurrr avatar May 28 '22 22:05 touhidurrr

@alexban011 sorry for forgetting to close the issue. Can you reproduce it? If not I will close this.

touhidurrr avatar May 28 '22 22:05 touhidurrr

Oh not this maybe. The one yairm fixed was AIs offering 2 Open Borders as counteroffer trade maybe. So, this issue might still be remaining. In that case I think we need to look at Civ 5 mechanics. Does it happen on Civ 5 also? Or just unciv. Why was such a comment was left that It's fine even with negative gold? Is it arbitrary or Civ 5 mechanics?

touhidurrr avatar May 28 '22 22:05 touhidurrr

I didn't try to reproduce. But I don't understand that part either. In what case would it be ok for those to be negative? Maybe for displaying it in the offer?

alexban01 avatar May 28 '22 23:05 alexban01

I personally feel betrayed when AIs can offer gold they don't have and I suffer from lack of gold. I don't see why it should be allowed unless it is a Civ V behaviour.

Maybe it’s something silly like the author couldn’t find any proper way about how AI would react when they have nothing to offer in trade and thought that negative gold is ok for the time being.

touhidurrr avatar May 28 '22 23:05 touhidurrr

The closest thing I found about this in Civ 5 is that the AIs get -100 to -400 gold per turn, but people pointed out its a bug in the display code and they don't actually have that amount.

This has to be a bug and if it makes its way to the trade decision of AIs it probably is very bad.

alexban01 avatar May 29 '22 00:05 alexban01

At a quick glance I can't tell what could make it give negative numbers. Maybe its a display bug here as well? Probably not. Maybe it has been fixed in the meantime?

I'll try to look into it closer someday

alexban01 avatar May 29 '22 00:05 alexban01

I'm pretty sure this is fixed - do you see this still happening? If not I'll close this issue

yairm210 avatar Jun 20 '22 20:06 yairm210

I'm pretty sure this is fixed - do you see this still happening? If not I'll close this issue

Well, I don't think there was any fix PRs. The lines that @alexban011 mentioned still exist in the source.

touhidurrr avatar Jun 21 '22 05:06 touhidurrr