protocol Module

Source code: protocol.py

Bad Class

class vgio.quake.protocol.Bad

Class for representing a Bad message

This is an error message and should not appear.

Bad.__init__()
static Bad.read(file)
static Bad.write(file, bad=None)

Nop Class

class vgio.quake.protocol.Nop

Class for representing a Nop message

Nop.__init__()
static Nop.read(file)
static Nop.write(file, nop=None)

Disconnect Class

class vgio.quake.protocol.Disconnect

Class for representing a Disconnect message

Disconnect from the server and end the game. Typically this the last message of a demo.

Disconnect.__init__()
static Disconnect.read(file)
static Disconnect.write(file, disconnect=None)

UpdateStat Class

class vgio.quake.protocol.UpdateStat

Class for representing UpdateStat messages

Updates a player state value.

index

The index to update in the player state array.

value

The new value to set.

UpdateStat.__init__()
static UpdateStat.read(file)
static UpdateStat.write(file, update_stat)

Version Class

class vgio.quake.protocol.Version

Class for representing Version messages

protocol_version

Protocol version of the server. Quake uses 15.

Version.__init__()
static Version.read(file)
static Version.write(file, version)

SetView Class

class vgio.quake.protocol.SetView

Class for representing SetView messages

Sets the camera position to the given entity.

entity

The entity number

SetView.__init__()
static SetView.read(file)
static SetView.write(file, set_view)

Sound Class

class vgio.quake.protocol.Sound

Class for representing Sound messages

Plays a sound on a channel at a position.

entity

The entity that caused the sound.

bit_mask

A bit field indicating what data is sent.

volume

Optional. The sound volume or None.

attenuation

Optional. The sound attenuation or None.

channel

The sound channel, maximum of eight.

sound_number

The number of the sound in the sound table.

origin

The position of the sound.

Sound.__init__()
static Sound.read(file)
static Sound.write(file, sound)

Time Class

class vgio.quake.protocol.Time

Class for representing Time messages

A time stamp that should appear in each block of messages.

time

The amount of elapsed time(in seconds) since the start of the game.

Time.__init__()
static Time.read(file)
static Time.write(file, time)

StuffText Class

class vgio.quake.protocol.StuffText

Class for representing StuffText messages

Text sent to the client console and ran.

text

The text to send to the client console.

Note: This string is terminated with the newline character.

StuffText.__init__()
static StuffText.read(file)
static StuffText.write(file, stuff_text)

SetAngle Class

class vgio.quake.protocol.SetAngle

Class for representing SetAngle messages

Sets the camera’s orientation.

angles

The new angles for the camera.

SetAngle.__init__()
static SetAngle.read(file)
static SetAngle.write(file, set_angle)

ServerInfo Class

class vgio.quake.protocol.ServerInfo

Class for representing ServerInfo messages

Handles the loading of assets. Usually first message sent after a level change.

protocol_version

Protocol version of the server. Quake uses 15.

max_clients

Number of clients.

multi

Multiplayer flag. Set to 0 for single-player and 1 for multiplayer.

map_name

The name of the level.

models

The model table as as sequence of strings.

sounds

The sound table as a sequence of strings.

ServerInfo.__init__()
static ServerInfo.read(file)
static ServerInfo.write(file, server_data)

LightStyle Class

class vgio.quake.protocol.LightStyle

Class for representing a LightStyle message

Defines the style of a light. Usually happens shortly after level change.

style

The light style number.

string

A string of arbitrary length representing the brightness of the light. The brightness is mapped to the characters ‘a’ to ‘z’, with ‘a’ being black and ‘z’ being pure white.

Example

# Flickering light light_style_message = LightStyle() light_style.style = 0 light_style.string = ‘aaazaazaaaaaz’

LightStyle.__init__()
static LightStyle.read(file)
static LightStyle.write(file, light_style)

UpdateName Class

class vgio.quake.protocol.UpdateName

