Giter VIP home page Giter VIP logo

cgo-game-server's Introduction

cgo-game-server

This is a demo project showcasing a high-performance TCP/UDP game server built with Go and cgo. It includes a server, simulator, and stress testing tool for development and evaluation. It also provides a RESTful service that exposes two RPC methods to view the server status and metrics.

Quick Start

Clone the Repository

git clone --recurse-submodules https://github.com/wanliqun/cgo-game-server.git

This downloads the required submodule ( C++ Random Name Generator ) automatically.

Build the C++ Library (cgo)

Requirements:

  • automake
  • clang++
make cgo

This generates a .so dynamic link library used by cgo.

Run the Application:

Install Go (v1.21+) and edit the configuration file (config/config.yml) for customization, then run:

go run main.go --help

This displays usage instructions and available commands.

  • Start Server (TCP, UDP, RESTful):
go run main.go server
  • Start Simulator (client for debugging):
go run main.go simulator
  • Stress Testing:

Establish Mass Connections and Measure TPS:

go run main.go loadrunner -w 100 -r 100 -d 1h

-w: Number of concurrent workers (go-routines) -r: Robots (clients) allocated per worker -d: Duration of the test

Metrics

cgo-game-server starts a RESTful service which provides two RPC methods to view the server status and metrics. eg., You can open the following URL in a web browser to check the server running statistics if you are running as predefined configurations:

Acknowledgement

The following projects are referenced:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.