World Data

Daedalus

Guest
To help developers of external sites statistics, we make available for download the data of the most important worlds. Player attributes, cities and alliances are thus available for download regularly. We also provide information on the conquests of the city from a world in UNIX timestamp and content profiles.

Load the data only when you need it in order not to overload the server query. Scripts loading the data more than once per hour are not allowed. It is best to host them on an external site in that case. Note that the data is updated at regular intervals based on the world selected.

The files are available in .txt.gz format and there are 11 in total. Each file consists of an arbitrary number of comma-separated lines. The data is encoded PHP format, which means that a comma is expressed by %.

For download, it is necessary to replace usX by the identification number of the desired world (us1 for Alpha , us2 for Beta , etc ...)

http://usX.grepolis.com/data/players.txt.gz
This file contains information about the players. The data is available in the following order:
$ id, $ name, $ alliance_id, $ points, $ rank, $ towns

http://usX.grepolis.com/data/alliances.txt.gz
This file contains information about the alliances. The data is available in the following order:
$ id, $ name, $ points, $ village members $ $ rank

http://usX.grepolis.com/data/towns.txt.gz
This file contains information on cities. The data is available in the following order:
$ id, $ player_id, $ name, $ island_x $ island_y $ number_on_island, $ points

http://usX.grepolis.com/data/islands.txt.gz
This file contains information about the islands. The data is available in the following order:
$ id, $ x, $ y, $ island_type $ available_towns

http://usX.grepolis.com/data/player_kills_all.txt.gz
This file contains information on the classification of combatants. The data is available in the following order:
$ rank $ player_id, $ points

http://usX.grepolis.com/data/player_kills_att.txt.gz
This file contains information on the classification of attackers fighters. The data is available in the following order:
$ rank $ player_id, $ points

http://usX.grepolis.com/data/player_kills_def.txt.gz
This file contains information on the classification of defenders fighters. The data is available in the following order:
$ rank $ player_id, $ points

http://usX.grepolis.com/data/alliance_kills_all.txt.gz
This file contains information on the classification of alliances fighting. The data is available in the following order: $ rank, alliance_id, $ points

http://usX.grepolis.com/data/alliance_kills_att.txt.gz
This file contains information on the classification of alliances attacking fighters. The data is available in the following order:
$ rank $ alliance_id, $ points

http://usX.grepolis.com/data/alliance_kills_def.txt.gz
This file contains information on the classification of alliances fighting defenders. The data is available in the following order:
$ rank $ alliance_id, $ points

http://usX.grepolis.com/data/conquers.txt.gz
This file contains information on the cities taken from the opening of the world. The data is available in the following order:
Town_id $, $ time, $ new_player_id $ old_player_id $ new_ally_id $ old_ally_id $ town_points
 

mentalrager

Guest
A couple of quick questions regarding the world data...

1. How often is this data actually generated? I don't want to poll once an hour if it's only updated every 2 hours for example.

2. Is there any guidance on what the allowed characters are in the actual data? I need to pick delimiters for a key space in a key-value store and I don't want to use chars that are allowed in the data. I would rather not guess.

3. I saw some old info posted about a JSON export. That would actually be perfect for what I need. Is there any way to still get this data as JSON formatted instead of PHP based CSV?? That's not nearly as "readily consumable" as JSON these days.
 
Last edited by a moderator:

TheBlackPegasus

Guest
A couple of quick questions regarding the world data...

1. How often is this data actually generated? I don't want to poll once an hour if it's only updated every 2 hours for example.

2. Is there any guidance on what the allowed characters are in the actual data? I need to pick delimiters for a key space in a key-value store and I don't want to use chars that are allowed in the data. I would rather not guess.

3. I saw some old info posted about a JSON export. That would actually be perfect for what I need. Is there any way to still get this data as JSON formatted instead of PHP based CSV?? That's not nearly as "readily consumable" as JSON these days.
Happy to help with anything you need, I've worked with the world data for a few years now over on the EN servers, you can add me on Skype as "AthenasRecords"

But in answer to your questions;

1) It is meant to be every hour, however I have some used some test code in the past pulling every 15 minutes and as a whole it gets different results throughout the hour. I have always wondered if this is a bug within the system or different files update at different points. - I would advise setting up some code to pull every 5 minutes run it for a day then see when the changes occur then time your hourly download just after the update.

2) Delimiters you want to use ","

3) They got rid of the json files, however their are some other files which are not mentioned above you can pull which are json files which give you data about the world, for example unit data, building data etc.. (this can be used to work out world settings).

Here are all the files I pull each hour in total (you can add .gz to the end to get the compressed version which I would advise)
Code:
        fileNameList.Add("players.txt")
        fileNameList.Add("alliances.txt")
        fileNameList.Add("conquers.txt")
        fileNameList.Add("islands.txt")
        fileNameList.Add("towns.txt")
        fileNameList.Add("units.json")
        fileNameList.Add("researches.json")
        fileNameList.Add("buildings.json")
        fileNameList.Add("alliance_kills_def.txt")
        fileNameList.Add("alliance_kills_att.txt")
        fileNameList.Add("alliance_kills_all.txt")
        fileNameList.Add("player_kills_def.txt")
        fileNameList.Add("player_kills_att.txt")
        fileNameList.Add("player_kills_all.txt")
It should also be noted that the island data has two extra fields on it now, which appear to be the two types of resources that get + and - per island. Although it is not officially documented anywhere that I have seen.

But it to convert CSV to JSON would only take you a few minutes of to code that in theory so I don't see the CSV being a disadvantage at all.

Some other thoughts...

There is also some advice around not taking all the files every time as in theory things shouldn't change however they do so I would take and process the whole file set at once.

There is also another set of data you most likely will want which isn't given out by the game, which enables you to plot the town positions on each island type in to coordinates. (Useful for travel time scenarios.)
 
Last edited by a moderator:

DocSnop

Guest
Does anyone know how you find the position of the town within the island? The island.txt and the town.txt have x and y coordinates that match the town to an island, but where on the island is the town located?

Also I have seen islands with 1 town occupied and 1 town on the whole island. But the island.txt still shows 19 towns available. Any thoughts on this?
 

ang101

Citizen
Does anyone know how you find the position of the town within the island? The island.txt and the town.txt have x and y coordinates that match the town to an island, but where on the island is the town located?

Also I have seen islands with 1 town occupied and 1 town on the whole island. But the island.txt still shows 19 towns available. Any thoughts on this?
Hey you need to look at the "$ number_on_island" This is a value between 1 and 20. There are 20 spots on the island so if you see city is in spot 6. You know this is spot 6...and I believe it goes clockwise...so next position to the right is 7...left is 5..etc
 

basbug

Newcomer
Greetings,
I have a question on the charset of the file.
http://us46.grepolis.com/data/players.txt has this line in it.

2163445,%2A%2A%2AWarLord%2A%2A%2A%2A,,197,14699,1

I also see + in the name fields. + is probably space. So can I replace string + with space before loading to my db?

%2A%2A%2AWarLord%2A%2A%2A%2A is actually ***WarLord**** in the game. Can you please tell me what the file encoding is, so I can read properly?

Never mind, if figured out a decode function :).
 
Last edited: