Sunday, September 16, 2012

Minecraft X-Ray Overlay (2010)

In 2010 I went on an extremely brief but equally intense Minecraft binge.  Shortly afterwards I undertook the meta-challenge of writing some kind of network protocol analyzer (with much help from this page) to grok the state of the world and help me find resources.  Sure enough, this evolved (devolved?) into a 3D overlay that allows the player to see through walls:

This not a hacked client.  It is in fact a normal Windows desktop application, written in C#, that acts as a proxy between the regular Minecraft client and the server, a sort of voluntary man-in-the-middle attack:
MCPA (Minecraft Protocol Analyzer) sits between the Minecraft server and client. 
The application intercepts all network traffic and parses it to build an internal representation of the Minecraft world.  It displays three windows:
Minecraft protocol analyzer.
The top-left window is the setup window, where the user can configure the server address book and indicate which specific type of resource they would like to use as a target for the compass on the overlay.  The top-right window is a debugging window that displays information about a configurable portion of the network traffic.  And last but not least, the overlay window is a transparent, borderless window that always resizes and repositions itself to render atop the Minecraft client window:
The overlay window.
The overlay window displays a 3D view of "points of interest" near the player, namely specific types of ore and hazardous substances like lava.  The 3D rendering is performed simply through GDI+, with a home-grown wireframe renderer.  I guesstimated the projection parameters to more or less match what is seen in-game. You may have noticed in the video that there is a bit of a delay between the real game display and the update of the overlay.  This is mostly due to the network processing delay; because the overlay is constructed from network data, MCPA has to wait until it receives the packets the client sends out when the player rotates her head.

The "HACK!" button on the top-left window serves as a debugging launchpoint for an experiment in packet injection, where MCPA manipulates client and server state.  It is able to move and dig in a limited fashion;  I had started writing an A* to auto-mine resources, but I eventually ran out of interest and moved to other projects.

I just noticed at the time of this writing that Mojang appears to have added encryption to their network feeds on the latest versions of Minecraft, which breaks MCPA.  I would have to dig and see whether MCPA could be made to work at all despite this change, but it would probably require a fair amount of work.

(A note of intent: this software was never released, and it was only ever used on private servers with my friends and coworkers who are also game developers before it was possible to switch between creative and survival mode on a player-by-player basis and at will. They knew I was developing and using the software, and I always made sure to mine very far from the home base so as not to prevent them from finding materials for themselves when they so wished. The materials found using this overlay were used to benefit the server community and allow the group construction of elaborate structures; the goal was never to cheat and gain a personal edge of some sort or to grief other players.)

No comments:

Post a Comment