Standard vs Endless Rooms
Moitribe RTM offers two distinct room types, each optimized for different multiplayer game patterns. Understanding the differences will help you choose the right architecture for your game.
Standard Rooms
Standard rooms are designed for structured multiplayer sessions with a fixed number of players.
Key Characteristics
- Fixed Player Count: Predetermined number of participants (typically 2-4)
- Session-Based: Clear start and end points for gameplay
- Auto-Matching: Automatic player matching with min/max requirements
- Structured Gameplay: Ideal for turn-based or round-based games
When to Use Standard Rooms
✅ Perfect for:
- Card games (poker, UNO, hearts)
- Board games (chess, checkers, backgammon)
- Fighting games (1v1 or small team battles)
- Puzzle games (competitive or cooperative)
- Quiz games
- Strategy games with fixed player counts
Standard Room Features
interface RTMStandardParams {
// Player matching
min_automatch_players?: number; // Minimum players for auto-match
max_automatch_players?: number; // Maximum players for auto-match
// Room configuration
variant?: number; // Game mode variant
exclusive_bitmask?: string; // 8-bit role assignment
// Invitation system
invitedPlayerIDs?: string[]; // Specific players to invite
}
Standard Room Lifecycle
- Room Creation: Host creates room with fixed player count
- Auto-Matching: System finds matching players
- Session Start: All players connected, game begins
- Gameplay: Fixed number of players throughout
- Session End: Game completes, room closes
Example: Chess Game
// Create a 2-player chess room
MoitribeSDK('chess-game', 'createstandardroom', {
maxplayers: 2,
isprivate: false,
roomname: 'Chess Match',
variant: 1 // Classic chess variant
}, {
min_automatch_players: 2,
max_automatch_players: 2,
onRoomConnected: (status, room) => {
// Both players connected, start the game
initializeChessGame(room.participants);
},
onPeerLeft: (room, participantList) => {
// Player left, end the game
endGame('Player disconnected');
}
});
Endless Rooms
Endless rooms support dynamic player counts with drop-in/drop-out gameplay.
Key Characteristics
- Dynamic Player Count: Players can join and leave anytime
- Persistent World: Game continues regardless of player changes
- Drop-in/Drop-out: No session boundaries
- Scalable: Supports large numbers of concurrent players
When to Use Endless Rooms
✅ Perfect for:
- MMO-style games (massive multiplayer online)
- Battle royale games
- Persistent world games
- Social hubs and lobbies
- Cooperative survival games
- Real-time strategy with dynamic teams
Endless Room Features
interface RTMEndlessParams {
// Player management
max_players?: number; // Maximum room capacity
max_automatch_players?: number; // Max players from auto-match
// Room configuration
variant?: number; // Game mode variant
exclusive_bitmask?: string; // 8-bit role assignment
// Flexible invitation
invitedPlayerIDs?: string[]; // Players to invite
}
Endless Room Lifecycle
- Room Creation: Host creates persistent room
- Continuous Joining: Players join and leave dynamically
- Ongoing Gameplay: Game state persists through player changes
- World Persistence: Room remains active indefinitely
- Managed Closure: Host explicitly closes room
Example: Battle Royale Lobby
// Create a 100-player battle royale room
MoitribeSDK('battle-royale', 'createendlessroom', {
maxplayers: 100,
isprivate: false,
roomname: 'Battle Arena',
variant: 1, // Solo mode
customdata: JSON.stringify({
map: 'island',
gamemode: 'solo'
})
}, {
max_players: 100,
max_automatch_players: 100,
onPeerJoined: (room, participantList) => {
// Update player count
updatePlayerCount(participantList.length);
// Start game when enough players
if (participantList.length >= 20) {
startCountdown();
}
},
onPeerLeft: (room, participantList) => {
updatePlayerCount(participantList.length);
// Handle player elimination
if (participantList.length === 1) {
declareWinner(participantList[0]);
}
}
});
Comparison Table
| Feature | Standard Rooms | Endless Rooms |
|---|---|---|
| Player Count | Fixed (2-4 typical) | Dynamic (1-100+) |
| Session Type | Session-based | Persistent |
| Join/Leave | Only at session start | Anytime |
| Auto-Matching | Min/max requirements | Max capacity only |
| Game Structure | Structured rounds | Continuous gameplay |
| Use Cases | Card games, chess | MMO, battle royale |
| Complexity | Simpler implementation | More complex state management |
| Resource Usage | Lower per room | Higher per room |
Technical Differences
Message Handling
Both room types use the same messaging system, but handle participant changes differently:
// Standard room - stable participant list
onMessageReceived: (messageData, senderID, isReliable) => {
// Sender ID is always valid (players don't change mid-game)
processGameMove(senderID, messageData);
}
// Endless room - dynamic participant list
onMessageReceived: (messageData, senderID, isReliable) => {
// Need to verify sender is still in room
if (isPlayerActive(senderID)) {
processGameUpdate(senderID, messageData);
}
}
State Management
Standard Rooms:
- Game state tied to fixed player set
- Simpler synchronization
- Predictable resource usage
Endless Rooms:
- Must handle player join/leave events
- Complex state synchronization
- Dynamic resource allocation
Performance Considerations
Standard Rooms
- Lower Memory: Fixed participant arrays
- Predictable Network: Known message patterns
- Simpler Logic: Less event handling overhead
Endless Rooms
- Higher Memory: Dynamic participant management
- Variable Network: Fluctuating message rates
- Complex Logic: Join/leave event handling
Migration Between Types
While you can't directly convert a room type, you can design your game to support both:
// Unified game interface
class MultiplayerGame {
constructor(roomType) {
this.roomType = roomType; // 'standard' or 'endless'
}
createRoom(config) {
const method = this.roomType === 'standard'
? 'createstandardroom'
: 'createendlessroom';
MoitribeSDK('my-game', method, config, this.getCallbacks());
}
getCallbacks() {
const baseCallbacks = {
onMessageReceived: this.handleMessage.bind(this),
onRoomConnected: this.handleRoomConnected.bind(this)
};
if (this.roomType === 'endless') {
return {
...baseCallbacks,
onPeerJoined: this.handlePlayerJoined.bind(this),
onPeerLeft: this.handlePlayerLeft.bind(this)
};
}
return baseCallbacks;
}
}
Choosing the Right Type
Decision Flow
-
Does your game have fixed rounds?
- Yes → Standard Rooms
- No → Continue
-
Do players need to join mid-game?
- Yes → Endless Rooms
- No → Standard Rooms
-
Is the player count always the same?
- Yes → Standard Rooms
- No → Endless Rooms
-
Do you need persistent world state?
- Yes → Endless Rooms
- No → Standard Rooms
Hybrid Approaches
Some games benefit from both types:
- Lobby System: Endless room for matchmaking → Standard rooms for matches
- Tournament: Endless room for tournament hub → Standard rooms for individual games
- Progressive Games: Endless room for overworld → Standard rooms for dungeons/arenas
Next Steps
- Standard Rooms Overview - Deep dive into fixed player count rooms
- Endless Rooms Overview - Learn about dynamic player count rooms
- Room Creation - Create your first standard room
- Endless Room Creation - Create your first endless room
Start with Standard Rooms for simpler games and migrate to Endless Rooms as your multiplayer requirements grow. The SDK provides consistent APIs across both room types.