Creating Your Own Travian Utilities

December 13, 2008 | By | 4 Comments

Travian
Travian the well known browser game has a downloadable file for developers in each of its servers that provides details of all the players of the server. The file contains a list of SQL INSERT statements, one for each player. Although the statement doesnt provide military or attack information, that can be used to cheat in the game, it provide enough information to draw your own maps and create analysis tools for the villages, players, and alliances.

The file name is map.sql, for example the full URL of the file for the com4 server will be ‘http://s4.travian.com/map.sql’. By the way, the map files of the German servers used to be karte.sql, but they changed it to map.sql too. The following is an example of the contents (I inserted a line break before the VALUES clause for readability):

 

The fields are:

  • ID: Number of the field, starts in the top left corner at the coordinate (-400|400) and ends in the bottom right corner at (400|-400).
  • X: X-Coordinate of the village.
  • Y: Y-Coordinate of the village.
  • TID: The tribe number. 1 = Roman, 2 = Teuton, 3 = Gaul, 4 = Nature and 5 = Natars
  • VID: Village number. The unique ID for the village.
  • Village: The name of the village.
  • UID: The player’s unique ID, also known as User-ID.
  • Player: The player name.
  • AID: The alliance’s unique ID.
  • Alliance: The alliance name.
  • Population: The village’s number of inhabitants without the troops.

 

The SQL code needed to create the table to hold this data is:

 

The following code downloads the map.sql file, opens it for reading, and runs each line as a separate INSERT statement. Although the code is ASP.NET, it can be changed to a Windows Forms app easily.

 

The GetTravianMap() function can be run in a regular interval to keep the data in the table current with the game. The DownloadFile() function replaces the local copy of the file without raising an error, so there is no need to check if a file exists and delete it. But the data downloaded previously should be deleted, or normalized because the a server can have more than 20,000 members and this could increase the database size drastically.

To get more details about the servers, their update time, and examples in PHP follow this link to the Travian Help website: http://help.travian.com/index.php?type=faq&mod=230



Related Posts:

Filed in: ASP.NET, WinForms | Tags:

Comments (4)

Links to this Post

  1. Code Hill » A Complete List of Travian Game Servers | January 10, 2009
  1. Using Java and SQL to create your own utilities? Never tried doing anything like that before. Why, when there are easier way of getting things done without any programing knowledge.

  2. i want my own travian server

  3. Thanks a lot for this tutorial, I have made scripts and bots based on this tutorial and published it on my site.

Leave a Reply

Trackback URL | RSS Feed for This Entry