Recent Posts

vHost

This is a project that I have been working on in my spare time for some time.  The basic concept is a plugin-oriented application to connect to the battle.net gaming service.  Written in C#, this project has been a learning experience and very fulfilling as a challenge to my programming ability.

Background

To full explain the purpose of this program, a little background knowledge is required.  Battle.net is an online gaming service for Blizzard games such as the Starcraft, Diablo, and Warcraft series.  The service is fairly straight forward and is designed to allow players to chat with each other in public or private channels (similar to IRC) and to provide a central game hosting/finding location for multiplayer mode.  Applications such as vHost connect to the battle.net service by emulating the logon procedure of official blizzard games.  In this case, the logon procedure of Warcraft 3 is emulated and requires a valid, existing logon and cd key(s).  The protocol for this logon procedure has been reverse engineered by a large community of developers and posted publicly on sites such as bnetdocs.  MBNCSUtil, a .NET library created by Rob Paveza, encapsulated all of the necessary login hashing and security features necessary to create the battle.net connection.  It is important to note that while Blizzard’s official policy states that they do not allow 3rd party programs, vHost and ‘bots’ like it are perfectly legal and permitted by Blizzard to interact with battle.net as long as they are not used maliciously.

Basic Functionality

vHost aims to enhance the battle.net experience by providing an interface for users to interact with and advanced features not otherwise present.  Because of the plugin-oriented design, the core application only provides basic connection management, user administration, and event creation.  All advanced features are implemented by plugins which use the vHost API.  It is a console application written in C# using the .NET 3.5 Framework but is compatible with .NET 2.0 and Mono.  With no plugins loaded, vHost can create one or more  connections to battle.net simultaneously, allow the local user to chat with users in the current channel, and log all traffic to the console or log file at a variety of levels (thanks to the BitFactory.Logging library).

console just after startup

console just after startup

Players can interact with vHost by typing commands in the channel or by whispering them privately.  The application can detect whether it should respond publicly or privately depending on the command, method received, and current mode of operation.  To users, communicating with vHost is just like communicating with any other player.

interface on battle.net as seen by users

interface on battle.net as seen by users

Features

  • Multiple Connections – unlike the normal client, vHost has the ability to connect as multiple users concurrently with a limit of 8 connections per realm (imposed server-side).
  • Queue Sharing - battle.net imposes flood control on every user to avoid spamming chat.  To get around this limitation in order to increase the responsivenemess of the application, vHost has the ability to automatically split chat responses across multiple connections in the same channel.  Proper ordering and priority of multiple messages are supported.
  • Advanced Logging - thanks to BitFactory’s Logging library, logging can be sent to a variety of levels depending on the user’s desired verbosity both on the command line and logging to file.  Logs are automatically rolled over daily for easy organization.
  • Transparent Data Storage - the design of vHost allows for multiple data storage methodologies to be used including MySQL, XML data files complete with well-defined schemas, or custom implementations.   The data storage decision can be easily changed without affecting any other layers.
  • Basic Role-based User Management - user management is controlled by a use of simple flags, denoted by a single capital letter A-Z.  Users may have multiple flags and commands are defined to limit or permit access depending on the roles a user has (strict and loose implemenations allowed).
  • Simple Plugin Loading - plugins are loaded dynamically through the use of reflection.  All that is requierd for a plugin to be loaded is that it exist in the plugins folder and implement the IPlugin interface defined in the vHost API.  Any plugin-specific configuration is normally located with the plugin .dll file.
  • API Utility functions - the API has a number of utility classes defined for the purpose of easier plugin development.  Commonly needed tools such as packet parsing, user object interace, and CRC hashing are available as well as all necessary constants enumerations.

The Plugins

Many of the plugins currently available for vHost are very complex and deserve a project description of their own.  A brief summary and author for each is provided below.

  • Connection - provides simple commands for closing and restarting connections
  • GameHost - easily the most complex and time consuming plugin, this plugin allows vHost to create games on battle.net for Warcraft 3 that players may join.  Emulating the connection protocol (W3GS) has required a large amount of research and reverse engineering on my part and with the help of other members in the community.  One features currently being worked on include the ability to parse a replay file and host it on battle.net in such a way as to let multiple players watch the game at the same time. 
  • GameJoin - similar to GameHost, this plugin is designed to join existing battle.net games as an observer in order to collect statistical information or to relay game results.  This plugin is still under development.
  • Help - allows a user to retrieve a list of all commands that they have the necessary access to use as well as the proper syntax and a brief explanation of individual commands.  This tool is invaluable for new users of vHost.
  • Join - a simple plugin that allows a user to move vHost from channel to channel on battle.net
  • League - custom game leagues are very popular on battle.net but unfortuntely do not have a ladder ranking system built in.  This plugin provides all of the necessary functionality to handle league player management, game creation and balancing, record tracking, and other tools typical to online gaming leagues.
  • Mail - allows users to leave messages for each other.  Users are notified if they have mail when they enter the channel.  A mass-mail command is available as well.
  • Moderation - provides channel moderation commands as well as managing a blacklist, timebanning, automatic banning and unbanning, and advanced tiered access control that prevents lower level users from kicking higher level users.
  • Users - this plugin exposes user management capabilities including the ability to search for users, modify flags, and renaming.

Technical Details

Language: C#
License: Open-source, BSD License
Source Control: SVN
This project is currently hosted on a private trac-based server.  If you would like access or a copy of this program, feel free to contact me.  An official release should be posted in the near future.

Credits

A very big Thank you to the following people:

Brian ‘Bluff’ Pegram – multiple plugins contributed
Tanmay ‘worldsenvy’ Mirani –  Moderation plugin
Ron ‘iago’ Bowes – inspiration for some of the plugin design through JavaOp2
Valhalla Legends community – bnetdocs