Discuss Scratch

infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

So I am planning on making a mod of 3.0. I will not even start on it until after it comes out though.

A few things I plan on adding:
  • Additional resolutions, including 16:9. I may even have blocks to control this. Likely there will be another positioning grid that will be aligned with percents of the stage dimensions. There would be blocks to sense state dimensions.
  • A dark theme by default
  • Some extensions, such as pen, will be loaded into the editor by default.
  • Many of the new blocks will be developed as extensions so they may see use on the Scratch website.
  • Advanced pen that can fill solid polygons. This will enable users to better build 3D games.

Any thoughts? Suggestions? Want to help out?

I need a name for it btw.
Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 mod

There could be an option to load an extension from a URL
jokebookservice1
Scratcher
1000+ posts

Scratch 3.0 mod

Additional resolutions, including 16:9

See also LLK/scratch-gui#258
infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

jokebookservice1 wrote:

Additional resolutions, including 16:9

See also LLK/scratch-gui#258
Yep, I hope 3.0 adds it.


Sheep_maker wrote:

There could be an option to load an extension from a URL
That would be good.

Last edited by infinitytec (Dec. 28, 2018 20:58:01)

jokebookservice1
Scratcher
1000+ posts

Scratch 3.0 mod

Yep, I hope 3.0 adds it.
No, the issue that there are complicated design decisions that you might want to consider. If you have a neat solution to them, though, I'm sure Scratch would appreciate it if you sent in your code!
infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

jokebookservice1 wrote:

Yep, I hope 3.0 adds it.
No, the issue that there are complicated design decisions that you might want to consider. If you have a neat solution to them, though, I'm sure Scratch would appreciate it if you sent in your code!
That's why I want to do a percent-based positioning system.
That, or all the CSS positioning systems, so projects can be fully responsive.
jokebookservice1
Scratcher
1000+ posts

Scratch 3.0 mod

infinitytec wrote:

jokebookservice1 wrote:

Yep, I hope 3.0 adds it.
No, the issue that there are complicated design decisions that you might want to consider. If you have a neat solution to them, though, I'm sure Scratch would appreciate it if you sent in your code!
That's why I want to do a percent-based positioning system.
That, or all the CSS positioning systems, so projects can be fully responsive.
Maybe… but Scratch already uses proportional positioning systems for coordinates. It's just instead of X being out of 100 like percentages, it's out of 240; and Y is out of 180 rather than 100. Notice that if you go full-screen, your sprite moves its position to stay in the same place, that means the units scale responsively.
infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

jokebookservice1 wrote:

infinitytec wrote:

jokebookservice1 wrote:

Yep, I hope 3.0 adds it.
No, the issue that there are complicated design decisions that you might want to consider. If you have a neat solution to them, though, I'm sure Scratch would appreciate it if you sent in your code!
That's why I want to do a percent-based positioning system.
That, or all the CSS positioning systems, so projects can be fully responsive.
Maybe… but Scratch already uses proportional positioning systems for coordinates. It's just instead of X being out of 100 like percentages, it's out of 240; and Y is out of 180 rather than 100. Notice that if you go full-screen, your sprite moves its position to stay in the same place, that means the units scale responsively.
Yes, but with a different stage size there could be issues with the current coordinate system.
XayCraft360
Scratcher
100+ posts

Scratch 3.0 mod

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

XayCraft360 wrote:

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
That could work, but would probably scale 4:3 projects poorly.
Sheep_maker
Scratcher
1000+ posts

Scratch 3.0 mod

infinitytec wrote:

XayCraft360 wrote:

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
That could work, but would probably scale 4:3 projects poorly.
It shouldn't squish, it should just crop, so whatever happens to be outside the [-135, 135] range is simply not shown on the stage. This already happens in vanilla Scratch; you often see in scrolling projects sprites going outside of the viewing area.

I think the only thing to worry about is what happens to bitmap images when a project switches between 4:3 and 16:9. Maybe the costumes could be converted to vector to give users the option to keep the old 4:3 costumes or crop them by converting back to bitmap.

Last edited by Sheep_maker (Dec. 29, 2018 19:32:38)

XayCraft360
Scratcher
100+ posts

Scratch 3.0 mod

infinitytec wrote:

XayCraft360 wrote:

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
That could work, but would probably scale 4:3 projects poorly.

The other option would be to keep Y, which would be 640:360, which might scale a bit better

EDIT:: Ninja'd

Last edited by XayCraft360 (Dec. 29, 2018 19:33:20)

infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

Sheep_maker wrote:

infinitytec wrote:

XayCraft360 wrote:

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
That could work, but would probably scale 4:3 projects poorly.
It shouldn't squish, it should just crop, so whatever happens to be outside the [-135, 135] range is simply not shown on the stage. This already happens in vanilla Scratch; you often see in scrolling projects sprites going outside of the viewing area.

I think the only thing to worry about is what happens to bitmap images when a project switches between 4:3 and 16:9. Maybe the costumes could be converted to vector to give users the option to keep the old 4:3 costumes or crop them by converting back to bitmap.

XayCraft360 wrote:

infinitytec wrote:

XayCraft360 wrote:

