Event time! design a multiplayer with the mqtt blocks!

within the next month i want you guys to create a game in snap! featuring the mqtt blocks. i found, with my chatsonic on my side, that mqtt can INDEED be added in multiplayer games! If you manafed to create a game before the timer runs out, publish it in to this topic and i will that rank game you've made from 1 to 10. With all that being said, get to working boys!

these are all the blocks you are gonna need
untitled script pic (3)

If I enter this event I'll need some time to figure out how these blocks work. I only know that they are used to send messages to other people with the project open at the same time, but I don't think it has any facilities for storing its data.

yeah you can go ahead!... oooorrrrr... open the "MQTT Extension Examples block", it has got everything here.

Check out this thread and you can store data on a broker if you use the retain option

i made this project a while ago: Snap! Build Your Own Blocks

here's how it works (if interested; can be useful for future live multiplayer):

FYI I noticed that when I loaded in an old project, the existing MQTT blocks in the project are not compatible with the underlying mqttExtension.js code and so cause errors. :frowning:

To get around this I loaded in the old project, created a new "old mqtt" category and edited the MQTT blocks to move them to the new "old mqtt" category

Then I loaded in new library and I could see which blocks needed updating
image

and then edited my project to use the new library only.

There are other methods that can be used and I'm now trying to see if I can write a Snap! script to automatically update a project

Alright, I'll read it.

seems to work for me

My first idea is to make something similar to Club Penguin. The data (position, costume, etc) of your character will be sent to all other running projects using MQTT and that way you'll see everybody else. This data will be sent every second because I'm guessing MQTT isn't going to be as fast as I need it to be. You'll be able to chat but instead of storing it in a list of messages, it'll use the say block with your character.

Cool!

(See what I did there?)

No offsite conversations are allowed. So don't add that to your project

Mqtt is the easiest way of doing multiplayer I’m pretty sure, although it’s not too secure with the way snap works

It is secure if you have access to your own broker instance that only allows you to to publish to topics.

EMQ https://www.emqx.io provide access to a free instance with this facility but people using school computers might not have access to using it

Could you add, say, emoji chat where you can only pick from a list of emoji?

I have no idea what "emoji chat" is/means :slight_smile:

I am old :slight_smile:

Snap! forums T&C says no off-site chats allowed.

iI is programmatically easy for MQTT to be used for chats.

As an MQTT evangelist and maintainer of the library, I don't want to see the MQTT extension removed because someone abused it to chat

So don't come close to using it to chat :slight_smile:

Ok, I won't.

nope, i would suggest not using that one

they mean you can only use emojis to chat, i think
or like you have a list of icons you can use

Why not?

Have you tried setting up an account with them?