I am using Monogame.Extended to display my tiles. When building in Android, my tiles are not seamless (see image), but in Windows they are seamless. I believe this has to do with scaling problems, because when I scale 1:1, my problem disappears. Although, when I scale in Windows, I don’t see the problem regardless. in short, this is my code:
float scaleX = (float)Window.ClientBounds.Width / 800f;
float scaleY = (float)Window.ClientBounds.Width / 480f;
Graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
Graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
GameConfig.VirtualWidth = (int)(Graphics.PreferredBackBufferWidth / scaleX);
GameConfig.VirtualHeight = (int)(Graphics.PreferredBackBufferHeight / scaleY);
The I use the virtual sizes to build my viewport.
Also my SamplerState is PointClamp.
I hope I have provided all the necessary info. If not please let me know.
Any ideas on how I might fix this? Thanks in advance.
Hey Tval. You are right, this is scaling problem. It is common with tiling because of how sampling works.
Easiest way to fix this would be by increasing tile sprite size by something like 0.01 or smaller value. Visually it will look the same, but that size will fill all possible gaps. However that size up needs to be bigger the more you are planing to zoom out.
Other more time consuming way would be to add edge bleed to your tile sprites. Edge bleed basically extends sprite pixels. So that way when sampler looks at the edge pixel of sprite, it will always find some color to fill that gap. There are numerous ways to do it, but because tiles are rectangular I would suggest to add this while game is loading.
Hope this fixes your problem.
I tried to use bleeding, but unfortunately it doesn’t seem to have worked. Some of my tiles are separated while others seem to overlap. It does not appear that bleeding or changing my sprite size will work therefore.