Skip to content

Commit

Permalink
Allow max packet entities to be configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet authored and res2k committed Jan 21, 2024
1 parent 36e6c47 commit da573db
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ Otherwise clients will be unable to connect.
If set to 0, server will skip cinematics even if they exist. Default value
is 1.

#### `sv_max_packet_entities`
Maximum number of entities in client frame. 0 means unlimited. Default
value is 128. Some non-standard maps with large open areas may need this
value increased. Consider however that default Quake 2 client can only
render 128 entities maximum. Other clients may support more.

#### `sv_reserved_slots`
Number of client slots reserved for clients who know `sv_reserved_password`
or `sv_password`. Must be less than `maxclients` value. Default value is 0
Expand Down
2 changes: 1 addition & 1 deletion src/server/entities.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ void SV_BuildClientFrame(client_t *client)

svs.next_entity++;

if (++frame->num_entities == MAX_PACKET_ENTITIES) {
if (++frame->num_entities == sv_max_packet_entities->integer) {
break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ cvar_t *sv_max_rate;
cvar_t *sv_calcpings_method;
cvar_t *sv_changemapcmd;
cvar_t *sv_max_download_size;
cvar_t *sv_max_packet_entities;

cvar_t *sv_strafejump_hack;
cvar_t *sv_waterjump_hack;
Expand Down Expand Up @@ -2212,6 +2213,7 @@ void SV_Init(void)
sv_calcpings_method = Cvar_Get("sv_calcpings_method", "2", 0);
sv_changemapcmd = Cvar_Get("sv_changemapcmd", "", 0);
sv_max_download_size = Cvar_Get("sv_max_download_size", "8388608", 0);
sv_max_packet_entities = Cvar_Get("sv_max_packet_entities", STRINGIFY(MAX_PACKET_ENTITIES), 0);

sv_strafejump_hack = Cvar_Get("sv_strafejump_hack", "1", CVAR_LATCH);
sv_waterjump_hack = Cvar_Get("sv_waterjump_hack", "0", CVAR_LATCH);
Expand Down
1 change: 1 addition & 0 deletions src/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ extern cvar_t *sv_lan_force_rate;
extern cvar_t *sv_calcpings_method;
extern cvar_t *sv_changemapcmd;
extern cvar_t *sv_max_download_size;
extern cvar_t *sv_max_packet_entities;

extern cvar_t *sv_strafejump_hack;
#if USE_PACKETDUP
Expand Down

0 comments on commit da573db

Please sign in to comment.