2006Scape Wiki:Map: Difference between revisions

From 2006Scape Wiki
Jump to navigation Jump to search
scape_>Ralpha
(First part of documentation of cartographers project)
(No difference)

Revision as of 19:36, 6 March 2019

This page contains documentation for the cartographer project. This project is still in development and is prone to changes. This project uses the codename Doogle or Doogle Maps sometimes.


Map Creation

Old School RuneScape

The map for OSRS are created using modified version of the RuneLite MapImageDumper script. It uses the game cache as the source for the maps. This provides easily updatable maps. The code for this can be found at: (currently not available)

This script creates map regions at different resolution levels:

These map regions include ground color, roads, buildings, doors, walls, trees and other objects. Icons are not included in these renders.

There map regions are then processed into maptiles that can be used for viewing the map. These tiles are all 256x256px but created using different map regions. This process uses ImageMagick (montage and convert) to combine and split image to create the desired result. This process is automated using a Bash shell script:

These tiles are directly used by Leaflet to display the map.

RuneScape 3

Similar process as OSRS.

Data Collection

The map uses varies sources of data to populate the map. A list can be found here.

Old School RuneScape

Data Name Data Source Processing tool Notes
Map tiles Game Cache RuneLite See: above
Map icons Game Cache, Manual (user defined) RuneLite
Map bounds (MapID) Game Cache, Manual (user defined) RuneLite
Map labels Game Cache, Manual (user defined) RuneLite
NPC locations RuneLite, Manual (user defined) ? Not implemented
Path data Game Cache RuneLite?
Map Area's Manual (user defined) GeoJSON Not implemented
Item spawn locations Game Cache?, Manual (user defined)? GeoJSON Not implemented
Quest steps Manual (user defined) GeoJSON Not implemented
Teleport locations Manual (user defined), Game Cache?, RuneLite? GeoJSON Not implemented, possible source: RuneLite, Manual
Map links (doors, portals, ...) Game Cache, Manual (user defined) ? ?

Map Implementation

The map implementation for OSRS and RS3 use the same codebase. This codebase can be found here: (currently not available)

The map implementation uses Leaflet for the map implementation and Gulp for project compelation.

Map tiles

The map tiles are available under the path: maps/{mapID}/{z}/{p}_{x}_{-y}.png

Definition lists
mapID
the map bounds (0=RuneScape Surface, 1=Acient Cavern), mapID's smaller then 10000 are exported from game cache, mapID's larger then 10000 are user defined
z
zoom level, supported zoom level from -3 (zoomed out) to 3 (zoomed in), map can zoom to level 5 but this just scales the zoom level 3 images.
p
planes, the floor levels, these go from 0 to 3, dungeons and basements are displaced on the map and support same planes (see mapID)
x
x-coordinate of bottom left corner of map this changes depending on the zoom level. Zoom level 2 correspond with game coordinates*
y/-y
y-coordinate of bottom left corner of map this changes depending on the zoom level. Zoom level 2 correspond with game coordinates*

Loading data

To better support different datasets, iconsets and layers most of the data is loaded from JSON files the main file that is loaded is 'dataloader.json'. This file contains the different mapID's, icon sets and layers. The file below gives more info about this format, as json does not support comments we added '//' before a line comment. (Note: This is not a valid json file)

{
  "datasources":[ // a list of all data sources, currently only for iconsets
    {
      "id": 0, // Id used for data provider
      "type": "icons", // Type of datasource, currently only supports 'icons'
      "name": "Map markers", // Human readable name for iconset
      "dataproviders": { // Files used to create data provider
        "iconclasses": "data/MarkersClasses.json", // relative or absolute path to icon classes
        "iconlist": "data/Markers.json", // relative or absolute path to list of all icons in dataset. This list can be reused by multiple providers 
        "defaultIconClass": "Marker" // default icon class used for 'iconlist', need to be defined in 'iconclasses'-file
      }
    },{ // next data provider
      "id": 1,
      "type": "icons",
      "name": "Main RS map icons",
      "dataproviders": {
        "iconclasses": "data/MainIconClasses.json",
        "iconlist": "data/MainIcons.json",
        "defaultIconClass": "MapIcon"
      }
    },{
     ...
    }
  ],
  "baseMaps":[ // A list of all baseMaps (background of map), only one can be displayed at any moment
    // mapID=0 is displayed on opening of map
    // Ordered in select box using mapID (might be changes to order in this file later (TODO) )
    // mapID order has not have to be incremental, id's can be skipped
    { 
      "mapId": 0, // mapID used when creating path for files, see above (section:Map tiles)
      "name": "RuneScape Surface", // name as displayed in select box
      "center": [3225, 3219], // the center of the map, view moves here when basemap is switched
      "bounds": [ [0, 0], [12800, 12800] ] // bounds of map, tiles outside of this bounds are not loaded and limits panning movement.
    },{ // More items in the list
      "mapId": 1,
      "name": "Ancient Cavern",
      "center": [1760, 5344],
      "bounds": [ [0, 0], [12800, 12800] ]
    },{
      ...
    }
  ],
  "overlayMaps":[
    {
      "id": 1, // unique id used internally to track overlay
      "name": "Main map icons", // name used in display in UI (TODO)
      "parentLayer": "icons", // grouping of layer under other layer (not implemented, might change)
      "displayOnLoad": true, // if true, it is displayed on opening of map
      "dataSource": "data/MainMapIconLoc.json" // relative or absolute path to a GeoJSON formatted file (see below)
    }
  ]
}