About Me

Projects

Shear
(C++/Lua/DirectX/OpenGL)

VisualWoWSim
(C++/Lua/XML/DirectX/OpenGL)

Flash Games
(Flash/ActionScript3)

Cellular Automata
(C++/Lua)

Mittens Massacre
(C#/XNA)

Contact

[email protected]

Visual WoW Simulator

Status

Completed:
  • MPQ loading
  • BLP loading
  • TTF loading
  • TOC loading
  • Add-On images, fonts, loading
  • Lua loading
  • Integration with Shear (inputs, graphics, etc)
  • SavedVariables and SavedVariablesPerCharacter
  • XML parsing and loading
To do:
  • Waiting for Shear to reach completion

Description

VisualWoWSim is an implementation of the World of Warcraft UI system. It acts as the glue between the various content that makes up the UI and my Shear library that actually renders it. It does not attempt to emulate any other client or server functions.

One of the primary reasons I developed VisualWoWSim was to allow for easier debugging of World of Warcraft add-ons. World of Warcraft does not provide the standard debug library in its implementation of Lua, and it does not include a pdb (for good reason) that is necessary for visual debuggers like Decoda. VisualWoWSim includes both.

Additionally, it may be useful for add-on developers working on netbooks or machine with low specs. Since VisualWoWSim only renders the UI it requires significantly less resources than the World of Warcraft client. This also means that UI reload times are near instant. Furthermore, it does not require an internet connection. However, it does depend on a World of Warcraft install, primarily the MPQs.

Lastly, VisualWoWSim is the primary method of testing Shear.

Disclaimer: During the development of this software, I had never seen World of Warcraft's source code, this is entirely my interpretation and implementation.

Technical Features

  • Written in highly idiomatic C++
    • Uses STL where appropiate
    • Uses Boost where STL is deficient
  • SavedVariables and SavedVariablesPerCharacter saved using custom Lua serializer
  • BLP, TOC, TTF loading is done with custom code (see code sample below)
  • MPQ reading is done with StormLib
  • Modified version of TinyXML for XML parsing
  • Shear hands the widget API
  • Sound effects use the FMOD sound system (like WoW)
  • Base API is built from jerry's wowsim
  • Lua implementation is LuaWoW
  • Over 3,000 lines of test cases that execute in VisualWoWSim and World of Warcraft

Simulations

This section demonstrates various simulations. Note that for all World of Warcraft screenshots I have applied a black texture over UIParent so that the 3D area is not shown.

Simple Test Cases - Accuracy

I have written over 3,000 lines of test cases for the various widgets in Shear. These same set of test cases execute in World of Warcraft. This first screenshot (click to expand) shows the test cases rendered in VisualWoWSim.

VisualWoWSim rendering of test cases

This screenshot (click to expand) shows the exact same test cases rendered in World of Warcraft.

World of Warcraft rendering of test cases

You'll notice that the two are very similar. The main difference is that VisualWoWSim does not attempt to render the minimap details. Secondly, the font rendering on the button does not yet correctly do formatting.

Below is a screenshot (click to expand) of the same rendering, but with widgets labeled by their type and test purpose.

Explaination of widgets

Intermediate Test Case - Cellular Automata

Cellular Automata, one of my other projects, is able to function as a World of Warcraft addon. To test VisualWoWSim I loaded it up with no source changes.

Get the Flash Player to see this video.

It's a near perfect simulation. Cellular Automata is a fairly complex addon that uses four different widgets.

The Ultimate Test - Simulating the entire WoW UI

However, the ultimate goal of VisualWoWSim is to simulate the entire WoW UI environment. If you're unfamiliar with the default World of Warcraft UI, there are 168 XML files that describe templates and widgets for the default layout. Additionally, there are 184 Lua files that control the logic of the UI and bind them to the game's ~2000 UI functions.

The current status of VisualWoWSim is that it is able to load all of the default UI without errors and render them. This includes Load on Demand addons that World of Warcraft uses to help alleviate long load times. All files are loaded from standard World of Warcraft MPQs in real-time; BLPs and TTFs are converted to DirectX textures and custom font sheets, respectively.

Get the Flash Player to see this video.

It is not possible to tell from the video, but it takes my machine about 400 milliseconds to load the entire UI.

If you look closely you will be able to detect some issues. I am working on finishing the simulation and increasing the accuracy.

Code Samples

Saved Variables

World of Warcraft supports the serialization of Lua variables at the end of a session. It can then deserialize them and load them into the next session. This section will show the output World of Warcraft's serializer and the output of VisualWoWSim's serializer.

To test the output I created a simple script that tests all data types and recursive tables.

VisualWoWSim's output looks like this:

World of Warcraft's looks like this:

The only difference is that World of Warcraft uses implied array elements in table named "Frame" and VisualWoWSim uses explicit indexing. (Ordering is different because Lua does not guarantee the order of hashed elements in a table.) The result is the same.

This is the implementation of the serializer. It is implemented so that any stream type can be used, but in this case the only output stream is a file.

BLP Loading

This file shows VisualWoWSim's implementation for reading a BLP file and converting it to a DirectX texture surface. The implementation uses templates to support arbitrary data streams to load from. In this case, it supports loading from a physical file or from a memory stream (i.e. from a MPQ).

Downloads

Binary: Not yet available (Requires a valid World of Warcraft installation)

Visual Studio 2010 Solution: N/A, use svn

SVN: http://svn.danwellman.com/vws/trunk (Note: Requires Shear, Pulse, a Lua implementation,DirectX August 2009 SDK or later, and a C++0x compiler to compile)

 

(exe requires Visual Studio 2010 Redistributable

(exe requires DirectX August 2009 or later which is likely already installed)