MiniQuake2

src/miniquake2/runtime/server_session.ml

Provides miniquake2 runtime server session facilities for this project.

Package
miniquake2.runtime.server_session
Reachable
Yes

Imports

Declarations

areaBits

function areaBits(session, clientEdict)

Return the area bits value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
clientEdictdynamic—clientEdict value consumed by this operation.

View source

changeMapCore

function changeMapCore(session, mapName, entityText, collision)

Performs the changeMapCore operation for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.

View source

changeMapRetail

function changeMapRetail(session, baseDirectory, mapName)

Performs the changeMapRetail operation for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.

View source

clientViewOrigin

function clientViewOrigin(viewer)

SV_BuildClientFrame starts its fat-PVS query at the rendered eye position, not at the player edict origin near the middle of the collision hull. BSP leaves can split vertically between those points (notably at base1's spawn), which otherwise makes muzzle-height projectiles invisible to their owner.

ParameterTypeDefaultDescription
viewerdynamic—viewer value consumed by this operation.

View source

composeClientDatagram

function composeClientDatagram(snapshotPayload, fragments, maximumPayload)

Append the complete transient tail or drop the entire unreliable message. This mirrors SZ_AllowOverflow + SV_SendClientDatagram: an event is never sent without the snapshot entity state it references.

ParameterTypeDefaultDescription
snapshotPayloaddynamic—snapshotPayload value consumed by this operation.
fragmentsdynamic—fragments value consumed by this operation.
maximumPayloaddynamic—maximumPayload value consumed by this operation.

View source

createCore

function createCore(mapName, entityText, collision, bindAddress, port, maxClients, dedicated)

Creates core for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.

View source

createCoreAt

function createCoreAt(mapName, entityText, collision, spawnPoint, bindAddress, port, maxClients, dedicated)

Create core at.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.

View source

createCoreAtSkill

function createCoreAtSkill(mapName, entityText, collision, spawnPoint, bindAddress, port, maxClients, dedicated, skill)

Creates core at skill for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
skilldynamic—skill value consumed by this operation.

View source

createCoreMode

function createCoreMode(mapName, entityText, collision, bindAddress, port, maxClients, dedicated, deathmatch, cooperative)

Create core mode.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.

View source

createCoreModeAt

function createCoreModeAt(mapName, entityText, collision, spawnPoint, bindAddress, port, maxClients, dedicated, deathmatch, cooperative)

Create core mode at.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.

View source

createCoreModeAtSkill

function createCoreModeAtSkill(mapName, entityText, collision, spawnPoint, bindAddress, port, maxClients, dedicated, deathmatch, cooperative, skill)

Create core mode at skill.

ParameterTypeDefaultDescription
mapNamedynamic—mapName value consumed by this operation.
entityTextdynamic—entityText value consumed by this operation.
collisiondynamic—collision value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.
skilldynamic—skill value consumed by this operation.

View source

createRetail

function createRetail(baseDirectory, mapName, bindAddress, port, maxClients, dedicated)

Creates retail for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.

View source

createRetailAt

function createRetailAt(baseDirectory, mapName, spawnPoint, bindAddress, port, maxClients, dedicated)

Create retail at.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.

View source

createRetailAtSkill

function createRetailAtSkill(baseDirectory, mapName, spawnPoint, bindAddress, port, maxClients, dedicated, skill)

Creates retail at skill for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
skilldynamic—skill value consumed by this operation.

View source

createRetailMode

function createRetailMode(baseDirectory, mapName, bindAddress, port, maxClients, dedicated, deathmatch, cooperative)

Create retail mode.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.

View source

createRetailModeAt

function createRetailModeAt(baseDirectory, mapName, spawnPoint, bindAddress, port, maxClients, dedicated, deathmatch, cooperative)

Create retail mode at.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.

View source

createRetailModeAtSkill

function createRetailModeAtSkill(baseDirectory, mapName, spawnPoint, bindAddress, port, maxClients, dedicated, deathmatch, cooperative, skill)

Create retail mode at skill.

ParameterTypeDefaultDescription
baseDirectorydynamic—baseDirectory value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
spawnPointdynamic—spawnPoint value consumed by this operation.
bindAddressdynamic—bindAddress value consumed by this operation.
portdynamic—port value consumed by this operation.
maxClientsdynamic—maxClients value consumed by this operation.
dedicateddynamic—dedicated value consumed by this operation.
deathmatchdynamic—deathmatch value consumed by this operation.
cooperativedynamic—cooperative value consumed by this operation.
skilldynamic—skill value consumed by this operation.

View source

emptyServerMessageRoutes

function emptyServerMessageRoutes(maxClients)

Return immutable empty recipient routes for a server width. Snapshot code only reads these prefixes, so all sessions with the same maxclients value can safely share the once-allocated routing shape.

ParameterTypeDefaultDescription
maxClientsdynamic—maxClients value consumed by this operation.

View source

entityVisible

function entityVisible(session, viewer, edict)

Report whether entity visible.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
viewerdynamic—viewer value consumed by this operation.
edictdynamic—edict value consumed by this operation.

View source

entityVisibleFromLeaf

function entityVisibleFromLeaf(session, viewer, viewLeaf, edict)

Report whether entity visible from leaf.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
viewerdynamic—viewer value consumed by this operation.
viewLeafdynamic—viewLeaf value consumed by this operation.
edictdynamic—edict value consumed by this operation.

View source

entityVisibleFromPreparedPvs

function entityVisibleFromPreparedPvs(session, viewer, viewLeaf, preparedPvs, edict)

Report whether entity visible from prepared pvs.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
viewerdynamic—viewer value consumed by this operation.
viewLeafdynamic—viewLeaf value consumed by this operation.
preparedPvsdynamic—preparedPvs value consumed by this operation.
edictdynamic—edict value consumed by this operation.

View source

fatPvsRow

function fatPvsRow(collisionModel, origin)

Return the fat pvs row value.

ParameterTypeDefaultDescription
collisionModeldynamic—collisionModel value consumed by this operation.
origindynamic—origin value consumed by this operation.

View source

frameFragmentPayloads

function frameFragmentPayloads(fragments)

Return only the encoded bytes from ordered frame fragments.

ParameterTypeDefaultDescription
fragmentsdynamic—fragments value consumed by this operation.

View source

frameMessageFragments

function frameMessageFragments(unicasts, multicasts, sounds, reliable)

Merge one client's typed GameImport queues by their shared emission serial. Reliable and transient buffers remain separate, but neither buffer may reorder sound around multicast/unicast commands emitted before it.

ParameterTypeDefaultDescription
unicastsdynamic—unicasts value consumed by this operation.
multicastsdynamic—multicasts value consumed by this operation.
soundsdynamic—sounds value consumed by this operation.
reliabledynamic—reliable value consumed by this operation.

View source

linkedBoundsVisible

function linkedBoundsVisible(collisionModel, nodeNumber, mins, maxs, row)

Report whether linked bounds visible.

ParameterTypeDefaultDescription
collisionModeldynamic—collisionModel value consumed by this operation.
nodeNumberdynamic—nodeNumber value consumed by this operation.
minsdynamic—mins value consumed by this operation.
maxsdynamic—maxs value consumed by this operation.
rowdynamic—row value consumed by this operation.

View source

mapChangeComponents

function mapChangeComponents(specification)

Split a classic level specification into the BSP map and optional named spawn point. A preceding cinematic/picture segment and the unit marker are server-side metadata; the persistent game session loads the final BSP.

ParameterTypeDefaultDescription
specificationdynamic—specification value consumed by this operation.

View source

miniquake2.runtime.server_session.MapChangeResult struct

multicastReliabilitySubset

function multicastReliabilitySubset(events, reliable)

Return only multicast events whose destination has the requested reliable class. Original Quake II writes reliable messages and transient datagrams to separate client buffers, so one blocked ACK must never retain later effects.

ParameterTypeDefaultDescription
eventsdynamic—events value consumed by this operation.
reliabledynamic—reliable value consumed by this operation.

View source

multicastVisibleToClient

function multicastVisibleToClient(session, event, listener)

Report whether multicast visible to client.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventdynamic—event value consumed by this operation.
listenerdynamic—listener value consumed by this operation.

View source

multicastVisibleToClientFromLeaf

function multicastVisibleToClientFromLeaf(session, event, listenerLeafNumber)

Report whether multicast visible to client from leaf.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventdynamic—event value consumed by this operation.
listenerLeafNumberdynamic—listenerLeafNumber value consumed by this operation.

View source

packetEntities

function packetEntities(gameExport)

Return the packet entities value.

ParameterTypeDefaultDescription
gameExportdynamic—gameExport value consumed by this operation.

View source

packetEntitiesForClient

function packetEntitiesForClient(session, viewer)

Return the packet entities for client value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
viewerdynamic—viewer value consumed by this operation.

View source

protocolEntity

function protocolEntity(state)

Return the protocol entity value.

ParameterTypeDefaultDescription
statedynamic—Mutable state inspected or updated by the operation.

View source

protocolPlayer

function protocolPlayer(edict)

Return the protocol player value.

ParameterTypeDefaultDescription
edictdynamic—edict value consumed by this operation.

View source

queueReliableFrameMessages

function queueReliableFrameMessages(runtime, routedUnicasts, routedMulticasts, routedSounds)

Preflight every recipient before mutating any reliable Netchan queue. A blocked client retains the shared reliable source queues for a later frame.

ParameterTypeDefaultDescription
runtimedynamic—runtime value consumed by this operation.
routedUnicastsdynamic—routedUnicasts value consumed by this operation.
routedMulticastsdynamic—routedMulticasts value consumed by this operation.
routedSoundsdynamic—routedSounds value consumed by this operation.

View source

resetBridgeLevel

function resetBridgeLevel(bridge, mapName, spawnCount, collision)

Reset bridge level.

ParameterTypeDefaultDescription
bridgedynamic—bridge value consumed by this operation.
mapNamedynamic—mapName value consumed by this operation.
spawnCountdynamic—Number of spawn to process.
collisiondynamic—collision value consumed by this operation.

View source

routeMulticasts

function routeMulticasts(session, events)

Return the route multicasts value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventsdynamic—events value consumed by this operation.

View source

routeSounds

function routeSounds(session, events)

Return the route sounds value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventsdynamic—events value consumed by this operation.

View source

routeUnicasts

function routeUnicasts(session, events)

Return the route unicasts value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventsdynamic—events value consumed by this operation.

View source

run

function run(session, frameLimit)

Runs run for the miniquake2 runtime server session workflow.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
frameLimitdynamic—frameLimit value consumed by this operation.

View source

sendSnapshots

function sendSnapshots(session, now, transientRoutes)

Send one stock-shaped snapshot plus accumulated transient datagram per client.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
nowdynamic—now value consumed by this operation.
transientRoutesdynamic—transientRoutes value consumed by this operation.

View source

miniquake2.runtime.server_session.ServerMessageFragment struct

miniquake2.runtime.server_session.ServerSession struct

serverSessionClientPacketEntityScratch

serverSessionClientPacketEntityScratch

Stores module-wide server session client packet entity scratch state for the miniquake2 runtime server session module.

View source

serverSessionEmptyMessageRouteCache

serverSessionEmptyMessageRouteCache

Stores module-wide server session empty message route cache state for the miniquake2 runtime server session module.

View source

serverSessionFatPvsLeafScratch

serverSessionFatPvsLeafScratch

SV_FatPVS uses a fixed 64-leaf work array. The server is single-threaded,

View source

setMapChecksum

function setMapChecksum(session, mapBytes)

Protocol 34 download clients compare the BSP's original COM_BlockChecksum before publishing a downloaded map. Core constructors intentionally accept parsed state only, so retail/bootstrap callers attach the raw bytes here.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
mapBytesdynamic—mapBytes value consumed by this operation.

View source

setPaused

function setPaused(session, value)

Listen-server pause is authoritative: client commands continue to be received and acknowledged, but neither ClientThink nor the Game API world frame advances. Multiplayer always remains live.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
valuedynamic—Value consumed or transformed by the operation.

View source

shutdown

function shutdown(session)

Performs the shutdown operation for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.

View source

soundAudibleToClient

function soundAudibleToClient(session, event, listener)

Return the sound audible to client value.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventdynamic—event value consumed by this operation.
listenerdynamic—listener value consumed by this operation.

View source

soundAudibleToClientFromLeaf

function soundAudibleToClientFromLeaf(session, event, listener, listenerLeafNumber)

Return the sound audible to client from leaf.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventdynamic—event value consumed by this operation.
listenerdynamic—listener value consumed by this operation.
listenerLeafNumberdynamic—listenerLeafNumber value consumed by this operation.

View source

soundEventOrigin

function soundEventOrigin(session, event)

Return the sound event origin.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.
eventdynamic—event value consumed by this operation.

View source

soundReliabilitySubset

function soundReliabilitySubset(events, reliable)

Return only sound events with the requested CHAN_RELIABLE state.

ParameterTypeDefaultDescription
eventsdynamic—events value consumed by this operation.
reliabledynamic—reliable value consumed by this operation.

View source

step

function step(session)

Performs the step operation for the miniquake2 runtime server session module.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.

View source

synchronizeBaselines

function synchronizeBaselines(session)

Synchronize baselines.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.

View source

synchronizeConfigStrings

function synchronizeConfigStrings(session)

Synchronize config strings.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.

View source

synchronizeServerState

function synchronizeServerState(session)

Synchronize server state.

ParameterTypeDefaultDescription
sessiondynamic—session value consumed by this operation.

View source

unicastReliabilitySubset

function unicastReliabilitySubset(events, reliable)

Return only unicast events with the requested reliability class.

ParameterTypeDefaultDescription
eventsdynamic—events value consumed by this operation.
reliabledynamic—reliable value consumed by this operation.

View source

vector

function vector(value)

Return the vector value.

ParameterTypeDefaultDescription
valuedynamic—Value consumed or transformed by the operation.

View source