Been toying around with a basic browser-based game for a while now, and getting deep into the vulnerabilities of client-side script. I know enough to understand that no client-side script is ever safe. Ever. But I don't fully understand to what degree.
Using, say, Chrome's developer tools, I know I can set variables at will - even Object.freeze
and Object.seal
can be overcome. I also know I can put in breakpoints at key points and use the console to read variable values. Now, let's say I have a function checkStep()
that fires each time the player moves on the grid. It sends a blank ajax request, and the server returns only a boolean to signify if a random battle has started or not. If a user is able to rewrite/disable this checkStep()
, they can effectively eliminate random battles. Is there a way to redefine or disable functions from the console command line? If you were bent on preventing this function from firing, how would you do it? Could you even do it?
EDIT Clearly I worded this poorly. Going to accept the current answer and re-post.