Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.

Overview

pitaya Build Status Coverage Status GoDoc Docs Go Report Card MIT licensed

Pitaya is an simple, fast and lightweight game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK. It provides a basic development framework for distributed multiplayer games and server-side applications.

Getting Started

Prerequisites

  • Go >= 1.10
  • etcd (used for service discovery)
  • nats (optional, used for sending and receiving rpc, grpc implementations can be used too if prefered)
  • docker (optional: used for running etcd and nats dependencies on containers)

Installing

clone the repo

git clone https://github.com/topfreegames/pitaya.git

setup pitaya dependencies

make setup

Hacking pitaya

Here's one example of running Pitaya:

Start etcd (This command requires docker-compose and will run an etcd container locally. An etcd may be run without docker if prefered.)

cd ./examples/testing && docker-compose up -d etcd

run the connector frontend server from cluster_grpc example

make run-cluster-grpc-example-connector

run the room backend server from the cluster_grpc example

make run-cluster-grpc-example-room

Now there should be 2 pitaya servers running, a frontend connector and a backend room. To send requests, use a REPL client for pitaya pitaya-cli.

$ pitaya-cli
Pitaya REPL Client
>>> connect localhost:3250
connected!
>>> request room.room.entry
>>> sv-> {"code":0,"result":"ok"}

Running the tests

make test

This command will run both unit and e2e tests.

Contributing

#TODO

Authors

  • TFG Co - Initial work

License

MIT License

Acknowledgements

  • nano authors for building the framework pitaya is based on.
  • pomelo authors for the inspiration on the distributed design and protocol

Security

If you have found a security vulnerability, please email [email protected]

Resources

Issues
  • SendRPCMsg

    SendRPCMsg

    SendRPCMsg err: RPC-000 rpc call internal error - Join: runtime error: invalid memory address or nil pointer dereference remote SendRPCMsg what's wrong context.properties?

    opened by AsukaLay 0
  • oldSession.kick() in unique_session.go causes session.Bind() to fail

    oldSession.kick() in unique_session.go causes session.Bind() to fail

    In Cluster mode, the frontend service reported some bind session error: "close closed session". When session.Bind is executed, unique_session.go will execute oldSession.Kick. If oldSession is closed, it will return that error:"close closed session". So, my question is whether the "session.OnSessionBind" in unique_session.go does not need to return the error when oldSession.Kick, then session.Bind can bind the current uid normally.

    opened by kokais 0
  • some logic optimiztaion

    some logic optimiztaion

    • prometheus reporter startup with panic when we start multiple pitaya services on the same host, it will panic because the port of prometheus reporter monitoring fails. Often occurs in the test environment.

    • err of remote call should be added with routing information Like, msg="error making call to target with id dd953bc8-efbc-4e55-a95a-7ab794a8bcc3 and host xxxx: %!w(*errors.Error=&{PIT-000 xxxxxx map[]})" . I think it is useful to show which handler is called.

    • when serverID is empty, execute remoteCall directly. Avoid executing sd.GetServer() once logic optimiztaion

    opened by chgz 1
  • how to use pitaya-cli test cluster-protobuf-backend-example?

    how to use pitaya-cli test cluster-protobuf-backend-example?

    I see the demo cluster_protobuf, but I don’t known how to use pitaya-cli connect this demo. I move to the pitaya-cli project, I see the infomation:

    pitaya-cli -docs connector.docsHandler.docs
    >>> push connector.playerHandler.matchfound protos.FindMatchPush
    >>> connect localhost:30124
    >>> request connector.playerHandler.create
    >>> request connector.playerHandler.findmatch {"RoomType":"xxxx"}
    

    but this without an demo. sad cry.

    I suggest In the demo cluster_protobuf, you can give us a pitaya-cli test example .

    opened by yilinershi 2
  • How to know which groups a member has joined

    How to know which groups a member has joined

    some methods like pitaya.MemberGroups etc..

    opened by dskyu 2
  • Add ServiceDiscovery tests

    Add ServiceDiscovery tests

    On this commit https://github.com/topfreegames/pitaya/commit/150c31e3f5623a0c90f5db6fd653f2c6e63990ef#diff-58d209d5c5b507c8971bebe6de3c3598ef2337b624f2f9171c314197fcc91b1aR30 we've changed the public Interface ServiceDiscovery and no tests had to be changed. This means that the interface doesn't have tests from the public perspective.

    I guess we can either make this interface private or add corresponding tests here. Also, adding tests for the false case I believe are required since we're not testing that explicitly.

    cc @rsafonseca @felipejfc

    opened by marcosnils 5
  • Re-add static legacy API to allow for easier migration to v2

    Re-add static legacy API to allow for easier migration to v2

    This MR addresses issue #164

    opened by felippeduran 2
