FLEECING the AI for gold!

@GKey, you pillage the road instead, it's more efficient and takes only 2 worker turns.
Like I've told: The proper change would be to subtract the gold received by the negotiating party.
And BUFFY does not include better AI (i.e. no AI alternations).

Wouldn't a better fix be to alter the AI's evaluation of an extra resource? Heck even something as simple as 1gpt for each unhappy/unhealthy (depending on resource) city would be better than now. And for strategics, a small amount of gold per new unit options available etc.

Even without the exploit involving the subsidy, it seems clear the AI should not be paying so much for resources it doesn't gain any benefit from.
 
Wouldn't a better fix be to alter the AI's evaluation of an extra resource?
Of course, making the AI playing smarter would be a plus.
The very essence of the exploit is duping the AI into having gold surplus, otherwise - it won't trade. Removing the (possibly) artificial surplus considering trades would address this part. It has very little side effects.
Yes, of course it would be still exploitable in multi-player but it takes more than a single player to set it up.

Heck even something as simple as 1gpt for each unhappy/unhealthy (depending on resource) city would be better than now. And for strategics, a small amount of gold per new unit options available etc.
That could possibly work but you'd need quite a bit of testing, also need to see how the AIs operate between themselves. So while the fix has potentially better outcome it's not easily implemented.
 
This isn't as bad as the super early Currency selling of crap like Myst on deity for 200+ gold in the early BCs, and when you do this to every single AI that you can netting 1500+ gold over a couple turns it's a bit abusive.

Zx, Marathon?
 
^^ Exactly, what I was about to say. Be honest with us trippleZ! :lol:
 
@Bestsss Thanks for clarifying that. Since BUFFY = BUG+BULL+HOF and BULL does include Better AI, I was thinking Better AI is in BUFFY.
 
Of course, making the AI playing smarter would be a plus.
The very essence of the exploit is duping the AI into having gold surplus, otherwise - it won't trade. Removing the (possibly) artificial surplus considering trades would address this part. It has very little side effects.
Yes, of course it would be still exploitable in multi-player but it takes more than a single player to set it up.
I guess I'm saying I don't consider that a fix because if for whatever reason an AI has a fair bit of surplus gpt (including possibly from your previous good-intentioned trades with them) then the amount of gpt they're prepared to give you for a useless resource is too much. They're still being exploited, just less deviously.


That could possibly work but you'd need quite a bit of testing, also need to see how the AIs operate between themselves. So while the fix has potentially better outcome it's not easily implemented.
The fix may not be trivial and require some testing, but same with any fix including your suggestion. For example by just subtracting how much gold the AI is getting from foreign trades from how much surplus they consider themselves to have, you might be reducing too far their willingness to trade and so there might be cases where before they might have been able to give away a few gpt for a useful resource, because they happen to be getting 10 or so gpt from foreign trade they're no longer willing to risk it.

Any fix will require due consideration of the consequences on the inter-AI diplomacy just as much as the human-AI diplomacy. For someone who works on AI code, I don't think any of these suggestions would be particularly difficult.
 
For example by just subtracting how much gold the AI is getting from foreign trades from how much surplus they consider themselves to have, you might be reducing too far their willingness to trade and so there might be cases...
I didn't say foreign trades but trades w/ the other party (i.e. the player) only. It just has the least possible side effects (still some, ofc) and it's a trivial fix and mitigates the exploit greatly. It doesn't require a lot of testing as it involves 2 parties only.
There are ways to create a lot better AI but if I was tasked to do so I'd abandon the existing code and random dicing altogether.

Imo, the C code (ok, it's C++ but it's C+some classes) is truly bad and modifying it to get better AI behavior require some serious persistence/stubbornness to put w/ it.

Side note: I have to write a longish post why the random generator is biased.
 
Is the fix necessary? How badly are the AIs who have this kind of :gold: to give being crippled by resource trades, on average? I bet a lot of you suggesting changes are doing so without knowing or caring, simply because you don't like the way this tactic "feels".

