Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scrax: a Scratch reimplementation
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
Hello, everyone! I’m currently working on a reimplementation of Scratch.
My goal is to eventually make a simple game similar to Human Resource Machine (in gameplay style), except that with Scratch syntax instead.
I want to include various basic programming challenges, starting from very easy ones like “hello world”, into easy ones like “sort a list” into slightly more difficult ones like tree or graph traversal. (With code size and speed target goals.)
I also want to use it to make a proper Scratch implementation, with a loader for existing Scratch projects and thus full compatibility with it.
It is currently fairly early work‐in‐progress, but you can already play around with it and make certain kinds of programs.
I don’t have it hosted on source control yet, but I do plan to host it soon.
Any kinds of thoughts would be appreciated!
Here is a link to it: https://scrax.org
There is also preliminary work on a “stage” page: https://scrax.org/stage
There are also just a few “programming tasks” (challenges): https://scrax.org/tasks
My goal is to eventually make a simple game similar to Human Resource Machine (in gameplay style), except that with Scratch syntax instead.
I want to include various basic programming challenges, starting from very easy ones like “hello world”, into easy ones like “sort a list” into slightly more difficult ones like tree or graph traversal. (With code size and speed target goals.)
I also want to use it to make a proper Scratch implementation, with a loader for existing Scratch projects and thus full compatibility with it.
It is currently fairly early work‐in‐progress, but you can already play around with it and make certain kinds of programs.
I don’t have it hosted on source control yet, but I do plan to host it soon.
Any kinds of thoughts would be appreciated!
Here is a link to it: https://scrax.org
There is also preliminary work on a “stage” page: https://scrax.org/stage
There are also just a few “programming tasks” (challenges): https://scrax.org/tasks
Last edited by zamfofex (Feb. 17, 2025 00:13:19)
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
Hmm, it seems I can’t post a link to it for some reason. It says “Sorry, this post appears to include unsuitable language” as soon as I add a link. The error goes away as soon as I remove the link. I don’t know what’s wrong. (Help would be appreciated!)
Edit: I managed to include the link with an line break within it. (I don’t know why it was being censored.)
Edit: I managed to include the link with an line break within it. (I don’t know why it was being censored.)
Last edited by zamfofex (June 2, 2024 05:58:15)
- ninjaMAR
-
1000+ posts
Scrax: a Scratch reimplementation
Making the stage is going to be more of a challenge, considering the massive amounts of blocks required to implement. It is certainly possible though. Good luck!
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
Since last time, I have added a “block counter” and also a “time” button for measuring performance (under a set of criteria).
The time button works very simply, it will just count the number of blocks that ran. That is regardless of the actual time those blocks take to run. For example, even though the (item () of (list v)) block is faster than the (item # of () in (list v)) block, they count as the same for the sake of the measurement. It also ignores shortcircuiting, i.e. it assumes every reporter block in a given stack block always runs.
The time button is mostly temporary currently.
I’m currently trying to think about coming up with a different UX for adding and modifying custom blocks. In Scratch, it shows a modal dialogue where you customise the custom block, but I think it might make sense to modify the block within the editor itself instead, with buttons in the “define” block itself. Not entirely sure whether that’s more intuitive, but I want to experiment with it.
The time button works very simply, it will just count the number of blocks that ran. That is regardless of the actual time those blocks take to run. For example, even though the (item () of (list v)) block is faster than the (item # of () in (list v)) block, they count as the same for the sake of the measurement. It also ignores shortcircuiting, i.e. it assumes every reporter block in a given stack block always runs.
The time button is mostly temporary currently.
I’m currently trying to think about coming up with a different UX for adding and modifying custom blocks. In Scratch, it shows a modal dialogue where you customise the custom block, but I think it might make sense to modify the block within the editor itself instead, with buttons in the “define” block itself. Not entirely sure whether that’s more intuitive, but I want to experiment with it.
Last edited by zamfofex (June 3, 2024 12:06:09)
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I’ve been continuing to work on it. I decided to move the buttons around, I put them at the top, instead of to the right. (Not sure whether I like that, but I wanted to experiment with it for a while.)
I also added the ability to undo/redo, and also a “holding area” to the right of the program itself. (You can put blocks in there temporarily to use them later.)
I’ve also been working on some fairly significant refactoring, simplifying the code, and also making it easier to add more features later.
I still haven’t gottent around implementing a GUI for the custom blocks, though.
I also added the ability to undo/redo, and also a “holding area” to the right of the program itself. (You can put blocks in there temporarily to use them later.)
I’ve also been working on some fairly significant refactoring, simplifying the code, and also making it easier to add more features later.
I still haven’t gottent around implementing a GUI for the custom blocks, though.
- ninjaMAR
-
1000+ posts
Scrax: a Scratch reimplementation
Do you plan to open source this? You could put this on github and use github pages to host your project.
I do think that creating a GUI/stage would be worthwhile since that is probably one of the best things about scratch.
I do think that creating a GUI/stage would be worthwhile since that is probably one of the best things about scratch.
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
Yes, I am planning to publish it to sourcehut eventually. Not sure if it’s worthwhile to use a different host, though.
Though note that you can already see the source on your browser if you just press “ctrl‐u” while on the page.
Thank you for taking interest!
Though note that you can already see the source on your browser if you just press “ctrl‐u” while on the page.
Thank you for taking interest!
- ninjaMAR
-
1000+ posts
Scrax: a Scratch reimplementation
(#7)I mean so others could collaborate on it
Yes, I am planning to publish it to sourcehut eventually. Not sure if it’s worthwhile to use a different host, though.
Though note that you can already see the source on your browser if you just press “ctrl‐u” while on the page.
Thank you for taking interest!
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
Well, since you asked for it, I decided to add code for the stage. Not really complete at all, you can only have one sprite, and it’s missing a lot of features. But it’s a good start for a proof of concept!
You can see it here (put it in a single line)
scrax.neo
cities.org/stage
I feel like I should probably publish this to sourcehut soon.
You can see it here (put it in a single line)
scrax.neo
cities.org/stage
I feel like I should probably publish this to sourcehut soon.
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I’m not sure if it is against the rules to bump an old‐ish post like this (though this is my own thread, so I think it should be fine).
I decided to pick up work on this project again! I did some major refactoring to simplify the code, and added some more features like (hopefully) improved debugging with breakpoints.
The simplified code also helped make it way less janky, so if you had issues with it bugging out while just moving blocks around, it should be much more reliable now.
I’m probably going to continue working on this project in the near/immediate future, so expect a few more updates on it!
I’ll probably be forever in a state of “it’s ready for source control soon” and end up never actually doing it.
If anyone wants to try it out, please do let me know if you run into issues.
I decided to pick up work on this project again! I did some major refactoring to simplify the code, and added some more features like (hopefully) improved debugging with breakpoints.
The simplified code also helped make it way less janky, so if you had issues with it bugging out while just moving blocks around, it should be much more reliable now.
I’m probably going to continue working on this project in the near/immediate future, so expect a few more updates on it!
I’ll probably be forever in a state of “it’s ready for source control soon” and end up never actually doing it.
If anyone wants to try it out, please do let me know if you run into issues.
- Jeffalo
-
1000+ posts
Scrax: a Scratch reimplementation
this sounds awesome! by ready for source control ‘soon’.. do you mean you don’t even have a local git repo for it? scary stuff
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
this sounds awesome! by ready for source control ‘soon’.. do you mean you don’t even have a local git repo for it? scary stuff
Indeed. Currently, I just update stuff and upload them. I suppose it could be worthwhile to have at the very least some kind of versioning, if nothing else.
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I have continued to work on this! I added various blocks, but there are still a lot missing.
I also added a UI for adding variables, lists, and custom blocks. You can’t rename them, and you can’t remove lists and variables (yet), though. You can remove custom blocks by just dragging away their “define” block when there are no more usages just like normal, though.
I also need to eventually add a UI for managing sprites.
I also added a UI for adding variables, lists, and custom blocks. You can’t rename them, and you can’t remove lists and variables (yet), though. You can remove custom blocks by just dragging away their “define” block when there are no more usages just like normal, though.
I also need to eventually add a UI for managing sprites.
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
A small change: It seems the Scratch forums bans the name of the web hosting for Scrax. So in order to be able to link it properly, I have gotten a domain for it: https://scrax.org (Looks a bit fancier too, I think!)
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I spent the past few days adding copy/paste functionality to it. You can now right‐click on a block to copy it or paste below it on its stack!
It will copy the blocks in Block Plugin syntax, so you can edit it elsewhere, then come back to paste it on the page. (I had to add a Block Plugin syntax parser and serialiser, which took quite a while.)
It will copy the blocks in Block Plugin syntax, so you can edit it elsewhere, then come back to paste it on the page. (I had to add a Block Plugin syntax parser and serialiser, which took quite a while.)
- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I have implemented a simple diffing algorithm to update the DOM more efficiently, so it should be considerably faster now. I also added a simple sorting algorithm as an example program, which seems to work well! I also added a link to this thread on the main page, so people coming from other sources can know where to find more information about it. Lastly, I made it save your program when you come back to the page later.
I think I’m getting a bit burned out of working on this currently, though, so I’m not sure if I’m going to continue working on it soon. But if I do stop working on it for now, I definitely plan to pick it up again eventually!
I think I’m getting a bit burned out of working on this currently, though, so I’m not sure if I’m going to continue working on it soon. But if I do stop working on it for now, I definitely plan to pick it up again eventually!
- ajskateboarder
-
1000+ posts
Scrax: a Scratch reimplementation
Ooo very nice
would be cool if you could run individual scripts
would be cool if you could run individual scripts

- zamfofex
-
15 posts
Scrax: a Scratch reimplementation
I have decided to start working on a “tasks/challenges” page, where there are a few challenges to solve to teach programming. (Though for now, they are extremely simple, but I plan to add more eventually.) https://scrax.org/tasks There are also simple code size and speed goals.
- Discussion Forums
- » Advanced Topics
-
» Scrax: a Scratch reimplementation