How d you use MQTT

im trying to make a multiplayer game with MQTT but i have no idea how to use it
can someone help me figure this out

what part do you need help with?

you dont, mqtt isnt for server side things

mqtt can be used for multiplayer

i dont know how to use the blocks i know what they can do but i dont know how to make them work

From everything ive heard it very much doesnt work the way you might think it does. Would you mind explaining exactly what that way is?

i want to make a multiplayer mode for my game explore land
link:Snap! Build Your Own Blocks

You may be interested in the concept of multicast, which is something that MQTT can definitely be used for. Here's the gist: with multicast, each connected device broadcasts relevant information about itself to other connected devices (which is very easily achieved with MQTT). I would recommend reading the Wikipedia article for Alto Trek, which was an old multiplayer game that used multicast rather than a client-server model for a game that utilized multicast.

While that would work im pretty sure it would be faster to setup your own server externally that uses a similar system to cloud variables, But if you cant do that then this is a valid approach

watch this project

thanks but all of that is inside of a block in the mqtt librariy

as far as i remember, mqtt is for at the bare minimum sending/recieving messages to/from different snap clients who are "subscribed" to recieve those messages. this can be used for multiplayer games (although the speeds arent great, as far as i remember), and just anything else that involves sending/recieving information to/from another snap client.
heres an example of a multiplayer tic-tac-toe game i made a while back using the mqtt blocks

Multiplayer Tic-Tac-Toe (Warning! Will lag your browser while loading!)

thanks for the info

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.