How to prevent cheating in PBEM by "doctoring" TXT
Moderators: firepowerjohan, rkr1958, Happycat, Slitherine Core
-
Peter Stauffenberg
- General - Carrier

- Posts: 4745
- Joined: Sun Jul 08, 2007 4:13 pm
- Location: Oslo, Norway
How to prevent cheating in PBEM by "doctoring" TXT
I'm playing a PBEM game with Happycat and we are implementing some house rules and changes. E. g. I suggested that we should alter the rail capacity for each side and suggested Allies: 2, Axis: 3 Russia: 4. He agreed this was a good idea and I altered the General.txt file and sent it to him too.
I then opened our existing on-going save game to make my moves and noticed the change I made for possible use in future games ALREADY was possible to use in the existing game. No information is given that the TXT file is altered. Happycat could use it too with no warnings.
I therefore realized that this means players can alter all TXT files at any time to "doctor" the rules for the game. E. g. is it possible to go into the units.txt file and make all the Axis units stronger and Allied units weaker and not let the Axis units use oil. So every time you make a move for your side you're cheating. When the save file is sent to the other player he will use the normal txt file and not get a warning about the first playing having doctored with the file.
This is a very easy way of cheating that's impossible to detect unless the cheating player becomes too greedy and gives his garrisons strength of 9 and movement of 9 and they destroyed the opponent armor units like they were understrength garrisons.
So I wonder if it's possible for a future version of the game to save all the contents from the TXT files used in the game to the save file when you save the game. Every time you load a save game you compare the content from the TXT file stored in the save game with the content of your own TXT files on the computer. If the values aren't the same then a dialog box should pop up telling that there is a mismatch and maybe what the mismatch is. Then it will not be possible to cheat by altering your own TXT files. Because the content of your TXT files will be stored into the save game you send to your opponent and compared with his TXT files when he opens your last save game file.
I know most people play and don't cheat. You have to trust your opponents. But reality shows that when you play on Internet and can hide behind nicknames etc. some people cheat. Especially if you can earn some ranks etc. like in Company of Heroes. My above example can't remove cheating completely, but it will make it harder to get a big advantage.
So I wondered if this is possible to do in for a future patch or is it too complicated?
I then opened our existing on-going save game to make my moves and noticed the change I made for possible use in future games ALREADY was possible to use in the existing game. No information is given that the TXT file is altered. Happycat could use it too with no warnings.
I therefore realized that this means players can alter all TXT files at any time to "doctor" the rules for the game. E. g. is it possible to go into the units.txt file and make all the Axis units stronger and Allied units weaker and not let the Axis units use oil. So every time you make a move for your side you're cheating. When the save file is sent to the other player he will use the normal txt file and not get a warning about the first playing having doctored with the file.
This is a very easy way of cheating that's impossible to detect unless the cheating player becomes too greedy and gives his garrisons strength of 9 and movement of 9 and they destroyed the opponent armor units like they were understrength garrisons.
So I wonder if it's possible for a future version of the game to save all the contents from the TXT files used in the game to the save file when you save the game. Every time you load a save game you compare the content from the TXT file stored in the save game with the content of your own TXT files on the computer. If the values aren't the same then a dialog box should pop up telling that there is a mismatch and maybe what the mismatch is. Then it will not be possible to cheat by altering your own TXT files. Because the content of your TXT files will be stored into the save game you send to your opponent and compared with his TXT files when he opens your last save game file.
I know most people play and don't cheat. You have to trust your opponents. But reality shows that when you play on Internet and can hide behind nicknames etc. some people cheat. Especially if you can earn some ranks etc. like in Company of Heroes. My above example can't remove cheating completely, but it will make it harder to get a big advantage.
So I wondered if this is possible to do in for a future patch or is it too complicated?
-
IainMcNeil
- Site Admin

- Posts: 13558
- Joined: Fri Apr 01, 2005 10:19 am
-
Peter Stauffenberg
- General - Carrier

- Posts: 4745
- Joined: Sun Jul 08, 2007 4:13 pm
- Location: Oslo, Norway
I guess you load the content of the TXT files stored on the local computer when you load the save game. All you need to do is to save the data you read from the TXT to the new data file when the player saves his turn. Then the save game contains the "rules" the turn was performed with.
So when the next player loads the save game he receives from his opponent the game will load the TXT data from the local computer of the next player and compare it will the data stored in the save game. If they are the same then the player can continue his game. If they are not the same the game should abort with a message saying there is a mismatch between the TXT files. Then the next player will know the first player has doctored his TXT files.
This will NOT affect any mods because all that is required is that both player have the same TXT data. It doesn't have to be the same as the original game.
So when the next player loads the save game he receives from his opponent the game will load the TXT data from the local computer of the next player and compare it will the data stored in the save game. If they are the same then the player can continue his game. If they are not the same the game should abort with a message saying there is a mismatch between the TXT files. Then the next player will know the first player has doctored his TXT files.
This will NOT affect any mods because all that is required is that both player have the same TXT data. It doesn't have to be the same as the original game.
-
IainMcNeil
- Site Admin

- Posts: 13558
- Joined: Fri Apr 01, 2005 10:19 am
-
Peter Stauffenberg
- General - Carrier

