Thread Tools
Old December 3, 2001, 19:19   #1
jadlakha
Warlord
 
jadlakha's Avatar
 
Local Time: 17:57
Local Date: October 31, 2010
Join Date: Apr 2001
Posts: 127
An Explanation of the Trillion Dollar from AI cheat(NOT BUG)
Well first of all this is not a bug and I think Firaxis or Infrogames or whoever should not even worry about this issue because its not a bug. ITS A CHEAT. This cheat in no way hinders gameplay whatsoever, its up to the human to take advantage of it, people need to stop complaining about it. If you dont like this cheat then dont use it, why should you care that someone else in there own single player game takes advantage of it?

Anyways onto the main point. Although I have a limited knowledge of C++, from what I do know this error has to do with the fact there is a limit on the size of integer a computer can handle. For civ 3 I would assume that asking money from other civs would be declared as an int since nobody is going to make more then 32,000 or so gold and 32,000 is the limit for what the computer can handle for int variables. A solution would be probably to change it to a long. Longs are the same as int variables except they can go much higher without the computer returning incorrect data. Actually the variable may already be a long, I dont know, if thats the case the only solution would be to limit the number of digits in the per turn or lump sum box to 4 or 5. That way the most you could ask for would be 9,999 and the AI would reject that since its not out of the range of the 32,000 so the cpu could do the calculatiosn without errors. This is just a thought and please correct me if Im wrong. And I hope you'll can even understand what Im talking about.
jadlakha is offline  
Old December 3, 2001, 19:39   #2
Libertarian
King
 
Local Time: 12:57
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 1,267
I think it's unsigned long, isn't it? Assuming 32-bit development tools. That would be easy enough to test.
__________________
"Entia non sunt multiplicanda praeter necessitatum." — William of Ockham
Libertarian is offline  
Old December 3, 2001, 19:46   #3
cassembler
Prince
 
cassembler's Avatar
 
Local Time: 11:57
Local Date: October 31, 2010
Join Date: Oct 2001
Location: J.R. Bentley's, Arlington, Tx
Posts: 391
I agree with what you're saying about it being a cheat and not a bug. I reminded of Civ1 where you could hold down shift and hit f1, f2, f3, f4... and you'd get the cheat mode. It was something you had to consciously do.
__________________
"You don't have to be modest if you know you're right."- L. Rigdon
cassembler is offline  
Old December 3, 2001, 20:08   #4
ham50
Settler
 
Local Time: 17:57
Local Date: October 31, 2010
Join Date: Sep 1999
Posts: 25
It is probably not the data type they used, but what they used to control how the AI deals with the gold transactions. When it goes 9999999999999, the function breaks, dropping the variable without the computer checking to see if the amount can be taken from the other civ. Since the flag that says "DO NOT DO THIS" did not pop up, the computer assumes that the number is ok, and gives it away, causing the AI's gold to go negative. The best way to fix this would be to check if the civ has a negative number for it's gold if the transaction were to take place. If it is, then it won't do it.

This is a bug, I doubt the programmers thought that typing in a large number should give the player that amount.
ham50 is offline  
Old December 3, 2001, 22:24   #5
adaMada
Civilization III Democracy GameTrade Wars / BlackNova TradersPtWDG RoleplayRise of Nations MultiplayerInterSite Democracy Game: Apolyton Team
King
 
adaMada's Avatar
 
Local Time: 12:57
Local Date: October 31, 2010
Join Date: Mar 2000
Location: "The Iron" Stadium, Ubergorsk, Apolytonia (C3DG)
Posts: 1,848
If i'm correct (i'm probably not), with what I know about programming (which is probably wrong ), if they want to make the variable as large as possible, they'd use an unsigned double. As that can hold MANY more digits then the input box, that'd eliminate the problem... however, a more elegant (read -- less memory intensive) solution would be to, as ham said, limit the number of digits allowed in the box... either way, it shouldn't be a huge fix for faraxis...

-- adaMada
__________________
Civ 3 Democracy Game:
PTW Game: Proud member of the Roleplay Team, and Ambassador to Glory of War
Intersite PTW Game: Member of Apolyton
adaMada is offline  
Old December 4, 2001, 00:38   #6
sophist
Prince
 
sophist's Avatar
 
Local Time: 11:57
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 532
This is clearly a signing bug. They didn't declare the variable as unsigned somewhere (like in the routines to handle calculations of whether a deal was valid), so when comparing 999999 against 0, it comes out as less rather than more and screws it up. That's it.

As far as memory use goes... 4 bytes does not a memory problem make. An unsigned 4-byte integer is plenty to hold the gold you get in this game. C'mon now.... memory? Elegance? Puh-lease.
sophist is offline  
Old December 4, 2001, 18:17   #7
chazmyrr
Settler
 
Local Time: 17:57
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 7
It's not clear to me that the problem is in the variable that contains what you type so much as the one that measures how desperate the AI is. When I ran into this, I had an AI civ on the ropes very early in the game. I decied to ask for everything I could to get peace. I clicked all the techs. The advisor said it's acceptable. I click all the cities. The advisor said it's acceptable. I ask for all the gold in his treasury. Acceptable. I ask for 10 gold per turn. Acceptable. I up it to 50 per turn. Acceptable. Continue until I reach 50k per turn. Acceptable. Decide it's bug and start a new game.

I know that the AI is capable of pulling units and money out of thin air. I have watched the AI do this repeatedly. I'm not saying that there isn't a problem with the input box, but my experience leads me to suspect that if the AI is desperate enough, it will manufacture whatever gold per turn it takes to buy peace.
chazmyrr is offline  
Old December 4, 2001, 20:27   #8
wervdon
InterSite Democracy Game: Apolyton TeamC3C IDG: Apolyton Team
Prince
 
Local Time: 11:57
Local Date: October 31, 2010
Join Date: Nov 2001
Posts: 812
Actually, Im pretty sure that the AI doesnt go into negative gold when you use this cheat, from best I can tell its impossible for anyone to go into negative gold.

As a test, I tried to see what would happen when Im the one giving away more gold than I have. I ran the test by giving another civ a "gift" of the amount of gold per turn I was taking in, and all my treasury gold. (Ironically they'd refuse to accept it if I offered them more gold per turn than I had coming in), then change my tax rate so that I had 0 gold in my treasury and negative gold per turn counting the gold I was sending to them. What happened? I sat at 0 gold, and ran about three turns, before I was satisfied. From best I could tell, they was still getting my gift each turn, and I wasn't being forced to sell off improvements or units (unless it was done without my knowledge, but the negative per turn stayed the same).
wervdon is offline  
Old December 4, 2001, 20:37   #9
Nadexander
Warlord
 
Nadexander's Avatar
 
Local Time: 09:57
Local Date: October 31, 2010
Join Date: Mar 2001
Location: Saratoga, California
Posts: 122
Re: An Explanation of the Trillion Dollar from AI cheat(NOT BUG)
Not only is this a bug, its a very common programming error. Simple failure to check inputs properly. Should be corrected in the patch.
Nadexander is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 13:57.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team