I've been asked to patch a few minor flaws in a game of the unreal series. It uses the unrealscript language which produces bytecode in a similar way to Java.
One of the issues is that it's possible to edit any packages downloaded to a client and insert a goto
instruction to jump over important bits of code.
It isn't possible to prevent this so I'm wondering what sort of strategies could be applied to make the task more difficult. There's two approaches that come to mind:
An automatic internal state checking mecanism for anything that is clientside. The way it be done would be to have a before and after check for each function call. One peculiarity of the language is the out keyword in functions (see below).
The "out" specified lets you tell a function that it should actually modify the variable that is passed to it, rather than making a local copy. This is useful, for example, if you have a function that needs to return several values to the caller. You can just have the caller pass several variables to the function which are "out" values.
A serverside checking mecanism that takes action if something incoherent happens or there is a timeout. Obviously, code can't be bounced between the client and server every tick because of the overhead it would generate but it would be possible to have some information exchanged, say, every x seconds.
Perhaps the two approaches could be combined. What is your opinion on this?