How to guides and tutorials
How to sign up and sign in
In order to save your projects or play multiplayer games you need to have a NetsBlox account.
Open the editor and click on the cloud icon, there you will find the signup button. When you are filling the form make sure to use an up to date and working email address. After you sign up a password will be emailed to you. Go to your email copy the password and come back to the editor. You can then change this password via the "change password" option in the same cloud menu.
* If you can't find the email from NetsBlox, make sure to check your email's spam folder.
How to send and receive messages
Message sending and receiving can be done using the following blocks:
The top block (starting with
when I receive) is used to receive messages from others and the bottom block (starting with
send msg) can be used to send messages to other users.
The message handling block contains a dropdown for setting the message type for which it listens:
This dropdown contains the names of all defined message types in the given role. Selecting one of the message types will dynamically change the block and add variable blocks for each of the expected fields in the given message type:
Upon receiving a message, these variable blocks will be set to the values received in the given message. In the above example, this allows the user to retrieve the values sent for role, row and column.
Like the message handling block, the
send msg block also contains a field for specifying the message type:
After setting the message type, the send block will update to provide inputs for each of the expected inputs:
The empty input fields contain grey-ed out text displaying the field name for the corresponding input. These inputs can be filled just as any other block input slot:
Finally, the block only needs to specify to whom we want to send the given message. This is specified using the last dropdown:
This dropdown contains all the roles in the room as well as two extra fields: "others in room" and "everyone in room". Setting the field to "others in room" will result in the given role broadcasting the message to all other roles in the room whereas "everyone in room" will send the message to everyone in the room including the sender. Selecting any other entry will result in the message being sent only to the corresponding role.
After selecting the role, the message can be sent! In the following example, the block will send a TicTacToe message with the role field set to the role name of the sender, the row field set to 3 and the column field set to 4. This message will be broadcasted to everyone else in the room (not including the sender).
How to use services (RPCs)
Using services is pretty easy; simply select the "Services" tab from the project menu:
Then select the desired Service to import from the dropdown:
Now, the map rpc blocks are available under the "Custom" tab:
Then you can use the provided blocks to leverage the NetsBlox service:
How to manage a room
The owner of the TicTacToe game can use the room tab to add new roles to the room (using the "plus" button), add/remove roles, rename roles and invite other users to occupy different roles in the given room. This is done by clicking on the given role in the room tab:
From this dialog, there are a number of supported actions:
- cloning the role: This will create a new role in the room which is a copy of the clicked role. This includes sprites, blocks, costumes, code blocks, etc.
- moving to the role: This option allows the owner to move from the currently occupied role to the clicked role.
- inviting another user: Inviting a user will allow the owner to invite other users to occupy the given role at the room. This allows the given user to run and edit the blocks running at the given role.
- deleting the role: This will remove the role and all it's blocks from the given room and project.
However, if a user is already occupying the given role, then the dialog also allows the owner to evict the user. This will remove the user from the owner's project:
Roles can be renamed by clicking on the name of the role:
How to work with custom messages
A number of the Services include predefined message types to be used with the given service (such as the TicTacToe, Earthquakes and Battleship services). However, there are many cases in which a user may want to define a custom message type. This can be done by first clicking on the "Make a message type" block in the block palette under the "Services" tab:
This will open the message type creation dialog. This dialog provides an interface for specifying the name and fields for the given message type:
After selecting "OK", the given message type will be created! An example of creating the TicTacToe message type used throughout this example is shown below:
In this example, the name has been set to "TicTacToe" and the fields input has been extended to have three slots (by clicking the right arrow). These fields have been named "role", "row" and "column".
How to play multiplayer games
- Sign in: First things first, for multiplayer games to work all the players need to be signed up and logged in. Here is how to do that.
- Find & open a game you like: you can go through the list of our examples and user created apps on netsblox front page, or have a friend share his own creation with you.
- Get the participants in the game/room:
- If you are the first one opening the game (owner), to invite your opponents/teammates, go to the room tab you will see a circular view of the room and available roles. Each player occupies one role. To invite players click on a role choose invite users and search for your friend's username and hit ok to ask them to join your game.
- If you are being invited to a game, make sure you have editor.netsblox.org open in your browser and that you are signed in. After you are invited, you will get a dialog asking you if you want to join the game.
- Start the game: make sure all the players are in by looking at the room view, if there is someone missing go back to third step. Now that you are all set, the main role can start the game by clicking on the green flag at the top right corner. You can maximize the stage (playground) by clicking on the icon.
- To test multiplayer games, you can invite yourself to play by opening a new browser tab, going to the netsblox editor and invite "myself" as a player.
What are rooms in NetsBlox
The NetsBlox Room defines the local network for a given application. A room can contain a number of different roles which are distinct NetsBlox clients running in their own window or machine. For example, a TicTacToe game may consist of two roles, X and Y, which represent the two players in the game of TicTacToe:
What are messages
Remote messaging allows users to send messages over the internet between different instances of NetsBlox, enabling users to create distributed, online apps. Unlike events, messages can contain a structured data payload. That is, they can be used to send information between NetsBlox scripts and users. The structure of messages is defined in a message type. A message type contains the name of the message as well as the names of the expected fields of the message. For example, a message type may specify a type of message called "TicTacToe" that contains "role", "row" and "column" fields.
What are services
Services are provided by the NetsBlox server and allow the client to easily incorporate third party utilities (such as Google Maps, MovieDB, Weather, and Traffic data) as well as simplifies the creation of games which otherwise may be more complex (such as Battleship and ConnectN).