I know this is a very specific question, but cheating in games is a hot topic, I was wondering if obfuscating base address of important pointers and obfuscating member variables offsets is a valid anti-cheating measure?
Member variables addresses usually change when the game is restarted, while base addresses of pointers are always the same, so cheaters find base addresses of game objects, which hold important data, then add offsets to get to member variables to read information stored inside them (like game->player[0]->health).
If game developers added a random number of variables (or just some data) before the declaration of the game class pointer and added some random length data before important member variables (e.g. before game->player and player->health), wouldn't it put an additional burden to cheaters? They would have to find base addresses anew everytime the game is recompiled, or find some other more time-consuming methods of finding important member variables in memory.
I'm not a C++ programmer, does C++ allow to do this during compile-time or maybe even during game launch? Are there any tools for that or would you need to write a custom parser for this? Or maybe this approach wouldn't work at all for some reason?
EDIT: I'm mostly talking about online games, where you have to connect to a game server, so I'm sure there is a way to make sure that cheaters can't avoid updating the exe file, if it was forced by game DEVs (by changing game packet structure for both server and client for example).