Dr. Mapmaker or: How I worked for 2 full days and learned to love singe-file maps.

Disclaimer: This is just a small rant about what I worked on the last 2 days. If you are busy, no need to read.

Ok, so you all hopefully read yesterdays blogpost in which I announced to move to chunk-sized maps. Well actually that was wrongly put, since chunks are only 16×16 blocks large, I actually meant to move to file-sized maps, and one file covers 512×512 blocks.

And the whole thing fell apart the further I progressed with it. First of all, all went great. I managed to find a nice and simple way to place all the generated files on the page with simple CSS and little code. Life was good. Then I wanted to move on to do the same for the heatmaps. The issue is that I had to then render the heatmap for each 512×512 block of each map.

But everything was different looking all of a sudden. I thought at first that the method that I used to translate in-game coordinates (-1000 -> + 1000 around a center) to screen coordinates (0 in the top corner to 2000 in the left/bottom) did not work for single files since the coordinates there start anywhere in the map. Working on that one for 2-3 hours I finally figured out that if you calculate a heatmap for a single 512-sized block, the spot with 1 hit would have the same color intensity as for another block with 100 hits, if that was simply the maximum for each block. Only if you generated a whole world at once,  you would be able to see where in the world the highest hits were. Ideally we should render ALL worlds into one file just to see where the balance is between worlds. So I found that I had to assemble the files of each map back together to a single file in order to create a heatmap. On top of that, since we are having individual lot images on each user’s page, we needed a whole world map. Otherwise, if a lot is split between two files, we would have issues there.

So I tried to make a program that would re-assemble the file-based images into one single image. For that you scan a world directory, list up all the files and tell a small program to arrange them in a 10×10 pattern That worked for some worlds but did not work for others. The issue was that we had more worldfiles per world than 10 by 10. Some rows or lines in the grid would have more files outside the borders. Teleporting and other issues sometimes generate single-block items outside of the borders and those made the map assembly a mess. So I had to first go to each world, check and remove excessive files, then make a list of the good files to make sure no unwanted files messed up everything. Now I was able to have complete maps, crop those again since the world as we set the border does not end at the file end either, render heat maps out of them, cut it again in lot-sized pieces for the user pages, and done.

So in the end we are back to single-file 2D maps, but they still use the better rendering engine, and we have heatmaps again. Yay!

3 thoughts on “Dr. Mapmaker or: How I worked for 2 full days and learned to love singe-file maps.

  1. Sounds like a ton of work. I am glad I just donated again since it seems you’ve been overloaded with work for 1.7. Thanks again for all the work you do Unc.

  2. Just hearing all of those words that I had no idea what they meant must mean that you worked a lot

  3. thank you for all the work that you do unc.

    General “Buck” Turgidson: “Gee, I wish we had one of them doomsday machines.”

Comments are closed.