Resizing screen in-game via Python Bug

Hi there! I’m using a script for resizing the Standalone Player screen in-game. There’s this PlayStation One graphics I want to achieve, and I need the screen to be smaller so that you can’t see polygons that sharply. The script is:

import bge
rend = bge.render

x = 1920
y = 1080

rend.setWindowSize( x, y)

This is the original 1920x1080 gameplay footage:

When I resize it to 1280x720 it resizes correctly, but as soon as I go lower, even keeping the 16:9 format, the screen will bug and show Windows and stuff. This is a 1244x700 example:

And if I go even lower, it goes worse. Once again, keeping the 16:9 format so that it resizes properly.

This is how the screenshot was taken, but in my screen that last picture looked really stretched. I have the fullscreen mode enabled, so I guess maybe it’s something I’m missing in Python. Anyone has any idea of what might be causing this bug?

Thanks for your time!

BGE/UPBGE is known to have relevantly poor resolution handling. For producing lower-resolution pixels I’d suggest faking it with a post-process shader instead:

1 Like

best way to avoid weirdness is to set windowed mode before lowering resolution and set back to desktop right before going back to fullscreen. the stretching can be mitigated with the border/letterbox setting. sometimes its a monitor issue.

1 Like

Thanks a lot for this! I didn’t consider using a 2D Filter instead.

Saw this post, although I always forget to mention the fact that I’m in BGE 2.79b. The other script that someone posted works, but I’d like to keep the sharp edges as it was discussed in that topic. Could you help me out on this?

Thank you all for your answers!!

Perhaps you’re looking for “anti-aliasing” to smooth your display resolution.
The AA Samples setting can be found in the Properties Editor -> Render Tab.


Or maybe you’d be more interetsed in a “PSX” shader.
Note: This shader script is no longer compatible UPBGE 0.2 as vertex-lighting was removed when the Shading method Multitexture was removed.


PSX Shader download:

I’ve been so long without using the BGE that I forgot OBVIOUSLY people have created external stuff. The PSX Shader looks great! It requires permission from the uploader for downloading it though, I sent a request. While he answers or not, I’ll still get a bit more specific on this:

I already have disabled AA Samples, and this is the script I’m using:

uniform sampler2D bgl_RenderedTexture;

void main()
{float ScreenW = 640., ScreenH = 480.;
float Pixeliz = 5.;

float pixW = Pixeliz*(1./ScreenW), pixH = Pixeliz*(1./ScreenH);
vec2 pos = vec2(pixW*floor(gl_TexCoord[0].x/pixW), pixH*floor(gl_TexCoord[0].y/pixH));
gl_FragColor = texture2D(bgl_RenderedTexture, pos);

It was created by SL_RU in the quoted Topic before. This is what the script makes the gameplay look:

If you notice, pixels around the character’s edges are a bit blurry, while in this next image, which is what I want to achieve, edges are completely sharp:

I achieved this effect by making a screenshot on the Embedded Player on a very small window, then scaled it up keeping hard edges (this is why I was trying the resize screen script in the first place).

Hope I’m not sounding too confusing!
Thanks a lot for your help!!!

EDIT: The images are too small, probably you’ll have to view them in full scale to notice the difference… sorry about that!!!

I made a filter that doesn’t produce anti-aliased edges, posted here:

1 Like

You’re right… last I checked the author had it accessible for download. Sorry about that.

1 Like

Just what I needed! Strange I didn’t see that before. Thanks a lot!!