Resolution bug in pixelate game


#1

Hi,

I’ve noticed something strange with my project. I’m using the resolution 800x600 (4:3 aspect ratio) for my game, but now I decided to make it 960x720 or 1024x768 (both are 4:3 as well) to show more of the map in relation with the player’s sprite (which is 64x64). The thing is, when I change the resolution for a bigger one, the sprites gets “crazy”. Some pixels gets bigger than others, sometimes even just flipping horizontally the same sprite within the same resolution change its pixel sizes.

This is my sprite (64x64) at 800x600 resolution:

Now this is my sprite (64x64) at 960x720 resolution:

Now this is my sprite (64x64) at this same 960x720 resolution, but horizontally flipped (look at the eyes):

As you can see, both the second and third images are different from the “correct” one, which is the first. I focused only on the player, but all the tiles gets a little crazy, specially when moving.
I’m not sure why this happens.

I believe I may have had a poor choice of design. I made all the character sprites 64x64 with Piskel, but using the 3x pixel size as the “minimum” size. Since 64 is not divisible by 3, could that be the case of this bug with the sprites in higher resolutions (even if I’m maintaining the aspect ratio)? I mean, let’s suppose my minimium size was 4x pixel, and the sprite was also 64x64. It would make much more sense just to make this same sprite as 16x16 with “1 pixel” size in Piskel, and using the resolution divided by 4 as well, right? I don’t know if this is why I’m experiencing this issue or not, I’m just thinking out loud. Does that make sense?


#2

Are these screenshots from when you preview the game? When previewing the game at the two larger sizes, is the window at 100% size or has it been made smaller/larger?


#3

Yes, the screenshots are from the preview, and the size is 100%, I didn’t change the window size.


#4

All those screen shots are the same size, so that was a bit confusing.

But, to answer your question: yes, when resizing an image to a size that is not a multiple of the original, the computer does it’s best to make everything fit and sometimes funky artifacts like what you’re observing happen.


#5

The other thing to keep in mind is that by default the preview has the menu bar on it, which will distort your game if you don’t have a fixed resolution. Disable that in your GDevelop settings to see a more “Real” preview of how your game will look once compiled:

Scroll all the way down to the GDevelop settings menu, and toggle the “hide menu” option.

Note: if you are full screen and have disabled exiting the window, you will not be able to exit the game if you have this menu disabled.


#6

Thanks for the reply. The Hide the menu bar in the preview window is already toggled.
This distortion only happens when the game is not on full screen. When I put it on full screen, everything seems fine with any resolution. One other strange thing is that I created a new empty project and imported the same sprite shown in those screenshots, and that time it worked fine, no distortions whatsoever. Very strange…


#7

Are you using camera zoom in your project?