Nakama: An open-source online multiplayer gaming framework

Nakama: An open-source online multiplayer gaming framework

2022-10-10 0 687
Resource Number 44924 Last Updated 2025-02-24
¥ 0USD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The Nakama recommended in this issue is an open-source online multiplayer gaming framework.

Nakama: An open-source online multiplayer gaming framework插图

Nakama is an open-source online multiplayer game framework consisting of an extensible server framework and various client SDKs that can add powerful features to your game.

Customer concept: Connect to your Nakama server and use Nakama social and competitive features to build your game:

Server Framework: The most advanced game server that can be fully extended using Go, TypeScript/JavaScript, and Lua to create server authoritative game logic and advanced features, and better control permissions, storage engines, and direct database access when needed.

project Properties

  • Users – Register/log in as new users through social networks, email, or device ID.
  • Storage – Store user records, settings, and other objects in a collection.
  • Social – Users can contact friends and join groups. Built in social graph to see how to connect users.
  • Chat – one-on-one, group, and global chatting between users. Keep chat records for messages.
  • Multiplayer – Real time or turn based active and passive multiplayer games.
  • Leaderboards – dynamic, seasonal, gaining top members or members around users. There are as many as possible.
  • Tournaments – Invite players to compete for prizes together. Connect many people together to create a league.
  • Parts – Add team games to the game. Users can form teams and communicate with party members.
  • Runtime code – Use custom logic extension servers written in Lua, TypeScript/JavaScript, or native Go code.

Quick start

Install Nakama using Docker Compose

  • Install to the original environment
  • Easy installation and operation of CockrachDB or PostgreSQL databases for Nakama
  • Take snapshots, delete and reinstall Nakama without affecting your primary operating system
  • No matter what your operating system is, you can enjoy a fast and simplified installation experience

Run Nakama

Firstly, create a directory where your Nakama server is located, such as Desktop/Nakama

Create a docker-compose.yml file in this folder and open it using your favorite text editor.

Heroic Labs provides two YML files for use: using CockroachDB or PostgreSQL as the database.

docker-compose.yml:

version: '3'
services:
  cockroachdb:
    image: cockroachdb/cockroach:latest-v20.2
    command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
    restart: "no"
    volumes:
      - data:/var/lib/cockroach
    expose:
      - "8080"
      - "26257"
    ports:
      - "26257:26257"
      - "8080:8080"
  nakama:
    image: heroiclabs/nakama:3.9.0
    entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
        /nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
        exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100        
    restart: "no"
    links:
      - "cockroachdb:db"
    depends_on:
      - cockroachdb
      - prometheus
    volumes:
      - ./:/nakama/data
    expose:
      - "7349"
      - "7350"
      - "7351"
      - "9100"
    ports:
      - "7349:7349"
      - "7350:7350"
      - "7351:7351"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:7350/"]
      interval: 10s
      timeout: 5s
      retries: 5
  prometheus:
    image: prom/prometheus
    entrypoint: /bin/sh -c
    command: |
      'sh -s <<EOF
        cat > ./prometheus.yml <<EON
      global:
        scrape_interval:     15s
        evaluation_interval: 15s
      scrape_configs:
        - job_name: prometheus
          static_configs:
          - targets: ['localhost:9090']
        - job_name: nakama
          metrics_path: /
          static_configs:
          - targets: ['nakama:9100']
      EON
      prometheus --config.file=./prometheus.yml
      EOF'      
    ports:
      - '9090:9090'
volumes:
  data:

docker-compose-postgres.yml:

version: '3'
services:
  postgres:
    container_name: postgres
    image: postgres:9.6-alpine
    environment:
      - POSTGRES_DB=nakama
      - POSTGRES_PASSWORD=localdb
    volumes:
      - data:/var/lib/postgresql/data
    expose:
      - "8080"
      - "5432"
    ports:
      - "5432:5432"
      - "8080:8080"
  nakama:
    container_name: nakama
    image: heroiclabs/nakama:3.9.0
    entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >
        /nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
        exec /nakama/nakama --name nakama1 --database.address postgres:localdb@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200        
    restart: always
    links:
      - "postgres:db"
    depends_on:
      - postgres
    volumes:
      - ./:/nakama/data
    expose:
      - "7349"
      - "7350"
      - "7351"
    ports:
      - "7349:7349"
      - "7350:7350"
      - "7351:7351"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:7350/"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  data:

Copy and paste the content of the preferred options into the docker-compose.yml file.

Open a terminal window and navigate to your Nakama directory. For example:

cd desktop/nakama

To extract all necessary images and launch your application, run the following command:

docker compose up

Congratulations! Your Nakama server is now up and running, available at 127.0.0.1:7350

Nakama: An open-source online multiplayer gaming framework插图1

Middle console

You can also access the Nakama console by navigating your browser to 127.0.0.1:7351:

