Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » gbc.sb2 - Emulation in Scratch
- technoboy10
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
I feel sure that this is the least efficient way to play 2048, but it's awesome that it works.
http://phosphorus.herokuapp.com/#34819544
http://phosphorus.herokuapp.com/#34819544
trans rights are human rights
- DCPU-16
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
That's pretty cool! Looks like the recent change fixed a bug when going to the bonus screen in Super Mario Land 2 as well.
- nXIII
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
Great! If you find any other bugs, let me know. Looks like the recent change fixed a bug when going to the bonus screen in Super Mario Land 2 as well.
Audio synthesis more or less works now, too: https://phosphorus.herokuapp.com/#34791164
EDIT: disabled sounds on Heroku because the lack of ADPCM support was breaking lots of projects.
Last edited by nXIII (Nov. 19, 2014 23:38:06)
- drmcw
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
The blue project load bar goes pink at the end and the project doesn't load using the link.Great! If you find any other bugs, let me know. Looks like the recent change fixed a bug when going to the bonus screen in Super Mario Land 2 as well.
Audio synthesis more or less works now, too: https://phosphorus.herokuapp.com/#34791164
- drmcw
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
Tried that but no joy. Tried different browser and worked once then got same pink bar and no project load.Try clearing your cache? The Scratch asset server sometimes freaks out. The blue project load bar goes pink at the end and the project doesn't load using the link.
- DCPU-16
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
Very impressive! I never expected this to be running near fullspeed in scratch even in my lifetime, heh. Might have to add a framelimiter soon.
https://phosphorus.herokuapp.com/#35193240
You can now very clearly see the stairs bug in pokemon - it's literally impossible to leave the room! There's also a bug with the coin shop in Super Mario Land 2, but both of these are on my side so you shouldn't have to worry about them.
I noticed that you're creating oscillators for the notes - eventually you'll want to move onto implementing a pseudo midi engine for this. You should be able to pitch shift samples using .playbackRate and implement accurate Attack/Delay/Sustain/Release behaviours when playing notes by using the linear exact timing functions for AudioParams on a gain node's gain. Check this out - just works on that exact principle:
https://dl.dropboxusercontent.com/u/12239448/sseqplayer/audio.html
What you should be looking at is in sseqPlayer.js playNote(), you can see how it sets up the note's attack, delay and release phases using linearRampToValueAtTime. It also sets the playback rate to adjust the instrument from its start note (ie. the one in the sample) to the target note.
Looks like the instrument samples are already readily available on the scratch-flash GitHub, the license is GNU though so this may prove problematic since you are using MIT (may be able to host the instruments locally, but not distribute them as part of your project? not too sure how this works):
https://github.com/LLK/scratch-flash/tree/master/src/soundbank/instruments
EDIT: Instrument definitions are here! https://github.com/LLK/scratch-flash/blob/master/src/sound/SoundBank.as
https://phosphorus.herokuapp.com/#35193240
You can now very clearly see the stairs bug in pokemon - it's literally impossible to leave the room! There's also a bug with the coin shop in Super Mario Land 2, but both of these are on my side so you shouldn't have to worry about them.
I noticed that you're creating oscillators for the notes - eventually you'll want to move onto implementing a pseudo midi engine for this. You should be able to pitch shift samples using .playbackRate and implement accurate Attack/Delay/Sustain/Release behaviours when playing notes by using the linear exact timing functions for AudioParams on a gain node's gain. Check this out - just works on that exact principle:
https://dl.dropboxusercontent.com/u/12239448/sseqplayer/audio.html
What you should be looking at is in sseqPlayer.js playNote(), you can see how it sets up the note's attack, delay and release phases using linearRampToValueAtTime. It also sets the playback rate to adjust the instrument from its start note (ie. the one in the sample) to the target note.
Looks like the instrument samples are already readily available on the scratch-flash GitHub, the license is GNU though so this may prove problematic since you are using MIT (may be able to host the instruments locally, but not distribute them as part of your project? not too sure how this works):
https://github.com/LLK/scratch-flash/tree/master/src/soundbank/instruments
EDIT: Instrument definitions are here! https://github.com/LLK/scratch-flash/blob/master/src/sound/SoundBank.as
Last edited by DCPU-16 (Nov. 19, 2014 20:19:59)
- nXIII
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
Naturally—I just wanted to get something relatively fast/easy running first. Thanks for passing along those links. I noticed that you're creating oscillators for the notes - eventually you'll want to move onto implementing a pseudo midi engine for this.
As for the instrument files, hotlinking to the GitHub ones might be an option, e.g., https://raw.githubusercontent.com/LLK/scratch-flash/master/src/soundbank/instruments/AcousticGuitar_F3_22k.wav
Last edited by nXIII (Nov. 19, 2014 23:37:57)
- DCPU-16
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
I'm not sure, but I think audio is one of the things that can't be loaded cross origin without explicit permission from the host.Naturally—I just wanted to get something relatively fast/easy running first. Thanks for passing along those links. I noticed that you're creating oscillators for the notes - eventually you'll want to move onto implementing a pseudo midi engine for this.
As for the instrument files, hotlinking to the GitHub ones might be an option, e.g., https://raw.githubusercontent.com/LLK/scratch-flash/master/src/soundbank/instruments/AcousticGuitar_F3_22k.wav
- XGamer01
- Scratcher
500+ posts
gbc.sb2 - Emulation in Scratch
Wow…
No signature currently stored in profile.
- MathWizz
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
I'm curious as to how it would perform if the screen were drawn using stamping rather than pen because phosphorus is significantly faster at stamping than scratch is.
EDIT: After some testing, pen trails still seem slightly faster.
EDIT: After some testing, pen trails still seem slightly faster.
Last edited by MathWizz (Nov. 21, 2014 02:47:16)
running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizz — JsScratch && sb.js & Amber (coming soon! maybe)
- nXIII
- Scratcher
1000+ posts
gbc.sb2 - Emulation in Scratch
Sounds are back on Heroku—with real synthesizers this time, though gb.sb2 sounds roughly the same: https://phosphorus.herokuapp.com/#34791164
- DCPU-16
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
Amazing work! Glad to see implementing the synthesiser worked out so well.
- Sirmentio
- Scratcher
16 posts
gbc.sb2 - Emulation in Scratch
All I can say is that this is pushing the limits of scratch beyond space, beyond time, and into the underworld and back. This is amazing and you should feel amazing.
I used to be stickdude123…..but then I am here.
- iggykoopa
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
The game only shows a white screen
Game header:
SUPER MARIOLAND
Game header:
SUPER MARIOLAND
sometimes i use a user theme
sometimes i dont
sometimes i want the old 1.4 design back
Realms Announcement: I HAVE A REALM
- DCPU-16
- Scratcher
100+ posts
gbc.sb2 - Emulation in Scratch
You must not have been waiting for very long! On Scratch 2.0 it takes about 5 seconds for the title screen to load. It's fully playable on phosphorus (audio is kinda bad though):
http://phosphorus.github.io/#36699900
http://phosphorus.github.io/#36699900
- Discussion Forums
- » Advanced Topics
- » gbc.sb2 - Emulation in Scratch