libq2

module
v1.0.298 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0

README

libq2

A Go module (github.com/packetflinger/libq2) implementing the Quake II network protocol, on-disk file formats, and related utilities — a toolkit for building bots, demo tools, master servers, and server-query utilities for id Software's Quake II.

Packages

Package Purpose
message Core of the library — encodes/decodes Q2 network packets (SVC_/CLC_ messages, entity/player-state deltas, connectionless packets)
bot Full UDP client/netchan implementation to connect a bot to a Q2 server (challenge/connect handshake, reliable ack, callbacks per message type)
client Client-side math: view angles, movement, velocity
player Userinfo string marshaling, death/obituary parsing
demo Reads/writes .dm2 demos and MVD (multi-view/GTV) demos
bsp Parses .bsp map files (entities, planes, textures, vertices, PVS/visibility)
pak Reads/writes .pak and .pkz (zip) asset archives
master A Quake II master server (heartbeat protocol) + JSON HTTP API (/GetServers, /HealthCheck, /ServerInfo)
state Server/client state, e.g. Server.FetchInfo() to query a live server, UserCmd
flags Deathmatch flags bitfield parsing
proto Protobuf schemas/generated code (challenge, packet, pak, server messages, etc.) used internally for structured data
types, util Shared helpers (vectors, misc utilities)
testdata Sample .bsp/.pak/.dm2/.mvd2 fixtures for tests

Examples

The examples/ directory contains runnable programs showing usage:

  • bots/simplebot.go — connects a bot to a server
  • demos/decode, demos/mvd, demos/parsedemo — demo file tools
  • master/master.go — run a master server
  • pak/listpakfiles.go — list PAK archive contents
  • serverinfo/info.go — query a server's info string

Usage

go get github.com/packetflinger/libq2

Then import the package(s) you need (e.g. pak, state, bot) in your Go code — the examples/ directory doubles as usage documentation, e.g.:

srv := state.Server{Address: "host", Port: 27910}
info, _ := srv.FetchInfo()

Run tests with:

go test ./...

Directories

Path Synopsis
examples
bots command
demos command
demoprints simply reads a Quake 2 demo file and prints out any print messages found.
demoprints simply reads a Quake 2 demo file and prints out any print messages found.
demos/decode command
decode simply reads a Quake 2 demo file and converts it from binary to a text proto format.
decode simply reads a Quake 2 demo file and converts it from binary to a text proto format.
demos/parsedemo command
master command
An example Quake 2 master server
An example Quake 2 master server
master/client command
pak command
Example program listing all the files in a pak file
Example program listing all the files in a pak file
serverinfo command
A master server keeps track of all public q2 servers.
A master server keeps track of all public q2 servers.
These functions are wrappers for the regular Buffer read/write funcs for use with protobufs.
These functions are wrappers for the regular Buffer read/write funcs for use with protobufs.
These functions relate to figuring out the physical location of a particular player.
These functions relate to figuring out the physical location of a particular player.

Jump to

Keyboard shortcuts

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