Ren'Py help needed with checkered grey background.

gekk0z

Member
Nov 6, 2017
204
786
I am using code "scene *imagename*"

but my image is smaller than the game display size.

how can I change the checkered grey shown in the picture below to another colour? like solid black or solid dark grey for example.

test.jpg
 
Last edited:

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,690
You can create an image with any color you want at full resolution (I guess you use 1920x1080), and then use this kind of code:

Python:
label your_label_name:
    scene blue_image  ### this is your blue background full resolution image
    show my_image_1 ### this is your non full resolution image
 

gekk0z

Member
Nov 6, 2017
204
786
You don't have permission to view the spoiler content. Log in or register now.

Thanks for the reply. I can do this, of course, as it is the standard method in Ren'py, but it would require me to do it repetitively for over 1,700 images.

And please note that I am using the "scene" command, not the "show" show command. Hope I am being clear in my n00b way.

The question is, is there an INIT or DEFINE code I can use to make that ugly checkered grey fill in the background a solid colour, or an image?

FYI, I am modding a RPGM into Ren'py, and the images are not 1920x1080 pixels ... rather something smaller and more square dimensions.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172

Thanks for the reply. I can do this, of course, as it is the standard method in Ren'py, but it would require me to do it repetitively for over 1,700 images.
No...
Code:
screen background():
    add Solid( "#000000" ) pos( 0, 0 ) size( config.screen_width, config.screen_height )

label start:
    show screen background
    [...]
And it's done, all the image will have a black background.

Edit: Oops, what was I thinking about ?

This being said, you can also use a more recent version of Ren'py. The checkered background have been replaced by a full black one 2 years ago (it came with the version 7.0.0).


And please note that I am using the "scene" command, not the "show" show command.
scene is expected to be used for images that take all the screen, while show is expected to be used for sprites(-like), therefore images that will not use all the screen.
mgomez0077 answer is what I would have said myself according to the information available at this time.


FYI, I am modding a RPGM into Ren'py, and the images are not 1920x1080 pixels ... rather something smaller and more square dimensions.
Have the images all the same size ? Because telling Ren'py to works with the right resolution (changing gui.init(1920, 1080) in "gui.rpy") would always be better than filling the background.
 
Last edited:

gekk0z

Member
Nov 6, 2017
204
786
thank you very very much for your reply.

This being said, you can also use a more recent version of Ren'py. The checkered background have been replaced by a full black one 2 years ago (it came with the version 7.0.0).
I am using 7.3.5 still getting the checkered grey background. maybe there is a setting I need to change?

Is there anyway to use "scene" with an image smaller than the game screen, and replace the resulting checkered grey 'background' with a solid colour or an image?

The reason I don't want to use "show" is because it needs to come with "hide", otherwise the images will just pile on top of each other.

The sizes of the images vary by about 10 pixels, so telling Ren'py to works with the right resolution will still result in a checkered grey background.

I apologise for my OCD, the checkered grey 'background' issue is giving me nightmares. I do wish I was a better at programming, but I am quite hopeless at it.
 

Porcus Dev

Engaged Member
Game Developer
Oct 12, 2017
2,582
4,690
No...
Code:
screen background():
    add Solid( "#000000" ) pos( 0, 0 ) size( config.screen_width, config.screen_height )

label start:
    show screen background
    [...]
And it's done, all the image will have a black background.

This being said, you can also use a more recent version of Ren'py. The checkered background have been replaced by a full black one 2 years ago (it came with the version 7.0.0).




scene is expected to be used for images that take all the screen, while show is expected to be used for sprites(-like), therefore images that will not use all the screen.
mgomez0077 answer is what I would have said myself according to the information available at this time.




Have the images all the same size ? Because telling Ren'py to works with the right resolution (changing gui.init(1920, 1080) in "gui.rpy") would always be better than filling the background.
I considered a screen but I thought it would show up on top of the images, lol

Is the "background" screen a special renpy screen (as is the case with "navigation" or others)? :unsure:

thank you very very much for your reply.



I am using 7.3.5 still getting the checkered grey background. maybe there is a setting I need to change?

Is there anyway to use "scene" with an image smaller than the game screen, and replace the resulting checkered grey 'background' with a solid colour or an image?

The reason I don't want to use "show" is because it needs to come with "hide", otherwise the images will just pile on top of each other.

The sizes of the images vary by about 10 pixels, so telling Ren'py to works with the right resolution will still result in a checkered grey background.

I apologise for my OCD, the checkered grey 'background' issue is giving me nightmares. I do wish I was a better at programming, but I am quite hopeless at it.
Use the solution he's given you anne O'nymous, create a screen and use "show" just to show that screen and then the images with "scene" (use "hide screen background" at the end if required).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
I am using 7.3.5 still getting the checkered grey background. maybe there is a setting I need to change?
Yes
Code:
define config.transparent_tile = False
But in my memory it was at False by default, so I tried it the hard way.


I considered a screen but I thought it would show up on top of the images, lol
And you were right. I don't know what I was thinking when I said that :(
Edited my message to remove this stupidity.
 

gekk0z

Member
Nov 6, 2017
204
786
I considered a screen but I thought it would show up on top of the images, lol

Is the "background" screen a special renpy screen (as is the case with "navigation" or others)? :unsure:



Use the solution he's given you anne O'nymous, create a screen and use "show" just to show that screen and then the images with "scene" (use "hide screen background" at the end if required).
Thank you for your reply, I appreciate your effort. But this is not the solution I am looking for.
 

Meushi

Well-Known Member
Aug 4, 2017
1,146
12,721
The sizes of the images vary by about 10 pixels, so telling Ren'py to works with the right resolution will still result in a checkered grey background.
One solution might be to grab and batch process your 1700 images so they all have the same larger dimensions, based on whatever the max. dimension of your images are?

