How to prevent cheaters from editing game sprites

thom

Member
Hi,

The online community of my game Ultimate Racing 2D found out that people were cheating in online multiplayer. The game uses an (invisible) grass sprite to detect when someone is driving on the grass and should therefore be slowed down. However the cheaters have been able to change this sprite and remove the parts of it so they are not slowed down by the grass anymore. I believe with tools like https://yal.cc/r/17/yytextureview/ it's possible to change the game sprites. My question is, if it is possible to prevent players from changing the game sprites?

Edit: I believe they use the UndertaleModTool to decompile the data.win file of the game
 
Last edited:

FrostyCat

Member
There is no sustainable way to do it. This is entirely your fault for trusting clients with canonical data and using your presentation as your model.
 

Bluetail7

Member
While I can't offer a solution to your question, I can provide some workarounds.

You could use different ways to check if the sprite has been modified.

I might list some but those are simple and perhaps inefficient ideas.

  • Check file size of your game vs modified version
  • Do a exhaustive check with get_pixel through the whole sprite
  • Do a test vs the grass before the matchmaking begins (say like a loading screen): if the vehicle crosses said limit after X interval of time then it's a modified version.
 

EvanSki

Raccoon Jam Host
If the grass are not tiles, could just make them tiles
then check if they are on tiles, even if they modified the sprite, game maker would still have the tile information
 

NightFrost

Member
As Frosty says, the only real solution would be to make your game server the decisionmaker. At client end, you can only try to obfuscate. I haven't worked much with tiles which are suggested above, but they might be one way to go. You check which tiles the player overlaps, look at their specifics, and if any is grass you slow down. This locks you into grid-shaped terrain however. And since the collision boxes of the vehicles are rotating boxes I guess, overlap is not just a rectangle in rectangle check, but you have to calculate whether two rectangles at arbitrary rotation angles are overlapping (there's math for that). Alternatively, if your grass patches are large continuous areas, you could describe them as polygons and check whether a vehicle rectangle overlaps a polygon.
 

Tyg

Member
Flatten the tire with spikes :)
Log their IP and send the destruct code
Spash cheater all over the screen
or let them have their fun, its a game

But on the topic, are the sprites embedded in the exe or loaded externally?
you could have an encryption function that could have a key to load sprites
if the checksum doesnt match, cheater cheater cheater :)

 

thom

Member
Thank you for all the answers, I will try them out. The sprites are embedded in the game, they decompile the data.win file to get them. It can be done with UndertaleModTool.
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
The fastest way to compare the sprites is to hash them (using a tool like sha256sum, I don't remember if GM has a built-in function for this or only Base64 (which is something completely different that you should'nt use)).

Hash all grass sprites locally (e.g. hash the current level's sprite when the level loads), then ask the server for the canonical hash. If the hashes are different, the local files have been modified, and you should take action. (E.g. kick the player out of the race with a "cheater" message, or modify their top speed so they lose their unfair advantage)
 
Top