Register to post in forums, or Log in to your existing account
 

 Navigate 
 Zuggsoft Home Page  Home
 Discussion Forums  Forums
 Download files  Downloads
 Knowledge base  Documentation
 Zugg's personal discussions  Zugg's Blog

 Map Scaling and Coordinates 

Map Coordinate System

Some maps are more than just pretty pictures: they have a coordinate system attached.  For example, maps of the real world typically use a Longitude and Latitude coordinate system.  Different applications require different coordinate systems, so zMapper allows you to define your own coordinates.

To do this, you edit the Resolution in the Zone/Background/Scale dialog.  This value indicates the number of decimal places you want to use in your coordinates.

In this example, we are going to make a small map of the Asheron's Call (AC) game, much like the AC Explorer program does.  In this world, we want are coordinates to have a resolution of 0.01 game units, so we need 2 decimal places.  So we set the Resolution value to 2:

The other fields in this dialog allow you to adjust the background image scaling by hand, but you'll rarely need to do this as we will show below.  These values are mainly available for the low-level tweakers that want to exactly specify their map coordinate system.

Adding Rooms with Coordinates

Now, to create our map, we will place two towns from the AC game: Holtburg and Cragstone.  We don't just want to drop a room on the map, we want to control the precise X and Y coordinates of these rooms.  So, we click on the "XY" tool on the toolbar and enter the coordinates of the first room (Holtburg in this case).  In the AC game, the coordinates of Holtburg are 42.3N,33.6E.  We'll represent North as usual with negative values, and enter 33.6 for the X coordinate and -42.3 for the Y coordinate.  When we click OK, our room will be added to the map.  We click the XY tool again and now enter the coordinates of Cragstone (X = 48.8, Y=-25.6).  We'll also edit the room properties to add the names of the rooms and turn on the Label for each room.  Here is our map so far:

Adding a background image

Now that we have at least 2 locations for reference, we will load a background image.  This background image comes from the AC game itself and represents the landscape of the game.  We simply select the Zone/Background/Image option and select the desired image file.  Here is the result:

Notice that the background image doesn't line up with the rooms we created at all.  In fact, Holtburg isn't even on the screen.  We have to tell zMapper about the alignment between the graphical image and our coordinate system.  We could edit these values manually as shown in the first screenshot, but zMapper has a better way to align the background.

Setting the Background alignment

From the Zone/Background menu, we select the Set Offset Point dialog.  This will allow us to shift the background map so that it lines up with one of our rooms.  We want to right-click on the desired room (Cragstone in this case), then left-click on the background image where we want this room to be displayed.  Here is what this dialog looks like:

When we right-click on the map, the room coordinates are entered into the X and Y boxes.  You'll notice that these values are close to the actual coordinates of Cragstone.  If we really wanted to be accurate, we could edit the X and Y boxes manually to enter the precise coordinates.  When we left-click the map, the pixel location on the background image is fetched.  If we knew the precise bit position on the map where Cragstone was located, we could enter it manually into the PixelX and PixelY fields.  But in this case we just point and click on the map with the mouse to get it close.  Next, we click the OK button and now we have a partially aligned map:

We see that Cragstone has been put in the correct position that we indicated in the previous step.  But it still shows Holtburg out in the middle of the river.  This is because we have only set the alignment of the map image...we haven't set the scaling factor yet.  The background image has a different scale than our room coordinate system.  In other words, it always takes 2 points to uniquely determine the proper alignment and scaling of the background image.

Setting the background scale

If we go to the Zone/Background menu, we see that the Set Scale Point option is now enabled (because we already set the offset).  We select the Scale Point command and once again right-click on a room (Holtburg in this case), then left click on the position it should reside on the background image.  Here is the dialog:

We click OK, and now our map is properly aligned and scaled:

Notice that both Cragstone and Holtburg are in their proper positions.  Now that the background map is aligned and scaled for our coordinate system, every location we now add to the map, either by clicking on the map to place it, or by placing it using precise coordinates will be properly displayed.

Conclusion

This shows you how to set up background images and coordinate systems in zMapper, and shows how zMapper can be used to create maps like those used in AC Explorer.



© 2009 Zugg Software. Hosted by Wolfpaw.net