doom

package
v0.0.0-...-d4a0ffb Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: GPL-2.0 Imports: 4 Imported by: 0

README

This is an (in-development) Network implementation that will aim to speed up Doom network games by including extra data in packets and doing faster retransmits.

Documentation

Index

Constants

View Source
const (
	NcmdExit       = 0x80000000
	NcmdRetransmit = 0x40000000
	NcmdSetup      = 0x20000000
	NcmdKill       = 0x10000000
	NcmdChecksum   = 0x0fffffff
)

Variables

View Source
var (
	ErrShortPacket = errors.New("packet too short")
)

Functions

func ExpandTicNum

func ExpandTicNum(low byte, base uint32) uint32

ExpandTicNum takes the low byte of a tic number and "expands" it back to a 32-bit value, using the base parameter as a reference.

func GamePacketChecksum

func GamePacketChecksum(data []byte) uint32

GamePacketChecksum calculates the checksum for a marshaled GamePacket; it should be called with the first four bytes stripped.

Types

type GamePacket

type GamePacket struct {
	Checksum       uint32
	RetransmitFrom byte
	StartTic       byte
	Player         byte
	NumTics        byte
	Commands       []byte
}

GamePacket contains a decoded form of the data found in Doom's network protocol messages. This layer is used in all Doom games and is not specific to just IPX games.

func (*GamePacket) MarshalBinary

func (p *GamePacket) MarshalBinary() ([]byte, error)

func (*GamePacket) UnmarshalBinary

func (p *GamePacket) UnmarshalBinary(data []byte) error

func (*GamePacket) UpdateChecksum

func (p *GamePacket) UpdateChecksum()

UpdateChecksum updates the Checksum field of the given GamePacket. The high bits that store additional information (setup, retransmit, etc.) are left untouched.

type IPXPacket

type IPXPacket struct {
	Sequence, Tail uint32
	Payload        Payload
}

IPXPacket contains a decoded form of the wrapper format used for Doom IPX packets.

func (*IPXPacket) MarshalBinary

func (p *IPXPacket) MarshalBinary() ([]byte, error)

func (*IPXPacket) UnmarshalBinary

func (p *IPXPacket) UnmarshalBinary(data []byte) error

type Payload

type Payload interface {
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

type SetupPacket

type SetupPacket struct {
	GameID      uint16
	Drone       uint16
	NodesFound  uint16
	NodesWanted uint16
	Extra       []byte
}

SetupPacket contains a decoded form of the data found in Doom IPX setup packets. These are messages generated and interpreted by the ipxsetup.exe network driver.

func (*SetupPacket) MarshalBinary

func (p *SetupPacket) MarshalBinary() ([]byte, error)

func (*SetupPacket) UnmarshalBinary

func (p *SetupPacket) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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