Skip to content
mmcgill edited this page Mar 31, 2012 · 1 revision

Overview

The DVR plugin is a message recording/playback tool to be used for testing plugins. To record messages, run DVR as a plugin. To play those messages back through the mc3p proxy for plugin testing, run DVR as a stand-alone python module. When run by itself, DVR acts as both a client and a server.

Walkthrough

DVR as a plugin: Capture messages to a file

To capture all messages sent between your Minecraft client and server.com for a Minecraft session, run mc3p with the DVR plugin, like so:

$ python -m mc3p.proxy --plugin 'mc3p.plugin.dvr(-s * -c * session01)' server.com

Notice two things about this command: First, we place the --plugin argument in single quotes. This causes the whole string inside the quotes to be passed as a single argument to mc3p. If you leave off the quotes, mc3p won't be able to parse its arguments. Next, we pass the parameters -s * -c * session01 to the DVR plugin.

The -s argument tells DVR which messages from the server should be recorded. Similarly, the -c argument tells DVR which messages from the client should be recorded. In both cases, we pass '*' to indicate that all messages should be recorded. To record a specific set of messages, use a comma-delimited list of message IDs (e.g. -s 0x01,0x02,0x03). If you leave off -s (or -c), DVR won't record messages from the client (or server).

Now fire up your Minecraft proxy and add localhost as a server. You should see the server message for server.com. Connect, play around for a few seconds, and then disconnect. Stop mc3p with Ctrl-C.

You should now have two files, session01.cli and session01.srv. The first contains all messages sent from your client, the second (which will be much larger) contains all messages sent from server.com.

DVR stand-alone: Replay captured messages through the mc3p proxy

Now that you've captured a session, you can replay it through mc3p repeatedly to test plugins.

First, start mc3p with the plugin you want to test (we'll use the example mute plugin to demonstrate). You should point mc3p to localhost, since DVR will act as both client and server:

$ python -m mc3p.proxy --plugin mc3p.plugin.mute localhost

Now, in another terminal, replay session01 with DVR:

$ python -m mc3p.plugin.dvr session01

By default, DVR replays captured sessions in real time. If you want to speed up or slow down the replay, use the -x parameter. Passing -x 2 replays a session at twice normal speed; -x 0.5 replays at half normal speed.

You can also use DVR to replay a session through an mc3p proxy running on another server. Suppose you have mc3p installed on hosts red and blue. You want to test your plugin on blue, using red as the replay server. On blue, start mc3p with your plugin, and point it at red:

blue$ python -m mc3p.proxy --plugin awesome.sauce red

On red, run DVR with the -via option:

red$ python -m mc3p.plugin.dvr --via blue session01