Mesh is a way of making different Scratch programs interact - even if they're on different computers.
Before we start: Scratch Wiki links are here! Use them when you want to look something up.
Build Your Own Blocks (BYOB)
Panther
([ ] sensor value)
System Browser
Shift-clicking the R
Mesh (as if you need that article, a Mesh guide is right here and the article was based on this anyway)
Contents
How to get Mesh
How to host and join Mesh sessions
New features that Mesh gives you
Examples of programming with Mesh features
Panther's Mesh blocks
How to get Mesh
The easy way: Download Jens's and bharvey's Build your own blocks (BYOB) - it comes with Mesh, available nice and easily.
The hard way: You edit Scratch's System Browser to make Mesh available. Here's how (it's a bit complicated, so there are pictures):
1. Shift-click the upper part of the R in the Scratch logo. (Some people just say the R, but only the upper part works.)
2. Select "turn fill screen off".
3. You will now have a white area at the bottom and right side of the screen. Click on the white area and select "open...".
4. Now select "browser".
5. Now you've opened the System Browser! In this place you can edit Scratch (see here for more stuff with the System Browser). Anyway: Go to Scratch-UI-Panes - ScratchFrameMorph - menu/button actions - addServerCommandsTo: . (click for full size)
6. Look down, and edit the "t2 ← true" to "t2 ← false".
7. Right-click and select "accept".
8. Enter in your initials (you can fake it, it doesn't matter) and click "accept".
9. Exit the System Browser.
10. Shift-click the R and select "turn fill screen on".
If you don't want to go through the process every time you want to use Mesh, you can save the System Browser so Mesh will stay available - Shift-click the R again and select "save image for end-user".
If you don't want Mesh anymore, just change the 'false' back to 'true'.
How to host and join Mesh sessions
(Note that Mesh sessions will only work between Scratch programs on a local network - for a larger range, use a program like Hamachi.)
A Scratch program that has Mesh available on it looks just like the un-edited Scratch program. But there's Mesh hidden somewhere!
• With modified Scratch, Shift-click Share to get the Mesh buttons.
• With BYOB, normally click Share to get the Mesh buttons.
• With Panther, simply click the Mesh 'tab' to get the Mesh buttons.
Ooh! Mesh stuff!
• Host Mesh lets you host a Mesh session.
• Join Mesh lets you join a Mesh session.
To host a Mesh session:
1. Click Host Mesh.
2. Done! Your IP address will show up - you'll see why in a bit.
To join a Mesh session:
1. Click Join Mesh.
2. Enter in the IP address of the computer that is hosting the Mesh session.
What if you want to join a Mesh session, but the person hosting the Mesh session forgot to tell you the IP address, and he/she forgot what the IP address is? He/she Shift-clicks the Share button and selects "Show IP address". The IP address will pop up like before.
A Mesh session can have more than two Scratch programs connected at once - there's no limit! All Scratch programs have to connect to the same IP though.
New features that Mesh gives you
Programming things with Mesh is (almost) the same as with the ordinary Scratch program - after all, if you're not in a Mesh session it's the same, right? But when you're in a Mesh session, things get slightly different:
• Broadcasts are received on all Scratch programs.
• You can use each other's variables.
If you create a new broadcast on one Scratch program, it won't be made in the other. You have to make the broadcast on both Scratch programs.
To use variables from other Scratch programs, you don't find them at the Variables section - instead, you have to use the ([ ] sensor value) block. It's near the bottom in Sensing. To use it, simply select the variable from the drop-down menu - in a Mesh session, the variables from all connected Scratch programs will appear on the drop-down menu!
That's all that's different with programming in Mesh - program projects the same way, but design it for multiple people, and don't forget the broadcasts and variables!
Examples of programming with Mesh features
Programming with Mesh features can be simple for some, but tricky for others. Here are the basics of programming with Mesh features.
Communicating with broadcasts
This is so easy. Create a broadcast on all Scratch programs (it has to be the exact same name!). Have one Scratch program send the broadcast (use the [broadcast [ ]] block), and a different one wait for it to be received (use the [when I receive [ ]) block, but you can also use <[ ] received?> if you put it in the source code or are using Panther). It works! Use it for communicating between Scratch programs.
For example, in multiplayer battle games, the health bars must be the same on each Scratch program. Therefore, when a health bar changes on one Scratch program, it must send a broadcast to the other Scratch program telling it to change its health bars.
Communicating with variables
This is just as easy. Use the ([ ] sensor value) Sensing block (in a Mesh session it'll show all variables from all Scratch programs) and select the variable you want. Done! There's your variable. Use it as you normally do.
For example, in a multiplayer game: If you want to 'read' a score from a different Scratch program, you can just use that block mentioned above to get the score (if the score is in a variable).
Panther's Mesh blocks
sparks (one of Panther's developers) said that people often ask what Panther's Mesh blocks do... they look pretty straightforward to me, but I'll put it in here anyway.
• [host mesh] - Creates a Mesh session with its Panther program as the host. It does it for you!
• <hosting mesh?> - If its Panther program is hosting Mesh, it reports true; if it's not, it reports false.
• [join mesh [ ]] - Connects to a Mesh session that's being hosted by the given IP address. Of course, if the IP isn't hosting a Mesh session, the block won't work.
• [leave mesh] - If its Panther program is in a Mesh session, the block makes it leave.
• (mesh IP address) - Reports the IP address that people will use if they want to connect to a Mesh session that the block's Panther program is using.
Hope this helps you - and have fun with Mesh!
Jonathanpb
Last edited by Jonathanpb (2011-02-08 19:27:38)
Offline
For some reason I don't get the "host" and "join" mesh options...
Offline
Thanks, this really helped
Offline
Nice tutorial.
Offline
juststickman wrote:
For some reason I don't get the "host" and "join" mesh options...
Did you hold shift while pressing 'share'? Cos I had this problem untill I realised I had to do that
Offline
juststickman wrote:
For some reason I don't get the "host" and "join" mesh options...
You're supposed to Shift-click "Share". (That is in the guide - you probably missed it. )
Offline
RicoSuave wrote:
It just crashes
What do you exactly mean? It doesn't crash for me...
Anyway: Thanks for your compliments everyone!
Offline
Ooh, a hopeful sticky... mesh is a bit odd, so this helps.
Offline
Thanks for the guide!
Will one person's actions show up on the other person's screen? I want to collaborate easily.
Offline
Vista4563 wrote:
Thanks for the guide!
Vista4563 wrote:
Will one person's actions show up on the other person's screen? I want to collaborate easily.
The only interaction is that all Scratch programs receive the broadcasts, and that you can use the block ([slider] sensor value) to use a different Scratch program's variables. That's all you need, actually - it's quite weird, isn't it?
Last edited by Jonathanpb (2010-03-12 23:48:27)
Offline
Does is have to be a game for people to join it?
Offline
littletonkslover wrote:
Does is have to be a game for people to join it?
Mesh projects don't have to be games! They can be anything you want - just like normal Scratch projects.
Offline
Sure!
Offline
Jonathanpb wrote:
juststickman wrote:
For some reason I don't get the "host" and "join" mesh options...
You're supposed to Shift-click "Share". (That is in the guide - you probably missed it. )
Ohhhhh, SHIFT click.
Offline
Jonathanpb wrote:
littletonkslover wrote:
Does is have to be a game for people to join it?
Mesh projects don't have to be games! They can be anything you want - just like normal Scratch projects.
Cool! ~ So can 2 people work on a project at once.......?
Offline
littletonkslover wrote:
Does is have to be a game for people to join it?
All mesh does is share broadcasts and variables.
Offline
littletonkslover wrote:
Jonathanpb wrote:
littletonkslover wrote:
Does is have to be a game for people to join it?
Mesh projects don't have to be games! They can be anything you want - just like normal Scratch projects.
Cool! ~ So can 2 people work on a project at once.......?
Mesh doesn't do that - the only thing that goes across to other Scratch programs are broadcasts and variables (variables go across with the ([slider] sensor value) block).
Offline