Windows (Needs Testing) Update to Tile Lines: Compounded application_surface Scaling Corruption

TheouAegis

Member
Long title, but bear with me here.

So to recapitulate, when you see lines between your tiles when the game runs, there are a few known workarounds to hide them.

1) Put at least 2 pixels between tiles in the tile sheet (pixel buffering) with the pixels being the same color as neighboring pixels. This doesn't always work, requires quite a bit of work both in and out of Game Maker, and is undesirable if you need to calculate tile numbers within the tile sheet (GM8, GMS).

2) Toggle color interpolation. In GM8, turning on color interpolation I think can fix the lines, but then it blurs the rest of the game, which is not good for pixel art. In GMS1, turning off color interpolation can fix the lines, which is not good for games with lots of subpixel rendering and sprite angling.

3) In GM8, if using views, set the port to be 1 pixel smaller than what it should be. This usually fixes the lines, but only in GM8 and only when using views.

The newest, simplest thing to try in GMS1 Windows export, and it needs further testing in GMS2 and with other export modules, is to simply resize the application_surface. Note: This appears to only work with the view port is a clean scale of the view/camera itself. In other words, scaling from 256x224 to 768x672 works, but not scaling up to 800x600. The view/camera dimensions do not need to be powers of 2, so scaling a 400x300 view up to 800x600 is fine. When views are enabled, by default GM resizes the application_surface to cover all view ports. From what I can tell, this forces GM to scale everything and then draw to the application_surface. Perhaps there are multiple surfaces. dk;dc The fix is to force the application_surface back down to the size of the view/camera so everything is drawn to the application_surface at 1:1 ratios and then scale the application_surface to the port(s).
FIX:
Code:
surface_resize(application_surface,view_wview[0],view_hview[0]);
Example of Multiple Views FIX:
Code:
surface_resize(application_surface,view_wview[0]+view_wview[1],view_hview[0]+view_hview[2]);
REVISION: Previously, I stated the port must be scaled cleanly from the view/camera. This is not entirely true and I haven't figured out the reason for the exceptions (I haven't really figured anything out). At one point I made 4 views scaled improperly -- each view as 128x112 and each port was 200x200. This resulted in no tile lines after resizing the application_surface. I thought, "Is it because they're squares?" If I changed the ports to 260x260, the lines returned. When I changed them all to 256x256, all the lines were gone (I would expect half the lines to remain, since it's still an awkward scale vertically). HOWEVER, when I changed 3 of them back to 200x200, only the one that was 256x256 had no lines, while the other views had lines between their tiles. Similarly, 256x224 worked, with the each port being a perfect scale of its view. However, 224x224 resulted in lines, as did 224x256, but 256x200 didn't result in any lines. What's so special about 200? I don't know. I hypothesized that the scale factor was just too small for the lines (which I knew from my GM8 days wasn't true), so I tried 196x196 and still got lines between the tiles.
🤯


So to summarize: Before you go redesigning your tile sheets, first turn off interpolation in the Game Settings. Then if that doesn't fix the lines, in the Room Start code for each room with different view settings, resize the application_surface based on the view(s) dimensions (not the port dimensions).
 
Last edited:

IanFrank

Member
Just wanted to say thank you for this post. Resizing the surface to the view size seems to have fixed my tile line issue in GMS2. It only happened on Windows, Android was ok. So.. thank you! 😊
 
Top