Hacker News new | ask | show | jobs
by just2n 4601 days ago
A long long time ago before I ever wrote a line of code, I'd just play all the games I could. I was fascinated by how they worked. I later found a book on BASIC that introduced programming by having the reader write simple word games. After learning the basics, I then would wonder how FF1 managed to change states from being in a tiled map and exploring the world into a battle screen and back again, which led me to more learning and eventually I ended up making a very shoddy Zelda clone that ran in DOS. I think I was 11 or 12 at the time?

Anyway, one day a long time after that, I was playing this new mod for Half-Life called Counter-Strike. It was fun, and I had started learning C and about OpenGL to understand a bit more about how HL worked itself. But on this day I saw a guy just running through de_dust getting tons of headshots. Watching his camera, it seemed he had superhuman aiming. Comments about cheating flew, and this was long before the game was infested with cheats. He also seemed to know where everyone was. How?

A few hours later I discovered he was using a cheat called ViperG. It along with another cheat called XQZ were the only known public cheats at the time. ViperG was open sourced on a forum called clientbot at the time. Since I was learning C, I was actually able to read the code. Back then, HL only imported mod client function implementations using DLL imports, so you could write a DLL that exported fake client functions while also importing the real ones from a renamed client.dll, which let your cheat intercept all of the client API calls. Most in ViperG were just pass throughs, but one would gather entity information from a drawing API and another would draw some text on the screen in a HUD update API, etc. It was almost no code but it rendered little '+' signs on every player through walls and would let you automatically aim at their heads. Crazy.

This is when I realized that I could actually take software people had written and break it to make it do whatever I wanted, and that's when I feel like I really started learning things. Understanding how programs ran on my OS and learning how to reverse engineer came pretty rapidly. XQZ was closed source but had some really nice features, so I'd reverse its gl function exports and figure out exactly what it was doing so I could replicate them in my own cheat.

Doing what the author did here for modern MMOs can actually be a very difficult exercise, even for seasoned reverse code engineers. I've done it for several games, essentially reversing the entire netcode to write cheats that automate client actions, and there are all sorts of ridiculous traps I've seen to prevent you from doing so. One game even went so far as to require you to parse a terrain file and send the cell ID of your movement target in every movement packet, along with the absolute coordinates. This was slow as an iterative find process as a map had tens of thousands of triangles and you'd be sending these quite often, so naively you'd just loop over each triangle and check if your target coordinates were inside of it. This gave me a nice introduction into quadtrees and other algorithms that can make this operation asymptotically much faster. Yay learning.

To this day, I can only play a game so much before I get an overwhelming urge to break it. I think that despite the stigma of cheating, it's a great way to learn. It's comparable to taking something apart to see how it works and change it around a bit. Just don't take it too far and ruin games for other people.

2 comments

Cool story, and I can see the appeal. But as a (long ago) competitive CS player, I hate(d) your kind.
If you think about it, I bet what you actually hate are the folks who just downloaded the cheat and used it, without knowing anything about it. But what if everyone wrote their own exploit? Eventually every game would devolve into Core Wars, but this would be kind of cool.
If everyone did write their own exploit, I'd still have hated it. Cheating in those kind of games really does ruin the game for everyone else. Enabling those people to do what they did was nearly as bad IMO.
I competed in a couple of the early CAL seasons legitimately (main and then invite). Most of us never condoned cheating in league play or even in most public servers. That's the part where you're ruining games for other people. There were, at one point, quite a few servers dedicated to cheating, however, and even a competitive scene to see who could make the best cheats.

But leagues actually made things more interesting. They started creating their own anti-cheats and those were just new shiny toys to break as well. It's quite satisfying to defeat them, even if the goal isn't to cheat in a league.

The worst cheaters seemed to be the guys that played in the [inter]national competitions. They would cheat, say "online doesn't matter, LAN noob", and ruin the game for everyone.

But like I said, I can see the appeal of creating the cheats at least. My first introduction to real programming was creating a mIRC script that would login and "vote" on a popular local website where there was a 15 minute delay between votes - where the developer kept changing forms and URLs to stop my script from working.

were you part of any communities? mpc, ogc, game-deception?
I was. Unfortunately it seems like they're all dead or generally inactive these days. I do wonder where the new communities are, because surely there are kids going through the same things we all went through in learning by breaking things.
Kids today grow up with iPhones and iPads instead so there's not much opportunity to do anything outside the box.