In the previous post (Part 1 - Starting the Entelect Challenge Visualizer) I mentioned what the Entelect Challenge is and gave a quick overview of the basic idea behind this year's game.
In this post I'll be looking at the first step to get this visualizer started - reading the match logs.
Before getting into the actual reading of the files, let's take a look at the structure of the logs.
I had a match run between one of the Starter Bots and the Reference Bot provided by Entelect as part of the starter pack. The match logs of the round looked like this:
Looks like there is a lot going on, so let's take a closer look at what is relevant for the visualizer (at least for the first pass).
Looking at the match_logs folder we can see each match has its own folder containing two CSV files and a subfolder for each round.
The two CSV files each contain a summary of all moves made by the relevant bot for the duration of the match. We will look at this in more detail later.
Each round folder, for example Round 001, also has two subfolders for each bot competing in the match. Here we find a folder for Console.txt that contains the console output of the map and some stats after each round. The round folder also contains a text file detailing the bot's move for this round, and two files giving a detailed breakdown of the game state for the round.
Both files contain the same data but in two different representations, JSON and plain text. Which one gets used is simply a matter of preference.
Building the visualizer is in one sense, a lot easier than building a bot since the visualizer won't need all the data provided.
For a first pass, I suspect I will be using the TextMap.txt files for each round to build the representation of the map, and the two CSV files to setup the bot worms and their actions.
I suspect that I may be able to use only the first round text map to draw the initial map and rely on the CSV files to infer changes to the map based on bot actions in a later iteration.
I may also use the Console.txt file to draw the map instead of the TextMap.txt since it is a little simpler to parse.
On a last note, I opted for using the text files over the JSON files as I'll be using C++ and I find text slightly easier to work with.