To-do list > Location > Map sizes
Posted by 452 on 2011-03-27 00:38:00

I've updated the past entry regarding maps a few times, but mostly adding images, so I'm going to write another post about maps.

When I originally wrote my marker placement script, I had a headcold, so it took me hours to do some basic maths, and I ended up writing it very poorly. It worked, but only for images 5000x5000px, and I used a lot of "magic numbers" in my code.
"Magic numbers", for those don't know, are when you're writing code and put a fixed number, such as 1.6294234592445328031809145129225, in there to convert a number.
I determined that 1.6294... was the particular ratio between the full size map, and the map I was using.
I put 2 other magic numbers, 342 and 548, to offset the x and y values and center the marker map on the stilwater map I was using.
This is all really bad coding, as I had no idea what these numbers meant. I just knew they worked, so I didn't really care. This was until I wanted to scale the map to twice the size. It wasn't simply a matter of multiplying all the numbers by 2, which told me immediately that my magic numbers had lost their magic.
My head cold has mostly cleared, so it didn't take me long to realise that 1.6294 was still pretty magic, and must be the ratio between $fullsizemap/$resizedmap
I thought the full sized map must be 8192*8192px. But 8192 was just the number used in the later part of my scale calculations because it was a nice round number, 2^13, and it was one of the sizes I was already using for the map. I'm still working on figuring out exactly which numbers I should be using.

The other numbers, 342 and 548, aren't that special by comparison, they were just how much the map was offset after scaling it, and I just wanted to get it working at the time, but I've replaced them with with a simple "($resize/2)"

There is also a very minor issue with my stilwater map, which is off by about 350x and 40y, but once that is corrected, I can automatically place markers for any chosen resolution :)

There's one more thing i need to add, which is another offset to allow cropping of the map prior to marker placement, to avoid the RAM limits. At full size, the map looks like the full size in-game map: surrounded by sea, and the only things outside the bounds of Stilwater's zoomed dimensions are the secret areas, and the Ultor Yacht. (As seen on File:All navmarkers.png). At full size, 8192, there are 2000px of water on all sides, so it's perfectly safe for me to scale to one size, then crop it to approximately half of that size.

452 - 2011-03-27 00:38:00

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.