News Board

Message Details

Simple Map API

By Tristan on 11/02/2010 03:39:39

Greetings! I have added a very simple map api to the web server. It has two functions: getting map data, and getting the users location. It only works if the user is logged on, and you can only get information for the authenticated user. ... /secure/api/map?action=map will return a json array of rooms. Each room has a title, pathname, integer ID (the location in the array), and exits (the IDs of other rooms). Each room also has integer X and Y coordinates. ... /secure/api/map?action=location will return a json dictionary containing information about hte room the player is currently in: ID, path, x,y coordinates. The map action only returns the map that the player is currently in. Areas that are not connected are on different maps. Each time you poll for user location you can check to make sure the user is on the same map by checking the path of the rooms with that ID are the same. If the user is not logged in it is a bad request. Since most of the current areas are small, you can goto "TestLib.Maze#" (the # is necessary) to see a set of auto-generated rooms to test with. Happy mapping!

Back to board index.