ZZZ accurately points out that you can get a lot more selling AI crappy techs they don't need anywhere near as much as :gold:. Across a single game, it's easily possible to get 5000+ :gold: this way, far beyond anything resource trading can do. Not only that, you get it as a lump sum up front, making it more valuable.

Maybe we should discuss the AI trading for techs it doesn't need, and have it avoid trading cash for non-monopoly techs. "This wouldn't have a big impact on the game".

Also, "insert any other canned justification for banning gold-for-resource trades here because it would apply equally well". Examples:

The very essence of the exploit is duping the AI into having gold surplus, otherwise - it won't trade. Removing the (possibly) artificial surplus considering trades would address this part. It has very little side effects.

Wouldn't a better fix be to alter the AI's evaluation of an extra resource?

Replace "resource" with "filler tech".

I could pull considerably more examples from different threads, but that would be kind-of cheating :p.

The fact of the matter is that we routinely abuse the AI doznes of times in every single game, and that neither the returns from this trick nor its core premise should single it out.
 
The AI are a bunch of masochists who love to be used, and abused. They come with this longing look in their eyes, and if you don't see it they become very sad. Don't give the AI depression spank them until they moan!
 
I didn't say foreign trades but trades w/ the other party (i.e. the player) only. It just has the least possible side effects (still some, ofc) and it's a trivial fix and mitigates the exploit greatly. It doesn't require a lot of testing as it involves 2 parties only.
It's more of a band-aid though. It's two different philosophies:
-easy fix that doesn't have too many side effects but doesn't address the core issue
vs.
-harder fix that will have more side effects but addresses the core issue
There are ways to create a lot better AI but if I was tasked to do so I'd abandon the existing code and random dicing altogether.

Imo, the C code (ok, it's C++ but it's C+some classes) is truly bad and modifying it to get better AI behavior require some serious persistence/stubbornness to put w/ it.
Not sure what that means, but karadoc works on AI in his mod. Changes like what we're suggesting here seem much simpler than other things he's accomplished.

Side note: I have to write a longish post why the random generator is biased.
Biased? It's an LCG.

Is the fix necessary? How badly are the AIs who have this kind of :gold: to give being crippled by resource trades, on average? I bet a lot of you suggesting changes are doing so without knowing or caring, simply because you don't like the way this tactic "feels".
I come at it from the angle of wanting to address AI issues, however minor they may be, although admittedly I don't implement any of them myself.

ZZZ accurately points out that you can get a lot more selling AI crappy techs they don't need anywhere near as much as :gold:. Across a single game, it's easily possible to get 5000+ :gold: this way, far beyond anything resource trading can do. Not only that, you get it as a lump sum up front, making it more valuable.
Sure, but there's a difference. Here you're only getting so much gold because you're selling to all of the AIs you can (or choose to) - "tech whoring". The sum you're getting from an individual AI isn't ridiculous is it? Keeping in mind an AI won't have a perfect sense of strategegic importance of every tech, it's reasonable for them to consider every tech at least somewhat valuable.

If tech whoring is to be considered a problem on the AI's part, it's because none of them recognise that all of their trading is happening with one partner - the human player.

Maybe we should discuss the AI trading for techs it doesn't need, and have it avoid trading cash for non-monopoly techs. "This wouldn't have a big impact on the game".

Also, "insert any other canned justification for banning gold-for-resource trades here because it would apply equally well". Examples:

Replace "resource" with "filler tech".

I could pull considerably more examples from different threads, but that would be kind-of cheating :p.

The fact of the matter is that we routinely abuse the AI doznes of times in every single game, and that neither the returns from this trick nor its core premise should single it out.
Fair to say. I'm saying this is more of an AI improvement than a bugfix. In that sense any similar way to use the AI (or some will call it an exploit) can receive similar treatment for a better-AI mod. If any one thing is being singled out, it's only because in order to implement any change you of course have to focus on one thing at a time. If the valuing of techs is more critical by all means address that first.

