Skip to content

Commit 3f26505

Browse files
add options to control rollback and fps on standalone
Adds multi.cfg options to allow easy tweaking of standalone servers to better handle mods with faster ships and/or weapons that don't behave reliably with rollback or lower fps.
1 parent 7d1983e commit 3f26505

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

code/network/multi_options.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,19 @@ void multi_options_read_config()
318318
Multi_options_g.webapiPort = (ushort) result;
319319
}
320320
}
321+
} else
322+
// set framerate for standalone
323+
if ( SETTING("+fps_cap") ) {
324+
NEXT_TOKEN();
325+
if (tok != nullptr) {
326+
if ((atoi(tok) >= 15) && (atoi(tok) <= 120)) {
327+
Multi_options_g.std_framecap = atoi(tok);
328+
}
329+
}
330+
} else
331+
// disable rollback for primary/dumbfire weapons
332+
if ( SETTING("+rollback_disabled") ) {
333+
Multi_options_g.std_rollback = false;
321334
}
322335
}
323336

code/network/multi_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ typedef struct multi_global_options {
5050
char std_passwd[STD_PASSWD_LEN+1]; // standalone host password
5151
char std_pname[STD_NAME_LEN+1]; // permanent name for the standalone - if any
5252
int std_framecap; // standalone frame cap
53+
bool std_rollback; // use rollback for primary/dumbfire shots
5354

5455
ushort webapiPort;
5556
SCP_string webapiUsername;
@@ -79,6 +80,7 @@ typedef struct multi_global_options {
7980
memset(std_passwd, 0, STD_PASSWD_LEN+1);
8081
memset(std_pname, 0, STD_NAME_LEN+1);
8182
std_framecap = 30;
83+
std_rollback = true;
8284

8385
webapiPort = 8080;
8486
webapiUsername = "admin";

code/network/multimsgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7931,7 +7931,7 @@ void process_non_homing_fired_packet(ubyte* data, header* hinfo)
79317931

79327932
object* objp_ref = multi_get_network_object(target_ref);
79337933

7934-
if (objp_ref == nullptr || objp_ref->type != OBJ_SHIP) {
7934+
if ((Is_standalone && !Multi_options_g.std_rollback) || !objp_ref || (objp_ref->type != OBJ_SHIP)) {
79357935
// new way failed, use the old new way.
79367936

79377937
if (objp_ref != nullptr){

0 commit comments

Comments
 (0)