π₯ FireMatch & FireMatchRoom
π₯ FireMatch & FireMatchRoom AI2 Extensions π₯ FireMatch and FireMatchRoom extensions for real-time 1v1 matchmaking using Firebase Realtime Database. These extensions provide efficient player matching, data exchange, and room management with seamless Firebase integration.
FireMatch (Random 1v1 Matchmaking)
Auto Matchmaking - Automatically finds and matches two players.
Instant Matching System - Uses a queue-based system to prevent duplicate matches.
Real-Time Game Data Exchange - Allows instant data transfer between players.
Optimized Firebase Structure - Ensures smooth performance and minimal data usage.
Simple to Use - No manual room creation required just join and play.
FireMatchRoom (Room-Based 1v1 Matchmaking)
Custom Room System - Host can create a Room ID and invite another player.
Real-Time Game Data Exchange - Enables smooth communication within the room.
Common Features in Both Extensions
Flexible Room Management - Allows controlled entry and exit of players. Players can leave and reset the room
Rejoin Room Support - A player can reconnect using the same Room ID if disconnected.
Persistent Data Handling - Ensures no room conflicts or mismatches.
Firebase-Based Matchmaking β Based on Firebase realtime database.
Efficient Data Handling - Optimized to reduce Firebase bandwidth usage.
Events & Functions for Easy Integration - Simplifies implementation in AI2 projects.
Supports All AI2 Platforms - Compatible with AI2 distros.
π₯ Why to use FireMatch & FireMatchRoom?
Using Firebase for real-time matchmaking can be complex, especially when handling race conditions, duplicate rooms, and player synchronization. FireMatch and FireMatchRoom eliminate these challenges by leveraging Firebase Transactions, ensuring seamless, conflict-free matchmaking.
No Duplicate Rooms or Conflicts
- The extension uses Firebase Transactions to ensure that two players are matched only once, preventing duplicate room creation.
- Avoids race conditions, ensuring multiple players donβt get assigned to the same slot.
Seamless, Auto-Synchronized Matchmaking
- FireMatch automatically pairs two players without the need for complex logic.
- FireMatchRoom ensures manual room-based matchmaking while preventing unwanted interruptions.
No Complex Matchmaking Logic Required
- Creating a custom matchmaking system from scratch can be tricky, requiring manual Firebase structuring, status tracking, and error handling.
- These extensions handle everything for you, so you only need to call simple functions to start matchmaking!
Real-Time Data Exchange
- Both extensions allow instant real-time data sharing between players, ideal for turn-based or interactive multiplayer games.
- Supports sending and receiving data events, ensuring smooth gameplay.
Optimized for Performance
- Efficient Firebase database structuring reduces unnecessary reads/writes.
- Auto-cleanup of inactive rooms ensures no leftover data occupies the database.
Specifications
Size: 30.05 KB
Version: 1.0
Minimum API Level: 7
Updated On: 2025-02-15T18:30:00Z
Help URL: Learn more
Built & documented using: FAST-CLI and Akshat Extension document generator
Multi-Components
FireMatch
Fire Match extension for 1v1 two player random matchmaking using Firebase real-time database.
Events:
FireMatch has total 3 events.
OnMatchFound
Event raised when a match (opponent) is found. Returns room ID and opponent ID.
Parameter | Type |
---|---|
roomID | text |
opponentID | text |
OnRoomDataChanged
Triggered when any data in the room is updated for both players.
Parameter | Type |
---|---|
roomID | text |
myData | text |
myGameData | text |
myStatus | text |
myRole | text |
opponentData | text |
opponentGameData | text |
opponentStatus | text |
opponentRole | text |
rawData | text |
OnError
Triggered when an error occurs.
Parameter | Type |
---|---|
errorMessage | text |
Methods:
FireMatch has total 12 methods.
Initialise
Initializes fire match with firebase URL.
Parameter | Type |
---|---|
firebaseURL | text |
StartMatching
Adds a player to the matchmaking queue. Here player data will be any data that will be exchanged with opponent for eg. name and avatar.
Parameter | Type |
---|---|
playerData | text |
RefreshRoom
Refreshes the room data and triggers OnRoomDataChanged event with available data in the room.
CancelMatching
Cancels matchmaking and removes the player from the queue.
LeaveRoom
Leaves the room by updating the player's status as left and stops getting room data changes.
ClearRoom
Clears the room data and stops getting room data changes.
StoreGameData
Stores game data for the player or opponent in the room.
Parameter | Type |
---|---|
gameData | text |
forOpponent | boolean |
UpdatePlayerStatus
Updates the status for the player or opponent in the room.
Parameter | Type |
---|---|
status | text |
forOpponent | boolean |
RejoinRoom
Rejoin an existing room using the room ID if the player was previously part of it.
Parameter | Type |
---|---|
roomId | text |
ResetRoom
Resets the room for a new fresh match.
GeneratePlayerID
Generates a random player ID either alphanumeric or numeric with specified length (minimum 4).
Parameter | Type |
---|---|
alphanumeric | boolean |
length | number |
IsPlayerInRoom
Checks if the player is already in a room.
Getters:
FireMatch has total 3 getter properties.
GetPlayerID
Gets the current player ID.
- Return type:
text
GetOpponentID
Gets the opponent player ID.
- Return type:
text
GetRoomID
Gets the Room ID.
- Return type:
text
FireMatchRoom
Fire Match Room extension for room-based 1v1 two player matchmaking using Firebase real-time database.
Events:
FireMatchRoom has total 4 events.
OnRoomCreated
Triggered when a room is successfully created. Returns room ID.
Parameter | Type |
---|---|
roomID | text |
OnOpponentJoined
Triggered when an opponent joins the room.
Parameter | Type |
---|---|
roomID | text |
opponentID | text |
OnRoomDataChanged
Triggered when any data in the room changes.
Parameter | Type |
---|---|
roomID | text |
myData | text |
myGameData | text |
myStatus | text |
myRole | text |
opponentData | text |
opponentGameData | text |
opponentStatus | text |
opponentRole | text |
rawData | text |
OnError
Triggered when an error occurs.
Parameter | Type |
---|---|
errorMessage | text |
Methods:
FireMatchRoom has total 12 methods.
Initialise
Initializes fire match room with firebase URL.
Parameter | Type |
---|---|
firebaseURL | text |
CreateRoom
Create a new room as host and receives a Room ID. Invite opponent to join the room with room ID
Parameter | Type |
---|---|
playerData | text |
JoinRoom
Player joins an existing room with given room ID.
Parameter | Type |
---|---|
roomID | text |
playerData | text |
RefreshRoom
Refreshes the room data and triggers OnRoomDataChanged event with available data in the room.
StoreGameData
Stores game data for the player or opponent in the room.
Parameter | Type |
---|---|
gameData | text |
forOpponent | boolean |
UpdatePlayerStatus
Updates the status for the player or opponent in the room.
Parameter | Type |
---|---|
status | text |
forOpponent | boolean |
CancelRoom
Cancels the room only if no opponent has joined yet.
LeaveRoom
Leaves the room by updating the player's status as left and stops getting room data changes.
ClearRoom
Clears the room data and stops getting room data changes.
ResetRoom
Resets the room for a new fresh match.
GeneratePlayerID
Generates a random player ID either alphanumeric or numeric with specified length (minimum 4).
Parameter | Type |
---|---|
alphanumeric | boolean |
length | number |
IsPlayerInRoom
Checks if the player is already in a room.
Getters:
FireMatchRoom has total 3 getter properties.
GetPlayerID
Gets the current player ID.
- Return type:
text
GetOpponentID
Gets the opponent player ID.
- Return type:
text
GetRoomID
Gets the Room ID.
- Return type:
text
Test Quiz App based on FireMatch
Price: 10$
How to buy: PM me