Warhammer 40K Map Progress

Posted on

It’s been a while since I posted any progress with my interactive map. I’ve been adjusting it every now and again since my last post in February last year but those changes were mostly to planet locations, adding in new areas etc. I hadn’t made any particular progress in the appearance of the map other than to add a graticule through the SimpleGraticule plugin. Progress can be seen on version 2.1.

In this past week however, I’ve made much more progress on the design and functionality. As always, when I compare my work to a previous version it never looks like I’ve done much, but I really feel like the map is starting to come together as I have it pictured in my mind.

Clustering

No clustering

Clustered markers

My main change was to add in marker clustering using a couple of plugins: markercluster and FeatureGroup.SubGroup. Working together, these two plugins group my map markers into groups of similar markers, and then into groups of markers at similar locations. This adds up to fewer markers being shown on the screen unless you zoom right in were the clustering has been disabled.

Each cluster icon has the total number of markers in that cluster displayed in the middle of a white circle, around which there are 5 coloured circles. The coloured circles contain a count of how many of those particular markers there are in that cluster. The colours are based on the alignment of that particular marker and some alignments are grouped together for ease (for example, all xenos races, Tau, Necron etc. are under the peach coloured section). The key at the bottom-left of the map shows which colours are for which alignments so hopefully this is easy to read.

The use of these plugins meant I had to change the way I was creating the markers. I’ve switched to using JSON to hold all the information on each of the markers. I have a magical Excel spreadsheet that contains all of the planet/feature data and generates my code for me, so I just had to adjust that to generate JSON rather than the variables I had set up before.

Refactoring

Looking over my previous code, I noticed I could rework. I had a fair few repeated sections of code that could be combined and it felt… unstructured?

This isn’t a visible change, and I don’t think it has had much of an impact on those crazy loading times that have come with the marker clustering, but it does make the code easier to read.

Source Control

One an unrelated note I’ve been playing around with GitKraken. I’d used git via command line at a previous job but it never really stuck in my head. I’d have to keep looking up the commands and referring to a cheat sheet. GitKraken seems to have fixed that for me. The UI makes it much easier to see what I’m doing and I can see the commands sticking in my mind a bit better. It’s also nice to have a backup of all my changes. I only wish I’d started using it from the beginning of this project.

Working Prototype

Enough blathering on. The working version can be seen in the 40k interactive map v3 directory. I’ve also updated the main directory with this version.

Previous incarnations can be seen in the version 1, version 2 and version 2.1 directories.