renpyweb icon indicating copy to clipboard operation
renpyweb copied to clipboard

Scaling issue only present in web

Open PizzaGlover opened this issue 4 years ago • 3 comments

I've got a game set to run at 200x150 config.screen_width = 200 config.screen_height = 150 and then scaled up to 800x600 $ renpy.set_physical_size((800, 600)). This method works fine in the normal launcher and in the windows build.

However, when I attempt this on the web player, the game never finishes loading. When I grab the log, I find the error AttributeError: 'NoneType' object has no attribute 'info' referring to the line with renpy.set_physical_size. I'm assuming this is some sort of bug, since the other methods of playing don't seem to have this issue? But I'm not really well-versed in these things, apologies if I'm just missing something, or if this isn't the right place to submit this kind of feedback.

PizzaGlover avatar Jul 26 '20 13:07 PizzaGlover

Hi,

It may be a bug in that version of RenPyWeb, though I appears to work fine when I run renpy.set_physical_size((800, 600)) in e.g. the console at https://renpy.beuc.net/play/?game=the_question.zip

If you have a simple example exhibiting the bug I can look further into it.

Note that one doesn't control the web browser's window like a Ren'Py game window, and the default RenPyWeb "screen"/canvas stretches to the browser window, so it won't do what you want; you'll have to edit the default CSS and hope for the best :)

Beuc avatar Jul 27 '20 15:07 Beuc

Maybe the issue lies with where I was trying to set the size in the code, but regardless, removing set_physical_size did result in the game technically being playable, but led to another issue with the scale: it becomes a blurry mess instead. I have a bit of code that sets the scaling so that shouldn't happen:

 def force_integer_multiplier(width, height):
        multiplier = min(width / config.screen_width, height / config.screen_height)
        multiplier = max(int(multiplier), 1)
        return (multiplier * config.screen_width, multiplier * config.screen_height)

## use integer scaling only
define config.adjust_view_size = force_integer_multiplier

## actual graphics resolution
define config.screen_width = 200
define config.screen_height = 150

## clamp rendering to integer values
define config.nearest_neighbor = True

## render in game resolution not the desktop resolution
## (this had the side-effect of doing the same to the debug tools)
## (scaling is still in the native desktop resolution, there isn't a workaround for that)
define config.use_drawable_resolution = True

But regardless, the web version seems to be blurring everything badly. I've even tried using different browsers (Firefox and Chrome) to see if it's a specific one, but they both have the same issue. I'm really an amateur here so perhaps this suggestion is off, but perhaps there's a way to set the scaling to nearest neighbor within a browser that's different than how Renpy normally does it?

PizzaGlover avatar Jul 28 '20 21:07 PizzaGlover

There are a number of compatibility wrappers to get through to generate the WebGL context, maybe something is off in one of them. In my previous message I noted that CSS rules on the canvas element may also get in the way.

Help would be nice to debug this, as I currently have several other pending tasks.

Beuc avatar Jul 31 '20 17:07 Beuc