If a side effect is that Deity becomes harder, good.:)
 
@PieceOfMind
I did a lot of extensive tests (histograms, noise, phi square, etc) on the random generator - the LCG is ok but not the distribution function. For instance getting zero (i.e. resource pop off mine) is ~7.6 higher than it should be - testing through the entire cycle (full 32bit) of the LCG.

Overall it's very easy to see why it's biased - division by 2^16 would yield proper distribution only if N is power of 2 itself.

I hope I will find some time and motivation to write about.
---
As for the code of the game (SDK) - it's just lacks quality, the entire design is flawed. I understand it takes significant effort to write a good AI and it takes time and most people won't appreciate it. Imo the core of the problem: the AI design has no strategy what to do, rolls dice for almost any major decision, loops tiles, cities and more tiles. The complexity of many functions is unnecessary higher and so on. (not taking of better AI as I have no xp there). A bit of effort and the AI could at least try to simulate turns ahead into the players turn if there is a spare core (i.e. like chess engine).
Even though the code is C++, it basically does everything through enums and switch/case, no overriding, no different classes for the different units type. Look at the code that takes decision on next tech, thousands of lines for a single function.
Those are memories of over 3 years ago, so some fact might not be precise. And I'm sorry for the rant.
 
Sure, but there's a difference. Here you're only getting so much gold because you're selling to all of the AIs you can (or choose to) - "tech whoring". The sum you're getting from an individual AI isn't ridiculous is it?

You can get ~ 1 :science: for 1 :gold: return, and yes that is pretty ridiculous oftentimes, especially when giving them a junk tech and neutering their ability to research something tradeable themselves. Given the power of trading, you are *really* screwing them on these deals, and an individual trade could give you as much, up front, as you'd get from ALL of your "trade abuse" over 30-50+ turns...which you can then bankroll into more tech-for-gold (and more tech) abuse. Subsidy can't touch that effect.
If tech whoring is to be considered a problem on the AI's part, it's because none of them recognise that all of their trading is happening with one partner - the human player.
Tech trading, as a mechanic, is *fundamentally* flawed. It offers too much of a multiplier compared to every other :science: source in existence. This is compounded by the ability to trade with literally everyone before any of them even get a turn, and yes the ability to broker monopoly techs. The whole thing is just broken when compared to say the returns on micro, but because people are used to that since the early days of civ have always had it.

Fair to say. I'm saying this is more of an AI improvement than a bugfix. In that sense any similar way to use the AI (or some will call it an exploit) can receive similar treatment for a better-AI mod. If any one thing is being singled out, it's only because in order to implement any change you of course have to focus on one thing at a time. If the valuing of techs is more critical by all means address that first.

Yeah from an AI improvement standpoint you wouldn't want it to be making stupid trades, but that wouldn't be addressing this issue directly, but rather giving it a competent resource valuation system. If you did that, this kind of tactic wouldn't really be viable.

If a side effect is that Deity becomes harder, good.

kmod already made many deity starts impossible since they'll just archer rush you :D. I don't mind it though. More competent AI opponents (not to mention the only mod of civ IV that fixes the awful control bugs) is a welcome change, though a lot of "elite" players here don't like that their abuses went out the window ;).
 
@PieceOfMind
I did a lot of extensive tests (histograms, noise, phi square, etc) on the random generator - the LCG is ok but not the distribution function. For instance getting zero (i.e. resource pop off mine) is ~7.6 higher than it should be - testing through the entire cycle (full 32bit) of the LCG.

Overall it's very easy to see why it's biased - division by 2^16 would yield proper distribution only if N is power of 2 itself.

