Video Game Plugin

A few years back I wanted a network enabled plugin for the game Oblivion.  So I set out to create a plugin for OBSE (Oblivion Script Extender).  I dubbed it the Network Pipe OBSE.  What it does is creates a network port that allows Oblivion mods (modifications) to connect to external network resources.  It does this by creating a port on the local machine.  This port can be communicated to via external programs.  The idea is that an external program can be written to connect to say a database, or even a website.  This would allow an in game journal to blog onto a website while playing the game.  It could also be used to connect to a database so that a mod could use it for a data store.

This plugin was quite interesting to code.  I ended up using the Boost C++ library.  I chose Boost because I liked the threading interface and it cleaned up the code quite a bit.  This allowed the communication to external programs to happen in parallel to the actual game.  The game was only notified when a message arrived and the internal game scripting would parse the messages as appropriate.  The messaging to and from the plugin was all done with JSON.  I found a great library for handling those messages in C++.  Some of the trickiest parts of the code was converting unicode JSON messages to a string format the game could understand internally.

When I completed this code I tested it out.  I added the plugin to the family living room computer.  I setup a webpage on another computer that I could access from my phone.  The webpage would send messages to the family room computer to trigger events such as sounds, random characters spawning, etc.  Then I sat and watched a kid play the game Oblivion.  With my phone I triggered random events while they played the game.  Eventually the kid caught on that “Dad was doing something.”

So if you are so incline to troll someone playing Oblivion:

Plugin Download

The source code requirements:

  • Compiled with Visual C++ Express 2010 (A newer version would probably work.  Needs native compile x86 (32-bit))
  • Boost library version 1.49
  • OBSE version 0020 (will not compile against 0021)

Source Code