Skip to content

Commit

Permalink
Allow ‘cl_demomsglen’ values up to MAX_MSGLEN.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet authored and res2k committed Jan 23, 2024
1 parent 0573d59 commit bb4dd24
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
24 changes: 14 additions & 10 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -1737,16 +1737,20 @@ Stops demo recording and prints some statistics about recorded demo.
Pauses and resumes demo recording.

#### Demo packet sizes
Packet size options limit maximum demo message size and thus define
compatibility level of the recorded demo. Original Quake 2 supports just 1390
bytes (`standard` size), while Q2PRO and R1Q2 support message sizes up to 4086
bytes (`extended` size). When Q2PRO or R1Q2 protocols are in use, demo written
to disk is automatically downgraded to protocol 34. This can result in dropping
of large frames that don't fit into standard protocol 34 limit. Demo packet
size can be extended to overcome this, but the resulting demo will be playable
only by Q2PRO and R1Q2 clients and will be incompatible with other Quake 2
clients or demo editing tools. By default, `standard` packet size is used. This
default can be changed using `cl_demomsglen` cvar.
When Q2PRO or R1Q2 protocols are in use, demo written to disk is automatically
downgraded to protocol 34. This can result in dropping of large frames that
don't fit into standard protocol 34 limit. Demo packet size can be extended to
overcome this, but this may render demo unplayable by other Quake 2 clients
or demo editing tools. See the table below for demo packet sizes supported by
different clients. By default, `standard` packet size (1390 bytes) is used.
This default can be changed using `cl_demomsglen` cvar, or can be overridden
per demo by `record` command options.

| Client | Maximum supported demo packet size |
| ------- | ---------------------------------- |
| Quake 2 | 1390 |
| R1Q2 | 4086 |
| Q2PRO | 32768 |


### Cvar Operations
Expand Down
4 changes: 2 additions & 2 deletions src/client/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "client.h"

static byte demo_buffer[MAX_PACKETLEN];
static byte demo_buffer[MAX_MSGLEN];

static cvar_t *cl_demosnaps;
static cvar_t *cl_demomsglen;
Expand Down Expand Up @@ -327,7 +327,7 @@ static void CL_Record_f(void)
size_t size = Cvar_ClampInteger(
cl_demomsglen,
MIN_PACKETLEN,
MAX_PACKETLEN_WRITABLE);
MAX_MSGLEN);

while ((c = Cmd_ParseOptions(o_record)) != -1) {
switch (c) {
Expand Down

0 comments on commit bb4dd24

Please sign in to comment.