Nakama Server Integration for Mobile Game

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Nakama Server Integration for Mobile Game
Medium
~1-2 weeks
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Nakama Backend Integration for Mobile Games

Nakama—open-source game backend from Heroic Labs. Covers most mobile game server infrastructure: accounts, social features, leaderboards, matchmaking, real-time matches, data storage. Alternative to custom Go/Node.js backend for teams wanting quick mobile game launch without writing server code from scratch.

Client Connection

Nakama SDK available for Unity, Godot, Unreal, and as REST/WebSocket API for native mobile (iOS Swift SDK, Android Kotlin SDK).

On Unity:

var client = new Client("http", "127.0.0.1", 7350, "defaultkey");
var socket = Socket.From(client);

// Authentication via device ID
var session = await client.AuthenticateDeviceAsync(
    SystemInfo.deviceUniqueIdentifier,
    username: null,
    create: true
);

await socket.ConnectAsync(session);

Session auto-refreshes via client.SessionRefreshAsync on token expiry. Store refresh token in PlayerPrefs or Keychain/Keystore—not plain SharedPreferences.

Storage and Player Profile

Nakama Storage Engine—document storage with access control:

var writeObject = new WriteStorageObject {
    Collection = "player_data",
    Key = "inventory",
    Value = JsonWriter.ToJson(inventory),
    PermissionRead = 1,  // Only owner reads
    PermissionWrite = 1  // Only owner writes
};
await client.WriteStorageObjectsAsync(session, new[] { writeObject });

Leaderboard with weekly reset—one-liner via Nakama Console or API. Record result: client.WriteLeaderboardRecordAsync(session, "weekly_score", score: 1500). Get top players with pagination: client.ListLeaderboardRecordsAsync.

Real-Time Matches

Nakama supports two match types: relayed (server relays messages between clients, logic on client) and authoritative (server logic in Lua or TypeScript).

Authoritative match—custom TypeScript module:

const matchInit = (ctx: nkruntime.Context, logger: nkruntime.Logger,
    nk: nkruntime.Nakama, params: {[key: string]: string}): {
        state: nkruntime.MatchState, tickRate: number, label: string
    } => {
    return { state: { players: {} }, tickRate: 10, label: "game_room" };
};

const matchLoop = (ctx: nkruntime.Context, logger: nkruntime.Logger,
    nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher,
    tick: number, state: nkruntime.MatchState,
    messages: nkruntime.MatchMessage[]): nkruntime.MatchState | null => {
    // Process incoming messages, update state
    for (const msg of messages) {
        // validate move, update state
    }
    dispatcher.broadcastMessage(1, JSON.stringify(state), null, null);
    return state;
};

tickRate: 10—10 ticks per second. For turn-based, lower to 1-2.

Matchmaking

var ticket = await client.AddMatchmakerAsync(
    session,
    query: "+properties.skill:>1200",
    minCount: 2,
    maxCount: 4,
    stringProperties: new Dictionary<string, string> { ["mode"] = "deathmatch" },
    numericProperties: new Dictionary<string, double> { ["skill"] = 1500 }
);

socket.ReceivedMatchmakerMatched += matched => {
    // Got match, connect
    socket.JoinMatchAsync(matched.MatchId);
};

Nakama matchmaker uses Bleve Search style queries. +properties.skill:>1200—find players with skill > 1200. Can add geographic filtering: +properties.region:eu.

Timeline

Basic Nakama integration (authentication, storage, leaderboard): 3-5 days. Full system with authoritative matches, matchmaking, social features: 2-4 weeks. Cost calculated individually.