← All experience

Game server on Nakama

Designer and builder of the module · Mindstorm Studios

ProductionClose

A CMS-driven inactivity deduction module on the Nakama game backend. Operators set the timeline in the CMS, and the server warns players, then deducts from their game wallets if they do not come back.

Liveon production
Warns firstplayers get several warnings before any deduction
CMS-drivenoperators set the timeline, no code change

Overview

The system

Inactivity deductions that operators configure in the CMS and Nakama executes, with warnings before any money moves.

Players who have not opened the game for a set period lose some wallet balance, but only after several warnings. I drove the design from a hardcoded four-phase lifecycle to a fully CMS-driven, generic model: the CMS config sets the timeline, the number of steps and where it stops, and is pushed to Nakama, which runs it on its tournament scheduler.

ProductionLive on production.

CMS-driven step modelCrash-safe notificationsAtomic wallet debits

Designed and built by me. The CMS publishing path and the game itself belong to others. Who owned what

My part

My role

I designed and built the module: the generic Id-based step model, the scheduling on Nakama, the eligibility data and the deduction logic.

I owned
  • The step model. From a hardcoded four-phase lifecycle to a CMS-driven, generic Id-based model that tracks the last completed step.
  • Scheduling. A parent schedule on Nakama's tournament scheduler creates one child schedule per step; each child is removed on completion and the next is created.
  • Safe delivery. Notifications go out first, then deductions run, using claim-before-send so a crash cannot double-send.
  • Eligibility data. Eligibility fields live on a user snapshot storage object, with cursor-based pagination over a frozen time.
  • Atomic debits. Wallet deductions are atomic through multi-update, with chunked storage writes for throughput.
Others owned
  • The CMS publishing path that pushes the config to Nakama
  • The Nakama platform and the game client
  • Which players are warned and what is deducted, which operators decide

Architecture

The CMS sets the timeline. Nakama runs it step by step.

Production
CMSNAKAMA GAME SERVERPLAYERSInactivity configtimeline · steps · stop pointPublishing pathpushes config to NakamaParent scheduletournament schedulerone child per stepNotify firstclaim before sendEligibilityuser snapshot storagecursor · frozen nowDeductatomic multi-updatechunked writesWarningsseveral before any deductionWalletsbalance deducted
  • Built or owned by me
  • Built by the wider team
  • Managed or third-party component
Game server on Nakama architecture
CMSNAKAMA GAME SERVERPLAYERSInactivity configtimeline · steps · stop pointPublishing pathpushes config to NakamaParent scheduletournament schedulerone child per stepNotify firstclaim before sendEligibilityuser snapshot storagecursor · frozen nowDeductatomic multi-updatechunked writesWarningsseveral before any deductionWalletsbalance deducted

I built the Nakama module. The CMS and the game belong to others, and Nakama is a managed platform. Simplified topology.

Decisions

Why it is built this way

Four choices that keep deductions correct.

1Decision record

Append and disable only

Context
Players may be mid-timeline when an operator edits it.
Decision
Steps can only be appended or disabled, never rewritten, and the tail is resolved live.
Effect
Edits cannot corrupt a player already partway through.
2Decision record

A generic, Id-based step model

Context
A hardcoded four-phase lifecycle forced code changes for every new timeline.
Decision
Steps are generic and identified by Id, with LastCompletedStepId as the player's position.
Effect
Operators change the timeline in the CMS, with no release.
3Decision record

Claim before send

Context
A crash between sending and recording could warn a player twice.
Decision
Claim the work first, then send.
Effect
A crashed run resumes safely.
4Decision record

Atomic wallet debits with a frozen clock

Context
Deductions must be exact and runs must be repeatable.
Decision
Debit with atomic multi-update and paginate with cursors over a frozen now.
Effect
A run sees one consistent moment and never double-debits.

Skills and evidence

What this project shows

What this module shows, by skill.

  • NakamaHands-on professionalScheduler, storage objects, RPCs and wallet updates for a live game backend.
  • PostgreSQLCore professional stackThe data underneath the platform and the snapshot design.
  • Backend designCore professional stackState modelling, idempotency and crash safety.

Levels are the same ones used in Skills on the home page.

Outcomes

What changed

Operators can run a warn-then-deduct programme without a release.

Liveon production
  • Running on production, driven entirely from CMS config.
  • Deductions only start after players have been warned and have not returned.
The hard parts

Hard problem: pagination under change

Offset pagination while data mutated skipped records. Cursor pagination over a frozen time fixed it.

Hard problem: eligibility queries

I am removing the Bleve-based index for eligibility and replacing it with a simpler query path.

Limitations

Read these before you rely on the numbers

What this page can and cannot back up.

What I can and cannot show
  • Proprietary work, so there is no public repository.
  • The eligibility query path is being reworked.
What I would do next
  • Finish moving eligibility off the search index.