Game server on Nakama
Designer and builder of the module · Mindstorm Studios
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.
Overview
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.
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
I designed and built the module: the generic Id-based step model, the scheduling on Nakama, the eligibility data and the deduction logic.
- 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.
- 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.
I built the Nakama module. The CMS and the game belong to others, and Nakama is a managed platform. Simplified topology.
Decisions
Four choices that keep deductions correct.
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.
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.
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.
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 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
Operators can run a warn-then-deduct programme without a release.
- Running on production, driven entirely from CMS config.
- Deductions only start after players have been warned and have not returned.
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
What this page can and cannot back up.
- Proprietary work, so there is no public repository.
- The eligibility query path is being reworked.
- Finish moving eligibility off the search index.