Nakama: An open-source online multiplayer gaming framework插图2

configuration file

You can customize many available configuration options for Nakama servers. You can create a YML file for all the configurations you want to set up and pass it to your Docker container.

Firstly, you need to provide a local storage volume for Docker:

1 docker-compose.yml Open your file in your favorite text editor.

Edit Nakama: volumes: entry to specify the desired volume. For example, to create a folder for/data in the directory we use on desktop/nakama, which can be used in Docker containers with nakama/data, it is as follows:

volumes:
– ./ data:/nakama/data

Save the modified file and restart the Docker container for the changes to take effect. From your terminal:

docker compose restart

Next, create your custom configuration file, such as my-config.yml, and place it in the folder you provided for Docker on/data.

my-config.yml:

name: nakama-node-1
data_dir: "./data/"

logger:
    stdout: false
    level: "warn"
    file: "/nakama/data/logfile.log"

console:
    port: 7351
    username: "my_user"
    password: "my_password"

Open your docker-compose.yml file again, and this time edit the nakama: entrypoint entry to add the — config flag pointing to your configuration file. It should be as follows:

nakama:
    entrypoint:
    - "/bin/sh"
    - "-ecx"
    - >
        /nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
        /nakama/nakama --config /nakama/data/my-config.yml  

Save the changed file and restart the Docker container for the changes to take effect. From your terminal:

docker compose restart

Project Preview

Status:

The status page provides a real-time view of the Nakama server, including usage details for each node and a general view of bandwidth and latency, including:

  • Delay: The time, in milliseconds (ms), taken to execute a remote procedure call (RPC) function
  • Rate: RPC count per second
  • Input: Inbound traffic in kilobytes per second (kb/s)
  • Output: Outbound traffic in kilobytes per second (kb/s)

Nakama: An open-source online multiplayer gaming framework插图3

User management:

The user management page allows you to add new console users or delete any existing users. When creating a new user, there are four available roles that allow you to set up a support team that can only access the UI features they need.

Nakama: An open-source online multiplayer gaming framework插图4

Runtime modules:

The runtime module page allows you to easily observe which functions in the project are active and when they were last modified.

Nakama: An open-source online multiplayer gaming framework插图5

Accounts:

The Accounts page displays a list of all user accounts, which can be searched based on user ID and username. From here, you can view, edit, and delete any user.

Nakama: An open-source online multiplayer gaming framework插图6

Leaderboards:

The leaderboard page allows you to view and manage your leaderboards and tournaments, as well as their corresponding records.

Nakama: An open-source online multiplayer gaming framework插图7

—END—

Open source license: Apache-2.0 License

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free source code Nakama: An open-source online multiplayer gaming framework https://ictcoder.com/kyym/nakama-an-open-source-online-multiplayer-gaming-framework.html

Share free open-source source code

Q&A
  • 1, automatic: after taking the photo, click the (download) link to download; 2. Manual: After taking the photo, contact the seller to issue it or contact the official to find the developer to ship.
View details
  • 1, the default transaction cycle of the source code: manual delivery of goods for 1-3 days, and the user payment amount will enter the platform guarantee until the completion of the transaction or 3-7 days can be issued, in case of disputes indefinitely extend the collection amount until the dispute is resolved or refunded!
View details
  • 1. Heptalon will permanently archive the process of trading between the two parties and the snapshots of the traded goods to ensure that the transaction is true, effective and safe! 2, Seven PAWS can not guarantee such as "permanent package update", "permanent technical support" and other similar transactions after the merchant commitment, please identify the buyer; 3, in the source code at the same time there is a website demonstration and picture demonstration, and the site is inconsistent with the diagram, the default according to the diagram as the dispute evaluation basis (except for special statements or agreement); 4, in the absence of "no legitimate basis for refund", the commodity written "once sold, no support for refund" and other similar statements, shall be deemed invalid; 5, before the shooting, the transaction content agreed by the two parties on QQ can also be the basis for dispute judgment (agreement and description of the conflict, the agreement shall prevail); 6, because the chat record can be used as the basis for dispute judgment, so when the two sides contact, only communicate with the other party on the QQ and mobile phone number left on the systemhere, in case the other party does not recognize self-commitment. 7, although the probability of disputes is very small, but be sure to retain such important information as chat records, mobile phone messages, etc., in case of disputes, it is convenient for seven PAWS to intervene in rapid processing.
View details
  • 1. As a third-party intermediary platform, Qichou protects the security of the transaction and the rights and interests of both buyers and sellers according to the transaction contract (commodity description, content agreed before the transaction); 2, non-platform online trading projects, any consequences have nothing to do with mutual site; No matter the seller for any reason to require offline transactions, please contact the management report.
View details

Related Article

make a comment
No comments available at the moment
Official customer service team

To solve your worries - 24 hours online professional service