How do I change sampling type during runtime?

Get help using Construct 2

Post » Wed Jun 08, 2016 1:35 pm

Is there a way to switch between point and linear while the game is running?

Vaguely related, is there a way to change the "Fullscreen in browser" setting (which is valid already in windowed mode, at least in all the browsers I've tried) without requesting fullscreen?
B
7
S
1
Posts: 12
Reputation: 401

Post » Thu Jun 09, 2016 10:32 pm

Trying one more time with a bump...

Is the answer "no one knows" or "it's not possible"?
B
7
S
1
Posts: 12
Reputation: 401

Post » Fri Jun 10, 2016 9:45 am

Hey derboo, :)


Point & Linear
I don't think you can change the sampling type at runtime.
I'm not sure, but I think it might be because the canvas has to be set up differently, at the HTML5 level, for either render mode.

You can change the pixel-rounding mode, at runtime, but that just snaps object visuals to integer coords for rendering, it doesn't affect the way textures are sampled. Though combining snapping with the pixelate effect shader might get you part way to recreating the look of point sampling, and it would be toggleable at run-time. Though there would be some discrepancies, when compared with actual point sampling.

Just out of curiosity, why is it that you were interested in changing the sampling type at runtime?
I vaguely remember looking for a way to do that quite a while back, but I don't recall why.
Anyway, even if there's not a direct way to get the effect you want, there might be a workaround that could approximate what you're looking for. I'd be happy to suggest anything I can think of.

I do have a thought on how you could effectively build your own custom point sampling system on top of the built-in Linear mode, in a way that would allow you to toggle it at runtime, though its efficiency might become an issue depending on the game and target platform. You could run the game in linear mode, use effects to pixelate individual objects (point sample their textures), and then pixelate the entire screen (point sample the canvas). I think that might almost perfectly recreate the point sampling look. Though the pixelate scale would need to match the scaling factor of the entire game. It could be a handful to set up and maintain, but the effect could be toggled on and off at runtime.


Fullscreen in browser
As for the "Fullscreen in browser" project property, I don't know of any way to change it at runtime, though I believe the "Crop" mode gives you enough freedom to recreate the appearance of any of the other scaling modes, though you'd need to build them yourself via events.

For instance, the game I'm currently working on runs in Crop mode, but I have a custom scaling system (via events) that fits a GameBoy sized screen (160 x 144) into arbitrary monitor dimensions by integer up-scale. Likewise, I have a custom letterboxing system that can toggle letterbox bars to clip the screen, to show only the GameBoy screen (the 160 x 144 zone), or just let the game screen extend beyond GameBoy res to fill the monitor.
B
26
S
17
G
8
Posts: 323
Reputation: 6,021

Post » Fri Jun 10, 2016 4:17 pm

Thanks for the elaborate reply! What I'm hoping to achieve is letterbox integer scale with point filtering on desktop devices but letterbox scale with linear filtering for mobile devices. I'll try fiddling around with the crop setting then, although the way things seem it may be easier to just export two separate versions for this...
B
7
S
1
Posts: 12
Reputation: 401

Post » Fri Jun 10, 2016 11:56 pm

We use autoscaling for everything:
https://drive.google.com/open?id=0B-xiq ... 0lDRklrNVU
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 1 guest