Table of Contents

About

One of the nice feature of MaNGOS is that it maintains a large database filled with data that can be used in various ways. This project extracts each online player's position in-game, plots the positions on a PNG map and then displays the resulting image. This only works because apparently, the world of Azeroth is flat.

Demonstration

The following map of Azeroth is generated by plotting two online players - one Alliance mage (blue border) and one Horde shaman (red border). The scripts generate this map dynamically such that you can track players moving on the map in real-time.

Requirements

The project currently requires the following:

Calibrating the Map

On each PlayerSave.Interval (mangosd.conf) cycle, MaNGOS stores the position of every character in the characters database in columns:

The position_x, position_y coordinates are relative to the map (either Kalimdor or Eastern Kingdoms) that the player is currently on - this means that they are not global to the entire world.

As such, the image that will be used to plot the players on has to be calibrated in order to establish a relation between the in-game coordinates and the pixel coordinates of the image. We will need the following for both maps - Kalimdor and Eastern Kingdoms:

One way to perform this calibration is to:

  1. pick a map (either Kalimdor or Eastern Kingdoms)
  2. teleport / run (.modify aspeed 10) to the top-left most corner you can get to - including swimming all the way till you can swim no more
  3. issue the in-game .gps command and record X and Y
  4. bring up the map (with key M) and take a screenshot of the large map (right-click to zoom out)
  5. open both the screenshot and the final map you want to use in a paint program as two layers (the screenshot with half-opacity) and determine the X and Y coordinates of the pixel corresponding to your position
  6. repeat the procedure for the bottom-left most corner you can get to on the same map
  7. repeat for the other map

You will thus have a correspondence between extreme in-game GPS locations and pixel positions. For instance, the illustration shows various in-world locations extracted with the .gps command and then the corresponding X and Y GPS extremes determined by overlaying a rectangular bounding box for both maps - although that many locations are not needed:

Once you have the extreme X and Y coordinates (top-left, bottom-right), you would determine the pixel coordinates that are found at those locations (visually). Finally, you will obtain a map calibration that can be entered in the config.php file of the project (see $CALIBRATED_MAP variable in config.php).

Setting-Up

The bundle is designed to work with MaNGOS Zero (1.12.1). All the files must be placed following the illustrated directory structure:

     + website root or folder
     |
     +---- map.html
     |
     +---- map.php
     |
     +---- config.php
     |
     +---- img
            +
            |
            +---- {1..11}.png  (Class icons)
            |
            +---- map.png (Map to plot on)

Images

All the images go inside the top-level img/ directory.

Name Icon Description
1.png 1.png Warrior class icon
2.png 2.png Paladin class icon
3.png 3.png Hunter class icon
4.png 4.png Rogue class icon
5.png 5.png Priest class icon
7.png 7.png Shaman class icon
9.png 9.png Warlock class icon
11.png 11.png Druid class icon
map.png map.png Map of Azeroth (already calibrated for MaNGOS Zero)

Update Tweak

The scripts are configured to update the map with new positions every second however, in order for that to be possible, the PlayerSave.Interval parameter in mangosd.conf has to be set to one second ($1000ms$):

PlayerSave.Interval               = 1000

It is a good idea to make this change anyway because the default five minutes is too large an interval such that players may not be committed to the database in case the server goes down.

Code