Class for representing UpdateName messages

Sets the player’s name.

player

The player number to update.

name

The new name as a string.

UpdateName.__init__()
static UpdateName.read(file)
static UpdateName.write(file, update_name)

UpdateFrags Class

class vgio.quake.protocol.UpdateFrags

Class for representing UpdateFrags messages

Sets the player’s frag count.

player

The player to update.

frags

The new frag count.

UpdateFrags.__init__()
static UpdateFrags.read(file)
static UpdateFrags.write(file, update_frags)

ClientData Class

class vgio.quake.protocol.ClientData

Class for representing ClientData messages

Server information about this client.

bit_mask

A bit field indicating what data is sent.

view_height

Optional. The view offset from the origin along the z-axis.

ideal_pitch

Optional. The calculated angle for looking up/down slopes.

punch_angle

Optional. A triple representing camera shake.

velocity

Optional. Player velocity.

item_bit_mask

A bit field for player inventory.

on_ground

Flag indicating if player is on the ground.

in_water

Flag indicating if player is in a water volume.

weapon_frame

Optional. The animation frame of the weapon.

armor

Optional. The current armor value.

weapon

Optional. The model number in the model table.

health

The current health value.

active_ammo

The amount count for the active weapon.

ammo

The current ammo counts as a quadruple.

active_weapon

The actively held weapon.

ClientData.__init__()
static ClientData.read(file)
static ClientData.write(file, client_data)

StopSound Class

class vgio.quake.protocol.StopSound

Class for representing StopSound messages

Stops a playing sound.

channel

The channel on which the sound is playing.

entity

The entity that caused the sound.

StopSound.__init__()
static StopSound.read(file)
static StopSound.write(file, stop_sound)

UpdateColors Class

class vgio.quake.protocol.UpdateColors

Class for representing UpdateColors messages

Sets the player’s colors.

player

The player to update.

colors

The combined shirt/pant color.

UpdateColors.__init__()
static UpdateColors.read(file)
static UpdateColors.write(file, update_colors)

Particle Class

class vgio.quake.protocol.Particle

Class for representing Particle messages

Creates particle effects

origin

The origin position of the particles.

direction

The velocity of the particles represented as a triple.

count

The number of particles.

color

The color index of the particle.

Particle.__init__()
static Particle.read(file)
static Particle.write(file, particle)

Damage Class

class vgio.quake.protocol.Damage

Class for representing Damage messages

Damage information

armor

The damage amount to be deducted from player armor.

blood

The damage amount to be deducted from player health.

origin

The position of the entity that inflicted the damage.

Damage.__init__()
static Damage.read(file)
static Damage.write(file, damage)

SpawnStatic Class

class vgio.quake.protocol.SpawnStatic

Class for representing SpawnStatic messages

Creates a static entity

model_index

The model number in the model table.

frame

The frame number of the model.

color_map

The color map used to display the model.

skin

The skin number of the model.

origin

The position of the entity.

angles

The orientation of the entity.

SpawnStatic.__init__()
static SpawnStatic.read(file)
static SpawnStatic.write(file, spawn_static)

SpawnBinary Class

class vgio.quake.protocol.SpawnBinary

Class for representing SpawnBinary messages

This is a deprecated message.

SpawnBinary.__init__()
static SpawnBinary.read(file)
static SpawnBinary.write(file)

SpawnBaseline Class

class vgio.quake.protocol.SpawnBaseline

Class for representing SpawnBaseline messages

Creates a dynamic entity

entity

The number of the entity.

model_index

The number of the model in the model table.

frame

The frame number of the model.

color_map

The color map used to display the model.

skin

The skin number of the model.

origin

The position of the entity.

angles

The orientation of the entity.

SpawnBaseline.__init__()
static SpawnBaseline.read(file)
static SpawnBaseline.write(file, spawn_baseline)

TempEntity Class

class vgio.quake.protocol.TempEntity

Class for representing TempEntity messages