I hope I will find some time and motivation to write about.
Interesting. Well if you do get round to writing about it I'd like to read it. The only other person I remember talking about the quality of the RNG is RD-BH - I'm always keen to read his posts about it too.
---
As for the code of the game (SDK) - it's just lacks quality, the entire design is flawed. I understand it takes significant effort to write a good AI and it takes time and most people won't appreciate it. Imo the core of the problem: the AI design has no strategy what to do, rolls dice for almost any major decision, loops tiles, cities and more tiles. The complexity of many functions is unnecessary higher and so on. (not taking of better AI as I have no xp there). A bit of effort and the AI could at least try to simulate turns ahead into the players turn if there is a spare core (i.e. like chess engine).
Even though the code is C++, it basically does everything through enums and switch/case, no overriding, no different classes for the different units type. Look at the code that takes decision on next tech, thousands of lines for a single function.
Those are memories of over 3 years ago, so some fact might not be precise. And I'm sorry for the rant.
It does have some strategy (for example, it started winning by culture vic at some point, I think it was after release of BtS), but yes there is far more "dice rolling" than most people would like to believe. It's no exaggeration to say when an AI wins it's just as likely an accident than it was intended.

You can get ~ 1 :science: for 1 :gold: return, and yes that is pretty ridiculous oftentimes, especially when giving them a junk tech and neutering their ability to research something tradeable themselves. Given the power of trading, you are *really* screwing them on these deals, and an individual trade could give you as much, up front, as you'd get from ALL of your "trade abuse" over 30-50+ turns...which you can then bankroll into more tech-for-gold (and more tech) abuse.
I agree that as a multiplier it dwarfs all others, and so for optimum research it's inevitable it becomes a diplo game and how much trades you can squeeze at each opportunity. I don't think 1:science: for 1:gold: is that ridiculous for the AI - it only appears so because the human player is good at optimising their economy with science multipliers and slider. I think it's entirely legitimate strategy for the human player to take advantage of that.

I'm still sticking, at this point, to the thing being abusable being the fact you can trade almost completely freely with most of the AIs with no diplo repercussions or them even noticing that you're hogging the trades.
Subsidy can't touch that effect.
So 'subsidy' is the new name for it? :)
Tech trading, as a mechanic, is *fundamentally* flawed. It offers too much of a multiplier compared to every other :science: source in existence. This is compounded by the ability to trade with literally everyone before any of them even get a turn, and yes the ability to broker monopoly techs. The whole thing is just broken when compared to say the returns on micro, but because people are used to that since the early days of civ have always had it.
I see your point. It's starting to look like we're talking about changing the game mechanics, nerfing tech brokering to put it bluntly.
Yeah from an AI improvement standpoint you wouldn't want it to be making stupid trades, but that wouldn't be addressing this issue directly, but rather giving it a competent resource valuation system. If you did that, this kind of tactic wouldn't really be viable.

kmod already made many deity starts impossible since they'll just archer rush you :D. I don't mind it though. More competent AI opponents (not to mention the only mod of civ IV that fixes the awful control bugs) is a welcome change, though a lot of "elite" players here don't like that their abuses went out the window ;).
It's the only mod I play for BtS now.
 
I reran the mine popping test + chi square one. Very brief info:

Mine popping test
zero:Civ4( 10000) zeros= 106776, expected= 100000, max= 91717, deviation:6.7760%
zero:Civ+( 10000) zeros= 99739, expected= 100000, max= 100226, deviation:0.2610%
zero:java( 10000) zeros= 99278, expected= 100000, max= 100223, deviation:0.7220%
zero:jSec( 10000) zeros= 100171, expected= 100000, max= 100222, deviation:0.1710%