Right now, the resolutoin is 4:3, and the size is 480:360, but if we kept the same X, it wold be 480:270
That could work, but would probably scale 4:3 projects poorly.

The other option would be to keep Y, which would be 640:360, which might scale a bit better

EDIT:: Ninja'd
Yeah, this is probably more like what I would do.
But I want to support 4K bitmap if possible.
JGames101
Scratcher
100+ posts

Scratch 3.0 mod

I have briefly looked at changing the aspect ratio of the stage:

I only modified one file in the GUI so far, and everything in the GUI scales nicely, but as I have not updated anything to do with rendering, the project just looks smooshed and does not use the same resolution as the GUI (480x270) but instead the regular resolution (480x360). I'll add updates as I improve the mod.

To change the resolution of the stage in the GUI, just open src/lib/layout-constants.js, find the default export, and change the width and height values to whatever you'd like them to be.
_nix
Scratcher
1000+ posts

Scratch 3.0 mod

JGames101 wrote:

I have briefly looked at changing the aspect ratio of the stage:
Wow! That's neat. I didn't realize that whole side of the GUI would automatically fit to the new size so nicely. I guess I should have expected it, since it all uses CSS Flex, but still, cool!

I think you'll probably have to change some constants in the scratch-render repository to make the actual resolution of the stage be correct.
JGames101
Scratcher
100+ posts

Scratch 3.0 mod

_nix wrote:

I think you'll probably have to change some constants in the scratch-render repository to make the actual resolution of the stage be correct.

I modified scratch-vm/src/engine/runtime.js, which has constants STAGE_WIDTH and STAGE_HEIGHT, and modified the say block to output the dimensions to make sure it worked, the output is still smooshed, but the stage is now 480x270.

Last edited by JGames101 (Dec. 31, 2018 20:11:19)

JGames101
Scratcher
100+ posts

Scratch 3.0 mod

I got it to work!

There was another file inside scratch-render setting the default resolution it renders at.

Here were all the files I changed:

SCRATCH-GUI - src/lib/layout-constants.js: I changed the default export's height from 360 to 270.
(EDIT: To get fullscreen to work) src/lib/screen-utils.js: in the function getStageDimensions, on line 62, in small browsers, it finds the stage height in fullscreen by multiplying the width by .75. Change .75 to .5625 for 16:9 or anything else for a custom ratio, and on line 58, it finds the width for all other browsers. Change line 58 to however you'd like to obtain the width. Here's what I did:
stageDimensions.width = stageDimensions.height + Math.round(stageDimensions.height / 1.28571429);

SCRATCH-VM - src/engine/runtime.js: I changed the method GET_HEIGHT to return 270 instead of 360. This one isn't absolutely necessary, but it will make blocks like if on edge work properly with the new resolution.

SCRATCH-RENDER - src/RenderWebGL.js: I changed the constructor's default resolution. There is info about the constructor above for documentation, which would be good to update, but the only line you need to change is:
this.setStageSize(xLeft || -240, xRight || 240, yBottom || -135, yTop || 135);
(I changed 170 and -170 to 135 and -135)

Because the resolution is shorter instead of wider, all 4:3 projects should mostly work, but UI elements in the corner will be cut off.

You can try it at https://thejamesbm.github.io/scratch-16-9/

Last edited by JGames101 (Dec. 31, 2018 17:24:11)

infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

JGames101 wrote:

I got it to work!

There was another file inside scratch-render setting the default resolution it renders at.

Here were all the files I changed:

SCRATCH-GUI - src/lib/layout-constants.js: I changed the default export's height from 360 to 270.
(EDIT: To get fullscreen to work) src/lib/screen-utils.js: in the function getStageDimensions, on line 62, in small browsers, it finds the stage height in fullscreen by multiplying the width by .75. Change .75 to .5625 for 16:9 or anything else for a custom ratio, and on line 58, it finds the width for all other browsers. Change line 58 to however you'd like to obtain the width. Here's what I did:
stageDimensions.width = stageDimensions.height + Math.round(stageDimensions.height / 1.28571429);

SCRATCH-VM - src/engine/runtime.js: I changed the method GET_HEIGHT to return 270 instead of 360. This one isn't absolutely necessary, but it will make blocks like if on edge work properly with the new resolution.

SCRATCH-RENDER - src/RenderWebGL.js: I changed the constructor's default resolution. There is info about the constructor above for documentation, which would be good to update, but the only line you need to change is:
this.setStageSize(xLeft || -240, xRight || 240, yBottom || -135, yTop || 135);
(I changed 170 and -170 to 135 and -135)

Because the resolution is shorter instead of wider, all 4:3 projects should mostly work, but UI elements in the corner will be cut off.

You can try it at https://thejamesbm.github.io/scratch-16-9/
Wow! That is very helpful! Thanks!
infinitytec
Scratcher
1000+ posts

Scratch 3.0 mod

Anyone have a name idea?
LuckyLucky7
Scratcher
1000+ posts

Scratch 3.0 mod

infinitytec wrote:

Anyone have a name idea?
Maybe you could name the mod something related to your username, like Infinity.

Powered by DjangoBB