Say you have an input.png of 320x200 which you want to display at 360x240 & fill the extra space with black (letterboxing):
Code:
convert input.png -gravity center -background black -extent 360x240 output.png
To do batch processing, use a script to wrap that in a loop or use the ImageMagick batch processing option.

This would apply that letterboxing to all png files in the current directory
(warning - mogrify overwrites the files, do this on copies of the originals):
Code:
mogrify -gravity center -background black -extent 360x240 *.png
Once you've got them all at the same dimensions you can use:
Have the images all the same size ? Because telling Ren'py to works with the right resolution (changing gui.init(1920, 1080) in "gui.rpy") would always be better than filling the background.
 
Last edited:

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,040
3,135
okay make a image with a grey background and try this and what do you get?


Code:
show grey #this will the grey image that you have created
scene or show your_render #this will show your render that you have made above the grey image that you have created
or you can use photoshop to add in your render to

or make sure you render in the right resolution

with the latest rempy the default is the checkered squares if an image is not the right resolution not black
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
Code:
show grey #this will the grey image that you have created
scene or show your_render #this will show your render that you have made above the grey image that you have created
Not with the scene statement, at least like you wrote the show grey line. The scene statement removes all displayable from the master layer where scene put the image, and where show put the image... by default.

If really you want to couple show for the background, and in the same time use scene for the images, you need to add a new layer, at a lower level than the "master" one, and explicitly tell show to display the said background on this layer.

Code:
init python:
    config.layers.insert( config.layers.index( "master" ), "background" )

image bgImg = Frame( Solid( "#FF0000" ), size=( config.screen_width, config.screen_height ) )

label start:
    show bgImg onlayer background
Now, and only now, you can use scene without removing the background (red for the demonstration).
 

ErgoVis

Member
Jul 1, 2017
224
296
I realise this is a ~6 years old thread at this point but since it took me quite a bit of time to find a solution that worked for me I decided to post what I personally figured out since all the resources I found through google turned out to be pretty useless.

As per usual, it turns out the solution is both extremely dumb and shockingly obvious. Go into the game's folder and there under ren'py/common there's a file conspicuously named "_transparent_tile.png". I think it's safe to assume that it's always in the same spot in different versions of Ren'py, but if such an assumption turns out to be incorrect you might have to dig a little more.

Either way, I'm sure you've figured it out by now. Swap the original "_transparent_tile.png" for whatever you want the background to be. And that's it, that's the great mystery solved right there.

One more note, since the original image only contains a sample of the tiling which is then repeated ad infinitum to fill whatever the window resolution is, the same will happen if you put the image that's too small to cover the whole screen at once.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
As per usual, it turns out the solution is both extremely dumb and shockingly obvious.
And by extremely dumb and shockingly obvious, you mean using config.transparent_tile configuration value, that is undocumented, but presented in this thread, an guaranty to works all the time without needing that you alter a file in Ren'Py core, what can lead to problems if a compressor, or android/MacOS porter use it's own version of the SDK, right ?
 

ErgoVis

Member
Jul 1, 2017
224
296
And by extremely dumb and shockingly obvious, you mean using config.transparent_tile configuration value, that is undocumented, but presented in this thread, an guaranty to works all the time without needing that you alter a file in Ren'Py core, what can lead to problems if a compressor, or android/MacOS porter use it's own version of the SDK, right ?
You mean setting this config.transparent_tile to False? That's hardly a solution. I'm assuming you'd have to set it to point to a new image of your choosing instead, which I thought of but didn't bother exploring since just swapping the images seemed like a much easier alternative.

I'll admit I didn't think of issues arising due to compression/porting though.
Btw I tried adding a new layer at the bottom of the layer stack but that keeps fucking with my custom transition for some reason.

Perhaps I'm doing something wrong in those. Wouldn't be the first time, I had a hard time figuring out how to make ATL do what I wanted it to. To be fair I probably shouldn't have obsessed over it while on the verge of extreme sleep deprivation, but coding does that to me (like to many others).
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
You mean setting this config.transparent_tile to False? That's hardly a solution.
OP wanted to get rid of the checkered background, having by example a black screen instead. And it happen that it's precisely what config.transparent_tile is for:

[renpy/common/00library.rpy:308]
Python:
    # Should we display tiles in places of transparency while in developer
    # mode?
    config.transparent_tile = True
[renpy/common/_developer.rpym:661]
Python:
    if config.transparent_tile:
        tile = im.Tile("_transparent_tile.png", (config.screen_width, config.screen_height))
        config.underlay.append(tile)
This being said, I don't remember if I said it previously and I'm too lazy to look again, but this issue only happen when the developer mode is enable. When it's not, the background will always be transparent black.
This being the reason why it's an undocumented configuration value ; it have a really limited use.
 

ErgoVis

Member
Jul 1, 2017
224
296
This being the reason why it's an undocumented configuration value ; it have a really limited use.
That makes sense I guess. The reason why I needed it set to a specific image is because the scenes in the original game (Unity based) have 1280x720 resolution, same as the window I'm using. My custom transition built for the Ren'py port, causes the tiles or black screen to show on the edges of the screen just a little bit and it's really annoying since I'm using it a LOT.

The original dev actually uses the same window size in Unity but deals with the same issue by zooming in on the images just a little bit to get enough pixels that are usually sitting outside of the frame, to the point where you can't see the background while the image is moving.

I considered that solution as well. Both of them are kinda ugly tbh, but I'm leaning towards setting the background to a non-offensive texture. Perhaps I should just make the game window slightly smaller but using a non-standard resolution just fcking triggers my OCD.