The easiest way to get started with building a Cardinal game shard is via the starter-game-template (opens in a new tab). To get the template, run the following command in your preferred development directory:
git clone https://github.com/Argus-Labs/starter-game-template
The starter game template has 2 directories, but you will only need to worry about the cardinal directory.
- cardinal (opens in a new tab): code for your game server.
- testsuite (opens in a new tab): e2e tests for the whole stack.
Cardinal is where the game logic lives. We recommend the following directory structure to organize your code:
component: component definitions
system: system functions implementations
query: query implementations for your game state (used by external clients)
tx: transaction definitions
The starter game template comes with some existing code in these directories, so you can get a feel for how things should be organized and implemented.
Nakama is where the relayer and account abstraction layer lives. We expect most people to use our version of Nakama, which comes with a few benefits:
- Automatically set up RPC endpoints for game clients to hook into the Cardinal game world
- Handle account abstraction and persona tags (similar to gamer-tags)
- Allows for account authentication using a third party account such as Google, Facebook, or Steam
- Allows for non-chain interactions with backend Cardinal systems for easy testing and development
The starter-game-template contains a Docker Compose (opens in a new tab) configuration that can run several cardinal related services locally.
- cardinal: The aforementioned cardinal based game server
- nakama: A pre-build Nakama image that can communicate with the game server
- postgres: The storage layer that Nakama depends on
- redis: The storage layer that Cardinal depends on
- testsuite: Some sample integration tests that verify Nakama and Cardinal are communicating correctly