The Self-Modifying Game

Back in the good old days, we programming cowboys had a trick that's seldom used these days: self-modifying code. One segment of code re-wrote another segment of code. This was frowned upon because it made debugging particularly difficult. How could you tell where the problem was arising if you couldn't know which version of the code was actually executing?

Nevertheless, there were some situations in which self-modifying code was useful. One of these was anti-piracy. If self-modifying code was difficult for the programmer to debug, imagine how tough it would be on a pirate! I used that trick twice, and I still smile at the thought of some poor teenage geek running through code, trying to figure it out, and then encountering ...

Get Chris Crawford on Game Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.