Hello everyone. Today I have finished making the new minimap generator. Previously this was done using the game client directly. This had its benefits, such as capturing the map exactly how it looked. But was an issue because it required the game client to be ran each time a new map was added to the game, and this took a good bit of loading time.
The new method was to use PHP directly. Since our custom Game Development Panel uses PHP, this choice only made since. Using the GD library and several loops later, the Minimap generator is complete!
The minimap generator first loads the TMX file for the map (created with the free Tiled Map Editor). then it loads the tilesets attached to the map. With the tilesets loaded it gets the average color of each tile in the tileset by resizing the image down. The processing of resizing quickly achieves the result of getting the average color. I also had to check if each tile had a lot of transparent colors and if it did not resize it but set that tile's color to be transparent. If I didn't I found that tiles with just a few pixels and the rest being transpant, resulted in the average color being just the few pixels. So for example, if a tile had just 3 black pixels in the corner and the rest was transparent. The average color of that tile resulted in being black! This would end up looking poorly on the minimap.
Once all the average colors for each tile in the tileset was determined, then it was time to read the compressed tile data from our TMX map layers. Each layer was cross referenced to the tile's average color, and with this I was able to reconstruct the map down to the scale of 1 tile being 1 pixel. The final bit was just merging the map layers together to create a finished minimap!
Below is the map how it looked in Tiled (zoomed out), and next to it is the minimap image generated (enlarged by 3x):