cgo-game-server

command module
v0.0.0-...-055e899 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 1 Imported by: 0

README

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:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL