libscratchcpp icon indicating copy to clipboard operation
libscratchcpp copied to clipboard

Support Scratch 2 projects

Open adazem009 opened this issue 2 years ago • 4 comments

adazem009 avatar Aug 05 '23 14:08 adazem009

You do realise that Scratch 1 and Scratch 2 players are both deprecated? I mean yeah you could find a way to, but it's really hard. Scratch 1.4 is a modified version of squeak, and you would have to look into the source code to find out how to display those. And for scratch 2 it's similar but not as bad. Scratch 2 was written in Actionsctript as a .swf file published and then compiled into a .exe and that is the thing you can download off the Scratch site - the project itself was and adobe flash project. Since 2021 adobe flash is no longer working bc of its time-bomb. You can use the .exe File though, or the .swf with ruffle (a flash emulator which tries to replicate adobe flash). But I don't really think it's really possible to make a window that shows Scratch 1.4 or Scratch 2 files if you don't know how the code of scratch itself works. I think you should seek the developers of the scratch 1.4 and Scratch 2 Repo on GitHub and ask them how it works. Also there is not much documentation of Scratch 1.4 files, but Scratch 2 is documented very well. I think you could use that documentation to maybe build a little emulator for the Scratch 3 files which are displayer so it can run Scratch 2 files by default too. Anyways, its a hard topic and I do understand why you wanna do this but I would have done it like Scratch did it. Upgrading the scratch 1 file into a Scratch 2 file and that into a Scratch 3 file and letting that run on the Display. Scratch has a sb1 to sb2 converter on its GitHub, and I think making a scratch 2 to scratch3 converter is hard but doable and it would improve the project itself. I hope I didn't write it too long lol, anyways - i hope I could help :-).

DaikoGames avatar Aug 15 '25 13:08 DaikoGames

@DaikoGames Hi. First of all, the "player" for Scratch projects is already implemented. You just have to load project data into the structures this library provides. For Scratch 3 projects, this is implemented here: https://github.com/scratchcpp/libscratchcpp/blob/3619dccdfe3f22c0257a36fade15d8713ca78a79/src/internal/scratch3reader.cpp I know Scratch 2 and below are deprecated, but there are still many Scratch 2 projects on the Scratch website which can't be loaded by libscratchcpp. I have to implement a loader for Scratch 2 projects. Once it is implemented, I can also add support for Scratch 1.4 projects just in case someone tries to load some old project.

adazem009 avatar Aug 15 '25 13:08 adazem009

@adazem009 thanks for the response I hope my answer wasn't all too bold lol XD. Also I do think it's possible to make the sb3 loader load sb2 files as those files have similarities which can be used. I will try to find a sb2 project loader which can be used for if that's possible. I hope I could help :-).

DaikoGames avatar Aug 15 '25 15:08 DaikoGames

I just discovered this project (realized it's extremely similar to ours: https://github.com/ScratchEverywhere/Everywhere except ours is currently integrated significantly more with the renderer), and I would recommend just using the Scratch Wiki as it documents all 3 version's formats really well: https://en.scratch-wiki.info/wiki/Scratch_File_Format_(2.0)

gradylink avatar Sep 29 '25 01:09 gradylink