Creates a temporary entity. The attributes of the message depend on the type of entity being created.

type

The type of the temporary entity.

TempEntity.__init__()
static TempEntity.read(file)
static TempEntity.write(file, temp_entity)

SetPause Class

class vgio.quake.protocol.SetPause

Class for representing SetPause messages

Sets the pause state

paused

The pause state. 1 for paused, 0 otherwise.

SetPause.__init__()
static SetPause.read(file)
static SetPause.write(file, set_pause)

SignOnNum Class

class vgio.quake.protocol.SignOnNum

Class for representing SignOnNum messages

This message represents the client state.

sign_on

The client state.

SignOnNum.__init__()
static SignOnNum.read(file)
static SignOnNum.write(file, sign_on_num)

CenterPrint Class

class vgio.quake.protocol.CenterPrint

Class for representing CenterPrint messages

Prints text in the center of the screen.

text

The text to be shown.

CenterPrint.__init__()
static CenterPrint.read(file)
static CenterPrint.write(file, center_print)

KilledMonster Class

class vgio.quake.protocol.KilledMonster

Class for representing KilledMonster messages

Indicates the death of a monster.

KilledMonster.__init__()
static KilledMonster.read(file)
static KilledMonster.write(file, killed_monster=None)

FoundSecret Class

class vgio.quake.protocol.FoundSecret

Class for representing FoundSecret messages

Indicates a secret has been found.

FoundSecret.__init__()
static FoundSecret.read(file)
static FoundSecret.write(file, found_secret=None)

SpawnStaticSound Class

class vgio.quake.protocol.SpawnStaticSound

Class for representing SpawnStaticSound messages

Creates a static sound

origin

The position of the sound.

sound_number

The sound number in the sound table.

volume

The sound volume.

attenuation

The sound attenuation.

SpawnStaticSound.__init__()
static SpawnStaticSound.read(file)
static SpawnStaticSound.write(file, spawn_static_sound)

Intermission Class

class vgio.quake.protocol.Intermission

Class for representing Intermission messages

Displays the level end screen.

Intermission.__init__()
static Intermission.read(file)
static Intermission.write(file, intermission=None)

Finale Class

class vgio.quake.protocol.Finale

Class for representing Finale messages

Displays the episode end screen.

text

The text to show.

Finale.__init__()
static Finale.read(file)
static Finale.write(file, finale)

CdTrack Class

class vgio.quake.protocol.CdTrack

Class for representing CdTrack messages

Selects the cd track

from_track

The start track.

to_track

The end track.

CdTrack.__init__()
static CdTrack.read(file)
static CdTrack.write(file, cd_track)

SellScreen Class

class vgio.quake.protocol.SellScreen

Class for representing SellScreen messages

Displays the help and sell screen.

SellScreen.__init__()
static SellScreen.read(file)
static SellScreen.write(file, sell_screen=None)

CutScene Class

class vgio.quake.protocol.CutScene

Class for representing CutScene messages

Displays end screen and text.

text

The text to be shown.

CutScene.__init__()
static CutScene.read(file)
static CutScene.write(file, cut_scene)

UpdateEntity Class

class vgio.quake.protocol.UpdateEntity

Class for representing UpdateEntity messages

Updates an entity.

bit_mask

A bit field indicating what data is sent.

entity

The number of the entity.

model_index

The number of the model in the model table.

frame

The frame number of the model.

color_map

The color map used to display the model.

skin

The skin number of the model.

effects

A bit field indicating special effects.

origin

The position of the entity.

angles

The orientation of the entity.

UpdateEntity.__init__()
static UpdateEntity.read(file)
static UpdateEntity.write(file, update_entity)

MessageBlock Class

class vgio.quake.protocol.MessageBlock

Class for representing a message block

view_angles

The client view angles.

messages

A sequence of messages.

MessageBlock.__init__()
static MessageBlock.read(file)
static MessageBlock.write(file, message_block)