Releases(v1.1.8)
Owner
TFG Co
TFG is a leading gaming company for mobile. Check our open positions at https://boards.greenhouse.io/wildlifestudios
TFG Co
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Nan Lin 1.9k Jul 25, 2021
Web-based Cloud Gaming service for Retro Game

CloudRetro provides an open-source cloud gaming platform for retro games. It started as an experiment for testing cloud gaming performance with WebRTC and libretro, and now it aims to deliver the most modern and convenient gaming experience through the technology.

giongto35 1.5k Jul 23, 2021
A small fantasy game engine in WASM using GoLang

The GoLang Fantasy Engine (GoLF Engine) is a retro game engine. It draws inspiration from fantasy console projects like pico-8, tic-80, and pyxle. Like those projects it is designed to be a retro-feeling game creation/playing tool. Unlike those projects GoLF is more minimal in scope and only provides an API and a small set of tools to help you create your games. Tools like an image editor and code editor are not built in. Despite this minimalism creating games in GoLF is still easy and should still maintain the retro game feel.

Brandon Atkinson 75 Jun 7, 2021
This is a "simple" game server. Main functionalities are matching and establishing a connection between players

Game Server This is a "simple" game server. Main functionalities are matching and establishing a connection between players How to Run? run the server

eco 4 Jul 7, 2021
Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.

pitaya Pitaya is an simple, fast and lightweight game server framework with clustering support and client libraries for iOS, Android, Unity and others

TFG Co 1.1k Jul 23, 2021
Snake game implemented in golang

little_pineapple(Snake game implemented in golang) 贪吃蛇golang实现 Snake game implemented in golang 数据结构:链表&数组 Data structures used: linked list&array 使用方

null 7 Aug 17, 2020
Snake game made in Go! 🐍

Snake This is a Terminal based snake game made by tristangoossens. Please star this repository to help my first big project grow! Documentation can be

Tristan Goossens 294 Jul 18, 2021
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

G3N - Go 3D Game Engine Repositories 1.5k Jul 23, 2021
🕹️ A basic gameboy emulator with terminal "Cloud Gaming" support

Gameboy.Live ??️ Gameboy.Live is a Gameboy emulator written in go for learning purposes. You can simply play Gameboy games on your desktop: Or, "Cloud

AaronLiu 4.2k Jul 26, 2021
♛♔ Play chess against UCI engines in your terminal.

uchess ♛♔ Play chess in your terminal. Introduction uchess is an interactive terminal chess client designed to allow gameplay and move analysis in con

Travis Whitton 30 Jul 11, 2021
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.4k Jul 26, 2021
Open source of the build infrastructure used by Stadia Games & Entertainment

SG&E Monorepo This repository contains the open sourcing of the infrastructure developed by Stadia Games & Entertainment (SG&E) to run its operations.

Google 46 Jul 9, 2021
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Joel Auterson 1.2k Jul 18, 2021
SDL2 binding for Go

SDL2 binding for Go go-sdl2 is SDL2 wrapped for Go users. It enables interoperability between Go and the SDL2 library which is written in C. That mean

Ve & Co. 1.6k Jul 26, 2021