Hello, and welcome back to my newest guide. It’s been a while, but today I’ll teach you how to make a simple matchmaking system.
Wait, wait, wait, before you start, what even IS a matchmaking system?
I was just about to explain-
Yeah, right. Bet you were going to continue as if everyone knew that.
Anyways, in online games, when you start a game, the system goes through all the players in the world to pair you with them for battles. This system will do something like that. The idea for this is that with your friends, battles could be hosted anytime within the game, and when a player declares a battle, other players ready to play can jo!n.
Calling For a Battle
To start, make an overlay and change it to a button.
What’s the button for?
What do you think?
Uh…to click?
Bravo! You’re so smart! Anyways, name the overlay Start Battle. In the ‘when button clicked, transmit on’ section, write waitForOthers. We’ll get back to that later. Wire the overlay to a relay. Button clicked → Trigger Relay. Set the relay audience to either All Players or All Other players. This is to send a message to the other players asking for a person to jo!n. Wire the relay to a notification device. Relay Trigger → Run Wire Pulse Block. In the Notification wire block, put this code in.
This is the code to send to the other players asking them to jo!n.
Accepting the Battle
Make another overlay, this time name it Jo!n Game? Have it hidden at the start of the game.
Merry Christmas!
If it Is Christmas
Oh yes! Merry Christmas, and to everyone else!
And Valentines Day!
Uh…what? You do know that it’s in February?
It is? I thought it was in October.
That is even more confusing! Why would you say it in December then?
Uh…for fun? Cya!
If it Is Not Christmas
What? It Isn’t Christmas yet
Oh, then… Happy Thanksgiving?
That’s over.
Oh, then… bye!
Well, that was weird. Anyways, for the overlay, wire the relay to it. Relay Trigger → Show Overlay. Now, when the button is clicked, have it transmitted on jo!ned. And also hide the overlay on the broadcast jo!ned.
Figuring it Out
Now, we need the game to recognize when a player accepts the battle. Make a property called enemyFound? Make it a number property. Also have a counter. Have it increment on jo!ned, and have it update the enemyFound? property. For the property, in the ‘When Property Value Changes, Transmit On’ type in start game. Get a teleporter and have it teleport the player there when receiving on that channel. Now, remember that waitForOthers broadcast? That’s for the host, make another teleporter that will do the same thing as the first one, except it receives from the broadcast waitForOthers.
Now, you can be creative in this, make barriers that deactivate when the enemy jo!ns so that the host doesn’t get a head start. You can also make a button that teleports the players out. Whatever your heart desires.
Hope you enjoyed this. This was a really simple guide. And I’m not really thinking of making it more complicated. If you want to make it 2v2 or something like that, I would say use this as a blueprint or inspiration to help you.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11?
Uh…what about St. Patrick’s?
No!