Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaling issue only present in web #11

Open
PizzaGlover opened this issue Jul 26, 2020 · 3 comments
Open

Scaling issue only present in web #11

PizzaGlover opened this issue Jul 26, 2020 · 3 comments

Comments

@PizzaGlover
Copy link

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.

@Beuc
Copy link
Contributor

Beuc commented Jul 27, 2020

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 :)

@PizzaGlover
Copy link
Author

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?

@Beuc
Copy link
Contributor

Beuc commented Jul 31, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants