Multiple RENPY_SCALE_FACTOR troubles (all fixed)

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Multiple RENPY_SCALE_FACTOR troubles (all fixed)

#1 Post by iichan_lolbot » Tue Dec 30, 2008 10:22 am

Maybe I'm doing something very-very wrong, but here are some bugs I experienced using RENPY_SCALE_FACTOR:

0. If my game is (for example) 1024x768, then screenshots are always saved in 1024x768, indifferent to RENPY_SCALE_FACTOR value. So the picture is resized to a little one, to be drawn on screen, then resized back, to be saved to png. Quality suffers twice.

1. If RENPY_SCALE_FACTOR is lower, then a given value (in my case it is about 0.61), then RenPy fails to show proper text frame. frame.png is 41x41, style.window.background = Frame("frame.png", 20, 20), so 1x1 pixel still should remain in theory, but it doesn't... It's not a big deal to make it 42x42 this time, but I just inform, that a bug exists.

2. Some strange things are going on with pygame if resize is used. When factor=1.0 everything works properly. If factor differs, I get a trouble like this (traceback included):
AttributeError: 'Surface' object has no attribute 'get_rect'
at moment I call smth like
tst=pygame.image.load("frame.png").get_rect(topleft = (0,0)) #test

Before everything crashes, I see the background of thew game screen, it is properly loaded and has proper resized according to RENPY_SCALE_FACTOR size though using "set_mode((1024, 768)...)"

appropriate fragment of im02.rpy:
def set_mode():
if _preferences.fullscreen:
fsflag = FULLSCREEN
else:
fsflag = 0

screen = renpygame.display.set_mode((1024, 768), fsflag, 32)
return screen

label im02:
python:
pygame.init()
screen = set_mode()
clock = pygame.time.Clock()
all = pygame.sprite.RenderUpdates()
group = pygame.sprite.LayeredDirty()

background = pygame.image.load("images/im02/bg_0_0.png")
screen.blit(background, (0,0))
pygame.display.flip()

SpriteWithModes.containers = all
Digit.containers = all

tst=pygame.image.load("frame.png").get_rect(topleft = (0,0)) #test
P.S. Sorry for my english...
Attachments
traceback.txt
traceback
(2.19 KiB) Downloaded 253 times
screenshot0001.png
RENPY_SCALE_FACTOR = 0.5, quality awful, frame fails
screenshot0002.png
RENPY_SCALE_FACTOR = 1, quality normal, frame ok
Last edited by iichan_lolbot on Tue Dec 30, 2008 4:32 pm, edited 1 time in total.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Multiple RENPY_SCALE_FACTOR troubles

#2 Post by PyTom » Tue Dec 30, 2008 1:27 pm

I've tracked down and fixed 0 and 2. I'm unable to replicate 1 on my system... could you upload a game that exhibits this problem?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Re: Multiple RENPY_SCALE_FACTOR troubles

#3 Post by iichan_lolbot » Tue Dec 30, 2008 2:16 pm

Thanks for a quick reply.
Problem-related sample is in zip attached.
Attachments
frame.zip
sample game that suffers from trouble 1.
(2.33 KiB) Downloaded 41 times

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Multiple RENPY_SCALE_FACTOR troubles

#4 Post by PyTom » Tue Dec 30, 2008 3:59 pm

Okay, fixed (more-or-less) #1. Basically, the problem was that there was so little extra space on the frame image that it could scale some of it down to zero, and hence not display it. I modified things so the center and sides always take at least 2 pixels of the source image.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

iichan_lolbot
Veteran
Posts: 206
Joined: Tue Dec 30, 2008 9:18 am
Projects: iichan erogame
Contact:

Re: Multiple RENPY_SCALE_FACTOR troubles

#5 Post by iichan_lolbot » Tue Dec 30, 2008 4:22 pm

Maybe, at least 1 (one) pixel would be anough too.
Well, lots of thanks for all the fixes, I will wait for a new version to be released then.

Post Reply

Who is online

Users browsing this forum: No registered users