Help us shape the future of Go! Take the 2026 Go Developer Survey

gameserver

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*gamepacket.ServerConn
	// contains filtered or unexported fields
}

Conn holds the state for a connection to the server.

func (*Conn) Handle

func (c *Conn) Handle(ctx context.Context) error

Handle runs the main connection loop.

type Options

type Options struct {
	Logger          zerolog.Logger
	TopologyClient  topologypbconnect.TopologyServiceClient
	AccountsService *accounts.Service
	PangyaIFF       *iff.Archive
	ServerID        uint32
	ChannelName     string
	ConfigProvider  gameconfig.Provider
}

Options specify the options used to construct the game server.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server provides an implementation of the PangYa game server.

func New

func New(opts Options) *Server

New creates a new instance of the game server.

func (*Server) Listen

func (s *Server) Listen(ctx context.Context, addr string) error

Listen listens for connections on a given address and blocks indefinitely.

func (*Server) Shutdown

func (s *Server) Shutdown(shutdownCtx context.Context) error

type WeightedRand added in v0.0.3

type WeightedRand struct {
	// contains filtered or unexported fields
}

func NewWeightedRand added in v0.0.3

func NewWeightedRand() *WeightedRand

func (*WeightedRand) Add added in v0.0.3

func (w *WeightedRand) Add(value uint32, weight int64) error

func (*WeightedRand) Choose added in v0.0.3

func (w *WeightedRand) Choose() uint32

Jump to

Keyboard shortcuts

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