Once you understand the basics of the SMP system, the matchmaking class can help skip some of the trouble of filling game rooms efficiently. The system comes with a auto join room function that will rank a player’s skill and find the best game room for them.

Ranking Options

Decide on the best ranking for your game. Note only one can be used at a time.

  • Fill rooms without any player ranking. (default)
  • Rank players based on a score in an advanced leaderbaord table.
  • Rank players based on the amount and difficultly of achievements unlocked.

Setup Requirements

Once the Game API and multiplayer classes are initalized, we must then initialize the matchmaking code. This happens in the smp callback. In the below example, a high score table named ‘Farthest Distance’ is used for ranking.

var appid = 'APPID HERE';
window.idAsyncInit = function() {
  ID.Event.subscribe('id.init', function(){
    ID.GameAPI.init(appid, null, function(data, response){
    appId : appid

function startProject(appsession){
  ID.Multiplayer.open(appid, appsession, function(m){
    if(m.section == 'users' && m.action == 'start'){
      if(ID.Multiplayer.msgQue.length == 0){ // only happens on first connection
        ID.Multiplayer.debugLevel = 1;
        ID.Matchmaking.maxPlayers = 2;
        ID.Matchmaking.playerRankTable = 'Farthest Distance';
          // For leaderbaord or achievement ranking user must be logged in.
          // Guests will join any room.


The following is a list of properties available in the matchmaking class:

minPlayers:int = 2;
maxPlayers:int = 10;
joinAnytime:Boolean = true;
playerRankTable:String = '';
highest:Boolean = true;
useAchievements:Boolean = false;

Remember to set the min and max players per a room if they are different from the defaults. Also, choose a ranking option using one of the above properties.

Auto Game Joining

Once the multiplayer class is initialized and matchmaking is ready, make the autoJoinGame function available to the player.