- Posts: 4745
- Joined: Sun Jul 08, 2007 4:13 pm
- Location: Oslo, Norway
No it doesn't have to be more tricky. The code today reads the TXT files when loading the game and these values will be used for performing everything during the player turn. The player can change the TXT files how much he wants to afterwards, but it won't affect the current turn.
The player must save the game so he can send the save file to his opponent. All you need to do is to save the TXT file values stored in the memory of the computer to the save game. This ensures that the save game will contain the SAME values as the turn was processed with. The save game is encrypted so it's hard to doctor the values within there.
You always need to read the TXT files when loading the game because the values can be different than the original ones. So some place in the computer while the game is active will these values be stored. No player can change these values after they've been loaded. When you save the game you simply save the values you read at the beginning of the turn (the values stored in variables in the program code). So it's not possible to cheat with such a method.
The other player can alter the TXT file before he loads the save game, but if he does that the game will abort anyway because the TXT files are not the same. But if the other player loads the game and it's aborted then he knows the first player performed his turn with different TXT data than he's using himself. Then he knows the first player must have changed them, probably in his favour and thus cheating.
So the key here is to read the data from the TXT file when you load the game and keep these values for the entire turn stored in the computer and save the stored values to the new save game.
I guess you don't read the TXT files locally every time something is happening during a turn? That is very inefficient. I guess you load all TXT values when the game load (that's one reason the loading time is quite long) and store all these values into variables. When you need to know the content of one value you just check the variable. That is much quicker and I'm 99% sure this is the way you have programmed it.
The player must save the game so he can send the save file to his opponent. All you need to do is to save the TXT file values stored in the memory of the computer to the save game. This ensures that the save game will contain the SAME values as the turn was processed with. The save game is encrypted so it's hard to doctor the values within there.
You always need to read the TXT files when loading the game because the values can be different than the original ones. So some place in the computer while the game is active will these values be stored. No player can change these values after they've been loaded. When you save the game you simply save the values you read at the beginning of the turn (the values stored in variables in the program code). So it's not possible to cheat with such a method.
The other player can alter the TXT file before he loads the save game, but if he does that the game will abort anyway because the TXT files are not the same. But if the other player loads the game and it's aborted then he knows the first player performed his turn with different TXT data than he's using himself. Then he knows the first player must have changed them, probably in his favour and thus cheating.
So the key here is to read the data from the TXT file when you load the game and keep these values for the entire turn stored in the computer and save the stored values to the new save game.
I guess you don't read the TXT files locally every time something is happening during a turn? That is very inefficient. I guess you load all TXT values when the game load (that's one reason the loading time is quite long) and store all these values into variables. When you need to know the content of one value you just check the variable. That is much quicker and I'm 99% sure this is the way you have programmed it.
-
davetheroad
- Administrative Corporal - SdKfz 232 8Rad

- Posts: 154
- Joined: Wed Jun 13, 2007 6:59 am
Does calculating this digest or whatever take into account the change of even one letter or number in the text file?
If so this might be the way to do it as only one variable is stored in the save file for each text file. Of course this might be pointless if the devious gamer could read and change that variable.
Dave
If so this might be the way to do it as only one variable is stored in the save file for each text file. Of course this might be pointless if the devious gamer could read and change that variable.
Dave
-
IainMcNeil
- Site Admin

- Posts: 13558
- Joined: Fri Apr 01, 2005 10:19 am
-
sagji
- Sergeant Major - Armoured Train

- Posts: 567
- Joined: Sun Nov 06, 2005 12:13 pm
- Location: Manchester, UK
Yes any change will alter the digest - even adding a space on the end of a line.davetheroad wrote:Does calculating this digest or whatever take into account the change of even one letter or number in the text file?
If so this might be the way to do it as only one variable is stored in the save file for each text file. Of course this might be pointless if the devious gamer could read and change that variable.
Dave
-
Happycat
- 1st Lieutenant - Grenadier

- Posts: 766
- Joined: Tue Jul 03, 2007 12:57 am
- Location: Riverview NB Canada
I suppose that inadvertant cheating is possible too. Presumably, if you are playing a PBEM with one person, utilizing an altered text file that has been agreed upon by both parties. you need to remember to restore the original "vanilla" text file for any other PBEM you are involved in, where mods are NOT being used? And, if you keep flipping back and forth between text files, does this affect the digest?
Chance favours the prepared mind.
-
sagji
- Sergeant Major - Armoured Train

- Posts: 567
- Joined: Sun Nov 06, 2005 12:13 pm
- Location: Manchester, UK
Each file will have its own unique value for the digest, so this will tell you if you have the wrong file for the game you are loading, but won't tell you which file is the right one.Happycat wrote:I suppose that inadvertant cheating is possible too. Presumably, if you are playing a PBEM with one person, utilizing an altered text file that has been agreed upon by both parties. you need to remember to restore the original "vanilla" text file for any other PBEM you are involved in, where mods are NOT being used? And, if you keep flipping back and forth between text files, does this affect the digest?
-
Happycat
- 1st Lieutenant - Grenadier

- Posts: 766
- Joined: Tue Jul 03, 2007 12:57 am
- Location: Riverview NB Canada
Sagi: if one is playing multiple "mods", is there an easy way to keep this from happening inadvertantly? What I have been doing is changing file names (labelling the generic files with the prefix "vanilla" while using a mod file), and then changing them back. It is a bit tedious, and perhaps there is a better way? What about multiple directorys for the entire game? (i.e. is it possible to have more than one installation of the game on the computer? Or will it confuse the registry?)
Chance favours the prepared mind.