Discuss Scratch

drmcw
Scratcher
1000+ posts

Scratch 2.0 Offline Open Source Code!

DadOfMrLog wrote:

drmcw wrote:

So who will be first to up the clone limit or remove it?

Oh, that one looks easy enough…

In src/primitives/Primitives.as:

public class Primitives {

private const MaxCloneCount:int = 300;




One of the first things I'd be happy to do would be:

public function keepOnStage():void {
// removed everything from here…
return;
}



Yep saw both those!
eikz
Scratcher
39 posts

Scratch 2.0 Offline Open Source Code!

shadow94
Scratcher
11 posts

Scratch 2.0 Offline Open Source Code!

cooolllll!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
shadow94
Scratcher
11 posts

Scratch 2.0 Offline Open Source Code!

great………………………!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
superb
FlowOS
Scratcher
100+ posts

Scratch 2.0 Offline Open Source Code!

speakvisually wrote:

We've open sourced the Scratch 2.0 editor code! You can find the code in the following repository on Github, https://github.com/LLK/scratch-flash

Scratch On!
Eric

Nice! Now we can make modifications if we want to (but I guess you'd have to be pretty savvy )
griffpatch
Scratcher
100+ posts

Scratch 2.0 Offline Open Source Code!

DadOfMrLog wrote:

Woah, excellent! Never done anything with Flash/ActionScript before, but maybe I should have a go. (Oh for more hours in the day…)


After a quick scan through, I can already see a number of simple things that might be worth doing.
e.g. some basic checks to prevent unnecessary work if the new direction/size are same as previous:


public function setSize(percent:Number):void {

var newscale = Math.max(minScale, Math.min(percent / 100.0, maxScale));
if (scaleX == newscale) return;
scaleX = scaleY = newscale;



public function setDirection(d:Number):void {

d = (d > 180) ? d - 360 : d;
if (direction == d) return;
direction = d;

clearCachedBitmap(); <— will adding this deal with the rotated sprite touching bug…?
updateBubble(); <— also note that speech bubble should change when rotated
}


Would above really ‘just work’ in the way I think, or am I missing something…?


I second that! I also saw the potential for not re-rasterizing costumes when they are not rotated or scaled… Would be excellent, and would save a few lines of script every time I change costume to manually do the check - So… who can find and fix the Chrome pepflashplayer keyboard lag issues now!
griffpatch
Scratcher
100+ posts

Scratch 2.0 Offline Open Source Code!

DadOfMrLog wrote:

Whoa! Custom reporters!
-Certainly looking forward to those. Was wondering how the actual “report” might work…

Nice to see the speech bubbles for reporter values also making a comeback.

(Oh, yes, and a bugtracker, too…)

I saw the screenshot of those too a couple of days back… They looked awesome! But if got me thinking that you still need local variables within custom blocks to really make use of recursive calls. Also, I often want to return more than one value from a custom block, so it might not make a huge difference to me after all. The bug fix around set var and change var always missing their caches interested me a lot… I wonder if that will speed things up some. I do wish that list manipulation could be sped up though.
TheLogFather
Scratcher
1000+ posts

Scratch 2.0 Offline Open Source Code!

griffpatch wrote:

local variables within custom blocks…
Yeah, that'd also help the variable creep considerably. Been wondering for a while how such a thing might be able to work/look UI-wise, though…

griffpatch wrote:

Also, I often want to return more than one value from a custom block, so it might not make a huge difference to me after all.
True, although, as they (don't quite) say, one head is better than none!

griffpatch wrote:

The bug fix around set var and change var always missing their caches interested me a lot… I wonder if that will speed things up some. I do wish that list manipulation could be sped up though.
I think list manipulation doesn't seem too bad, until they start to get long (tens of thousands of entries), and then delete/insert/replace operations become quite prohibitive.

However, adding to a long list isn't so bad, meaning it actually ends up being considerably quicker, if you want to insert/replace/delete a lot of items, to copy everything to a new list, adding/not-adding the replaced/inserted/deleted items where appropriate, and then delete the whole of the original list and copy everything back into it from the fully reconstructed list. Bizarre!

griffpatch wrote:

I second that! I also saw the potential for not re-rasterizing costumes when they are not rotated or scaled… Would be excellent, and would save a few lines of script every time I change costume to manually do the check
I did have a hunt around to see about optimising the costume switch (so it does nothing if it's the same costume). There does appear to be some optimisation for that already:
public function showCostume(costumeIndex:Number):void {
...
var c:ScratchCostume = currentCostume();
if (c == lastCostume) return; // optimization: already showing that costume
...
}
OTOH, looking again at context of above code, maybe that's only relevant to bitmap costumes?

However, running some tests does indeed show that switching to the same costume is significantly faster than switching to a different costume these days (not sure when that happened?) Curiously, though, it's definitely nowhere near a no-op - it is still a significant fraction of the full switch time. I'm not sure yet where it's losing that…

Maybe this change is enough:
public function showCostume(costumeIndex:Number):void {
if (isNaNOrInfinity(costumeIndex)) costumeIndex = 0;
var newIndex = costumeIndex % costumes.length;
if (newIndex < 0) newIndex += costumes.length;
if (newIndex == currentCostumeIndex) return; // <--- optimise: already this costume
currentCostumeIndex = newIndex;
...

griffpatch wrote:

So… who can find and fix the Chrome pepflashplayer keyboard lag issues now!
From what I've seen elsewhere, I think this has a lot to do with Flash itself, and gets particularly hit by Chrome's implementation for some reason. It seems to be to do with not leaving Flash sufficient time to do its private event processing between frames/refreshes.

I did wonder if this could have some relevance, though:
public function stepThreads():void {
startTime = getTimer();
var workTime:int = (0.75 * 1000) / app.stage.frameRate; // work for up to 75% of one frame time
...
Maybe try dialing that down and see if it leaves a bit more room for whatever extra overheads Chrome's Flash needs? (At the expense of overall performance, no doubt…)
OTOH, I don't know if above makes any difference at all for non-refresh script…

Last edited by TheLogFather (May 14, 2014 11:18:02)

SeaRider
Scratcher
2 posts

Scratch 2.0 Offline Open Source Code!

That sounds cool
move () steps
say [yay]
change [ v] effect by (25)
nathanprocks
Scratcher
1000+ posts

Scratch 2.0 Offline Open Source Code!

I just seen this in a Code Project newsletter email. I might check it it tomorrow. I can't wait to see some awesome 2.0 mods!
jonigiri
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

thanks to the scratch team and everyone who has supported me! i would like to say thank you to fishey2001 because he gives me lots of inspiriation for projects!
tcodina
Scratcher
500+ posts

Scratch 2.0 Offline Open Source Code!

Oh, cool! Is that action script? Well, I know some action script, so I could have a peek at the code if I had time Awesome job!
jonigiri
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

just a quick comment to say thank you but thank you to everybody who has remixed my projects and the scratchers who follow me. everybody who has inspired me to do a warriors project
jonigiri
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

thanks!
Wonder_Innovations
Scratcher
1 post

Scratch 2.0 Offline Open Source Code!

wow cool
EmeraldDaffodils
Scratcher
100+ posts

Scratch 2.0 Offline Open Source Code!

Great! I'm only 10, so I can't code :p (apart from Scratch!) but I'll check it out all the same!
Cubed
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

What code is Scratch written in?
jonigiri
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

thanks!
jonigiri
Scratcher
23 posts

Scratch 2.0 Offline Open Source Code!

i agree with you!





RealTheawesome67
Scratcher
30 posts

Scratch 2.0 Offline Open Source Code!

Awesome!

Powered by DjangoBB