DMC Scrolling Bug
Hey Folks! No space stuff today. I had to miss the early part of the day for an eye appointment, and Tiago was back to help with some NEO Scavenger mobile bugs, so I used my afternoon to help track down a high-res issue.
Basically, the bug was that the map wouldn't scroll far enough toward the right or bottom edges on certain devices. And since those devices had much larger screens screens than ours (~2880 pixels wide), we hadn't tested them adequately.
It turned out to be a pretty simple code change to fix it, but it took nearly all afternoon to figure out the math. I had to keep testing different resolutions in order to start seeing a pattern, and in the end, it looks like the map scrolling bounds get too small for large screens, too large for small screens, and just right at 1600x900. The trick was finding out the magic number/formula for this error.
Some more testing yielded an interesting trend: 800x450 was 400 pixels too large, 1600x900 was 0 pixels too large, and 2400x850 was 400 pixels too small. In other words, half the game's base resolution error for each 1x zoom increment.
Once I saw that, it was easy to calculate this value based on the current screen size, and tack it onto the map scrolling and panning methods. But damned if I know why it's necessary. As far as I can tell, the math to detect the map edges looks fine to me. If there was a bug, I would've guessed it worked at 800x450 (native resolution) and got worse from there, instead of 1600x900, which was 2x the base resolution.
But, eh. I guess a dirty hack that works is better than logical code that doesn't :)