All Projects → lonng → Nano

lonng / Nano

Licence: mit
Lightweight, facility, high performance golang based game server framework

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Nano

Cellnet
High performance, simple, extensible golang open source network library
Stars: ✭ 3,714 (+96.72%)
Mutual labels:  protobuf, game, server, networking, tcp-server
Simplenet
An easy-to-use, event-driven, asynchronous network application framework compiled with Java 11.
Stars: ✭ 164 (-91.31%)
Mutual labels:  server, networking, tcp-server
Zero
A Lightweight Socket Service with heartbeat, Can be easily used in TCP server development.
Stars: ✭ 161 (-91.47%)
Mutual labels:  game, server, tcp-server
Facil.io
Your high performance web application C framework
Stars: ✭ 1,393 (-26.22%)
Mutual labels:  json, networking, websocket-server
Micro
Micro is a distributed cloud operating system
Stars: ✭ 10,778 (+470.87%)
Mutual labels:  micro, server, distributed-systems
rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 617 (-67.32%)
Mutual labels:  lightweight, websocket-server, tcp-server
Deta cache
缓存cache服务器
Stars: ✭ 106 (-94.39%)
Mutual labels:  json, server, tcp-server
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (-71.82%)
Mutual labels:  json, protobuf, micro
Beast
HTTP and WebSocket built on Boost.Asio in C++11
Stars: ✭ 3,241 (+71.66%)
Mutual labels:  server, networking, websocket-server
Summer
这是一个支持分布式和集群的java游戏服务器框架,可用于开发棋牌、回合制等游戏。基于netty实现高性能通讯,支持tcp、http、websocket等协议。支持消息加解密、攻击拦截、黑白名单机制。封装了redis缓存、mysql数据库的连接与使用。轻量级,便于上手。
Stars: ✭ 336 (-82.2%)
Mutual labels:  protobuf, game, server
Rockgo
A developing game server framework,based on Entity Component System(ECS).
Stars: ✭ 532 (-71.82%)
Mutual labels:  lightweight, websocket-server, tcp-server
Librg
🚀 Making multi-player gamedev simpler since 2017
Stars: ✭ 813 (-56.94%)
Mutual labels:  game, lightweight, networking
Entitas Sync Framework
Networking framework for Entitas ECS. Targeted at turnbased games or other slow-paced genres.
Stars: ✭ 98 (-94.81%)
Mutual labels:  game, networking
Azerothcore Wotlk
Complete Open Source and Modular solution for MMO
Stars: ✭ 1,330 (-29.56%)
Mutual labels:  game, server
Proxy
C++ TCP Proxy Server
Stars: ✭ 98 (-94.81%)
Mutual labels:  server, networking
Tabtoy
高性能表格数据导出器
Stars: ✭ 1,302 (-31.04%)
Mutual labels:  json, game
Openrct2
An open source re-implementation of RollerCoaster Tycoon 2 🎢
Stars: ✭ 10,115 (+435.75%)
Mutual labels:  game, server
Simpletcp
Simple wrapper for TCP client and server in C# with SSL support
Stars: ✭ 99 (-94.76%)
Mutual labels:  server, tcp-server
Travian Kingdom
Travian Kingdom server script free. Not finish yet. Abandoned.
Stars: ✭ 74 (-96.08%)
Mutual labels:  game, server
Gossip Python
Implementation of the gossip protocol
Stars: ✭ 100 (-94.7%)
Mutual labels:  networking, distributed-systems

Nano Build Status GoDoc Go Report Card MIT licensed

Nano is an easy to use, fast, lightweight game server networking library for Go. It provides a core network architecture and a series of tools and libraries that can help developers eliminate boring duplicate work for common underlying logic. The goal of nano is to improve development efficiency by eliminating the need to spend time on repetitious network related programming.

Nano was designed for server-side applications like real-time games, social games, mobile games, etc of all sizes.

How to build a system with Nano

What does a Nano application look like?

The simplest "nano" application as shown in the following figure, you can make powerful applications by combining different components.

Application

In fact, the nano application is a collection of  Component , and a component is a bundle of  Handler, once you register a component to nano, nano will register all methods that can be converted to Handler to nano service container. Service was accessed by Component.Handler, and the handler will be called while client request. The handler will receive two parameters while handling a message:

  • *session.Session: corresponding a client that apply this request or notify.
  • *protocol.FooBar: the payload of the request.

While you had processed your logic, you can response or push message to the client by session.Response(payload) and session.Push('eventName', payload), or returns error when some unexpected data received.

How to build distributed system with Nano

Nano contains built-in distributed system solution, and make you creating a distributed game server easily.

See: The distributed chat demo

The Nano will remain simple, but you can perform any operations in the component and get the desired goals. You can startup a group of Nano application as agent to dispatch message to backend servers.

How to execute the asynchronous task

func (manager *PlayerManager) Login(s *session.Session, msg *ReqPlayerLogin) error {
    var onDBResult = func(player *Player) {
        manager.players = append(manager.players, player)
        s.Push("PlayerSystem.LoginSuccess", &ResPlayerLogin)
    }
    
    // run slow task in new gorontine
    go func() {
        player, err := db.QueryPlayer(msg.PlayerId) // ignore error in demo
        // handle result in main logical gorontine
        nano.Invoke(func(){ onDBResult(player) })
    }
    return nil
}

Documents

Resources

Community

Successful cases

Go version

> go1.8

Installation

go get github.com/lonng/nano

# dependencies
go get -u github.com/pingcap/check
go get -u github.com/pingcap/errors
go get -u github.com/urfave/cli

go get -u google.golang.org/protobuf/proto
go get -u github.com/gorilla/websocket
go get -u google.golang.org/grpc

Protocol Buffers

# protoc
# download form: https://github.com/protocolbuffers/protobuf/releases
# protoc-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# delve
go install github.com/go-delve/delve/cmd/dlv@latest

Test

go test -v ./...

Benchmark

# Case:   PingPong
# OS:     Windows 10
# Device: i5-6500 3.2GHz 4 Core/1000-Concurrent   => IOPS 11W(Average)
# Other:  ...

cd ./benchmark/io
go test -v -tags "benchmark"

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].