Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.
Clone or download
Oneoeigh and felipejfc Revise README.md
Revised several sentences in readme to make it more precise, concise and understandable.
Latest commit cf4f763 Nov 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
acceptor save client's ip version on session (#63) Oct 5, 2018
agent save client's ip version on session (#63) Oct 5, 2018
benchmark update generated protos and proto example Jul 27, 2018
client better log Oct 24, 2018
cluster Add hostname to server type (#62) Oct 3, 2018
component Feature/docs (#30) Jul 23, 2018
config Feature/custom metrics (#67) Nov 6, 2018
constants reliable RPC (#61) Oct 5, 2018
context Remove all gob related code. Jun 4, 2018
defaultpipelines Fix validator when argument is nil (#52) Sep 5, 2018
deploy/kubernetes add example deploy with kubernetes Apr 23, 2018
docgenerator Add descriptors (#60) Sep 26, 2018
docs Feature/custom metrics (#67) Nov 6, 2018
e2e e2e tests are working with grpc server/client πŸ’ͺ🏼 Jun 27, 2018
errors Do not overwrite pitaya error (#28) Jul 17, 2018
examples Feature/custom metrics (#67) Nov 6, 2018
helpers e2e tests are working with grpc server/client πŸ’ͺ🏼 Jun 27, 2018
interfaces post-refactor tests Jun 27, 2018
internal refactor messages encoder Jun 18, 2018
logger Major bug fixes and refactor πŸ’₯ Apr 19, 2018
metrics Feature/custom metrics (#67) Nov 6, 2018
mocks Add new field GetName on serializer interface (#27) Jul 17, 2018
modules refactor modules, create base Aug 1, 2018
pipeline Pipeline now receives the decoded arguments insted of raw data (#41) Aug 16, 2018
pitaya-protos @ 6af95f1 Update submodule (#57) Sep 17, 2018
protos update protos Oct 19, 2018
remote refactor protos Jun 27, 2018
route Handler service tests. Apr 20, 2018
router Additional Tags and routingFunc (#55) Sep 13, 2018
serialize Add new field GetName on serializer interface (#27) Jul 17, 2018
service log handshake error Nov 12, 2018
session Fix nats subscription leak (#48) Aug 24, 2018
timer Major bug fixes and refactor πŸ’₯ Apr 19, 2018
tracing fix jaeger tracing Jul 18, 2018
util Add default logger to context on both handlers and remotes (#44) Aug 20, 2018
worker redis password on worker Nov 2, 2018
.gitignore [WIP] GRPC mode Jun 27, 2018
.gitmodules more protos refactor Jun 27, 2018
.travis.yml more protos refactor Jun 27, 2018
Gopkg.lock Updating uuid dependency version Nov 13, 2018
Gopkg.toml Updating uuid dependency version Nov 13, 2018
LICENSE update license Mar 20, 2018
Makefile Feature/custom metrics (#67) Nov 6, 2018
README.md Revise README.md Nov 14, 2018
app.go Feature/custom metrics (#67) Nov 6, 2018
app_test.go reliable RPC (#61) Oct 5, 2018
component.go Some typos Apr 19, 2018
component_test.go Unit tests for pitaya package Apr 10, 2018
group.go Initial docs Jul 17, 2018
group_test.go Unit tests for pitaya package Apr 10, 2018
kick.go reliable RPC (#61) Oct 5, 2018
kick_test.go Push and kick fix ( Closes #51 ) (#56) Sep 17, 2018
module.go ordered modules (#39) Aug 14, 2018
module_test.go ordered modules (#39) Aug 14, 2018
pipeline.go Fix pipeline. Mar 20, 2018
pipeline_test.go Pipeline now receives the decoded arguments insted of raw data (#41) Aug 16, 2018
push.go Push and kick fix ( Closes #51 ) (#56) Sep 17, 2018
push_test.go Push and kick fix ( Closes #51 ) (#56) Sep 17, 2018
rpc.go reliable RPC (#61) Oct 5, 2018
rpc_test.go Feature/docs (#30) Jul 23, 2018
timer.go Unit tests for pitaya package Apr 10, 2018
timer_test.go Unit tests for pitaya package Apr 10, 2018

README.md

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

Resources

Benchmarks

using grpc

===============RUNNING BENCHMARK TESTS WITH GRPC===============
--- starting testing servers
--- sleeping for 5 seconds
goos: darwin
goarch: amd64
BenchmarkCreateManyClients-30                                              	    2000	    732922 ns/op
BenchmarkFrontHandlerWithSessionAndRawReturnsRaw-30                        	    2000	    712525 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtr-30                        	    2000	    704867 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtrManyClientsParallel-30     	    2000	    647892 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtrParallel-30                	    2000	    692803 ns/op
BenchmarkFrontHandlerWithSessionOnlyReturnsPtr-30                          	    2000	    880599 ns/op
BenchmarkFrontHandlerWithSessionOnlyReturnsPtrParallel-30                  	    2000	    630234 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtr-30                           	    1000	   1123467 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtrParallel-30                   	    2000	    667119 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtrParallelMultipleClients-30    	    2000	    664865 ns/op

using nats

===============RUNNING BENCHMARK TESTS WITH NATS===============
--- starting testing servers
--- sleeping for 5 seconds
goos: darwin
goarch: amd64
BenchmarkCreateManyClients-30                                              	    2000	    873214 ns/op
BenchmarkFrontHandlerWithSessionAndRawReturnsRaw-30                        	    2000	    702125 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtr-30                        	    2000	    794028 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtrManyClientsParallel-30     	    2000	    769600 ns/op
BenchmarkFrontHandlerWithSessionAndPtrReturnsPtrParallel-30                	    2000	    702894 ns/op
BenchmarkFrontHandlerWithSessionOnlyReturnsPtr-30                          	    2000	    984978 ns/op
BenchmarkFrontHandlerWithSessionOnlyReturnsPtrParallel-30                  	    2000	    699000 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtr-30                           	    1000	   1945727 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtrParallel-30                   	    2000	    784496 ns/op
BenchmarkBackHandlerWithSessionOnlyReturnsPtrParallelMultipleClients-30    	    2000	    846923 ns/op