1st (civ4) is the vanilla generator (divides by 0x10000 which doesn't produce normal distribution)
2nd (civ+) is the one I fixed myself (doesn't divide by 0x10000)
3rd (java) is the standard java.util.Random that loops if the number would fail off the region (i.e. throwing out invalid randoms)
4th (jSec) is java.security.SecureRandom that's truly cryptographically strong one.


The results are of 1e9 attempts to generate random numbers (i.e. this one doesn't exhaust the entire 32bits although java ones have higher cycle 48+)

As you see generating the max number (9999) is also skewed in the civ4 rnd generator.
Chi square tests look tragic for civ4 but that's not the post I intend to do, so no more comments and no pictures, just the number in brackets is N. The number of iterations is N*27 - the results are the average of 1800 loops.

chi::Civ4 (29101) = 58309.010123, delta=29208.010123
chi::Civ+ (29101) = 29080.003086, delta=20.996914
chi::java (29101) = 29097.193498, delta=3.806502
chi::jSec (29101) = 29097.611481, delta=3.388519

chi::Civ4 (3011) = 3041.268642, delta=30.268642
chi::Civ+ (3011) = 3007.243333, delta=3.756667
chi::java (3011) = 3012.498230, delta=1.498230
chi::jSec (3011) = 3011.060741, delta=0.060741

chi::Civ4 (997) = 997.046337, delta=0.046337
chi::Civ+ (997) = 996.333498, delta=0.666502
chi::java (997) = 999.445967, delta=2.445967
chi::jSec (997) = 996.653251, delta=0.346749


I'd say the distribution function is sort of rookie mistake, similar to using mod function w/o throwing the candidates that are out of range. However, since most of the use cases of the rnd are comparing the generated number falling within not-so-short range -- it almost balances out for example generation number '4' w/ N=10000 is like 7% less than expected. So in the end it doesn't stand so much.
 
So 'subsidy' is the new name for it?

I don't know. It doesn't have the ring of DFM, Failaxis, MGB rushbuy, HOI HOI (hall of inca), or others. That said, it is probably the best indication of what happens ^_^. Sun Tzu Wu calls it "WPT" trades or something, but I don't think the typical play would immediately recognize what that stands for, whereas subsidy trades put you on the right track immediately.

I see your point. It's starting to look like we're talking about changing the game mechanics, nerfing tech brokering to put it bluntly.

I like putting it bluntly, and IMO if you want to make this game's multipliers more balanced (not to mention improve the AI by proxy), then yes, nerf the bejeezus out of tech trades. They've been too strong since they existed. Civ V actually did a good thing by nerfing the diplo-research mechanic, one of the few things right among many wrong with that game.

Interesting stuff on the RNG. My only issue with the RNG is early-game incidences of it where a single or small #outcomes changes the game drastically. RNG calls in the mid-late game would need meteor hitting two spaces 100 yards apart within a week levels of rarity (give or take ;))...but early on losing your city to a barb archer can easily cost the game.
 
I don't know. It doesn't have the ring of DFM, Failaxis, MGB rushbuy, HOI HOI (hall of inca), or others. That said, it is probably the best indication of what happens ^_^. Sun Tzu Wu calls it "WPT" trades or something, but I don't think the typical play would immediately recognize what that stands for, whereas subsidy trades put you on the right track immediately.

Subsidy is the original naming of this mechanics.
The first time I laid my eyes onto this bug/tactic, that was here, the origin of evil.
 
bestsss, sorry but you might need to write an executive summary for there to be any hope of me understanding your findings. It's been a while since I've seen chi-square tests.
 
Subsidy is the original naming of this mechanics.
The first time I laid my eyes onto this bug/tactic, that was here, the origin of evil.

I won't even pretend this is not an exploit, since any sensible player would cancel their tribute to an AI guilt-free after 10 turns were up.

Semantics, but let's call a spade a spade, shall we?
 
Semantics, but let's call a spade a spade, shall we?

The issue isn't solely whether one AI abuse is an exploit, but rather at drawing the lines in terms of what ISN'T.

If you accept this type of behavior as exploitatitve, you open a floodgate for a whole boatload of actions which take advantage of known AI limitations and provide a much larger advantage on a consistent basis.
 
Back
Top Bottom