server: always use correct case for map names Previously whatever was typed in as the map/changelevel argument was used even if it didn't match the case of the filename in the pak, which meant QC could see multiple instances of the same map that differed only by case, causing problems for gameplay stats. Now DP will always use the same case as the real .bsp filename for the `mapname` globals, and the sv_world* and cl_world* cvars, and the server status and getinfo/getstatus responses. This matches the behaviour of QC code which retrieved the name from the VFS, such as the `gotomap` and voting code in Nexuiz and Xonotic. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
SVVM: Fix segfault during shutdown, improve previous commit In 30c47b1aff3ac28359c469a40c44ee700c80e814 a bug in SVVM_reset_cmd was revealed because that code never ran before that commit: sometimes the server segfaulted at end of match because SVVM_reset_cmd called QC code even though SVVM_reset_cmd would only be called by PRVM_Prog_Reset after it had freed the tempstring memory... so if QC created a tempstring, crash. This commit refactors the SV VM shutdown to be consistent with the CL and MENU shutdown by moving the QC SV_Shutdown() call into a separate func that (optionally) resets the VM afterwards. As per 30c47b1aff3ac28359c469a40c44ee700c80e814 we MUST reset when stopping a server to avoid crashes later, but we can still skip it when changing map (like in previous versions). Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
SVVM: fully shut down when stopping a server to avoid segfaulting later Fixes segfaults when functions that check if the progs is loaded (to avoid crashing) are called after stopping a server. Example repro: load a map, disconnect, `set sv_cheats 0`. Fixes wrong SV_Shutdown order: SV_DropClient must be done before shutting down SVQC because it calls SVQC functions. Deduplicates SVQC shutdown. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Fix worldmessage string truncation Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
com: rename BSD strlcpy and strlcat The C standard reserves str* and mem* for the implementation. Checking for BSD or OS X is not a robust way to determine if libc provides these (eg glibc may implement them). Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Rename sv_gameplayfix_customstats to sv_qcstats, improve description It's an API change not a gameplay change. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Sys_Sleep overhaul One function to rule them all, and in the darkplaces sleep threads. Makes sub-millisecond accuracy available on Windows. Increases the number of sockets we can monitor on Windows. Improves Curl_Select() a little. Updates flags of some timing-related cvars. Cleans up disorganised and duplicate code. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
build: fix buildstring The revision was always "-", there was code duplication and inconsistency, the meaning of some strings was unclear. Frees up some space in the `status` "version:" line by moving gamenetworkfiltername to "protocol:" which seems like a more relevant section anyway. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Fix occasional NaN sdev in server timing reports Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Rework handling of stuck entities in engine movetypes Avoids most false positives and unnecessary work. Mentions likely code path and cvar deprecations. Fixes nades ending up where they shouldn't, which looked like: Unstuck entity 450 (classname "ogre_grenade") with offset 0.000000 0.000000 28.000000. Allows certain entities to move while stuck in the world (see comments). Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/18 Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Improve server lag detection and reporting On a dedicated server, significant lag is reported to players (so they know it wasn't the network or their machine). Cvar sv_lagreporting_strict logs even slight lag that was "recovered" to console. sv_lagreporting_always enables these for empty servers or singleplayer. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Properly reset server timers and perf stats after level change This prevents the server running "catchup" physics frames immediately after level change (when sv_maxphysicsframesperserverframe > 1) and makes accurate stats available almost immediately (all 0 before that). Moves perf stats from persistent to temporary storage. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Fix flags and naming of cvars needed by the dedicated server The cl_curl* cvars also apply to the dedicated server so not registering them in 3a58ad52e63635c93e95955f984fd6052156e56b broke HTTP. These now have aliases for backwards compat (eg Xonotic, Nexuiz menus). cl_maxphysicsframesperserverframe is server-specific and was also used by the dedicated server for "catch up" if it got behind. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
dedicated server: don't register client-only cvars Fixes random client cvars like r_trippy and cl_netpacketloss_send appearing in the server. Adds a warn (instead of crashing) for if we try to set an unregistered engine cvar somewhere.
Add cvars that disable linking of SOLID_NOT entities: [cl|sv]_areagrid_link_SOLID_NOT This also removes the partial solution added in b1d6f1dfb96bedba50fbe394ca3f0c710f99381b https://gitlab.com/xonotic/darkplaces/-/merge_requests/78 Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Add cvar sv_legacy_bbox_expand for disabling Quake entity bbox expansion This avoids obscure bugs and awkward workarounds especially with CSQC player prediction. Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Use correct droptofloor distance for each Quake map format Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
Minor sv_cullentities refactoring
Improve reliability and documentation of portal camera eyes Not all traces will succeed so we need to add the eye if a trace succeeded within some recent time period, instead of only adding it when a trace succeeded in the current frame. Fixes https://gitlab.com/xonotic/darkplaces/-/issues/207 Fixes https://gitlab.com/xonotic/xonotic-data.pk3dir/-/issues/1596
Merge MR 'Set groundentity when sv_gameplayfix_downtracesupportsongroundflag detects a floor' Fixes movers not carrying players who walk onto them with no z velocity, when sv_gameplayfix_nogravityonground is enabled https://github.com/DarkPlacesEngine/darkplaces/pull/23 branch: bones_was_here/walking_groundentity_fix commits: 7ea07939bef0cbe85c54d9f68cb924198b0b1f64 Signed-off-by: bones_was_here <bones_was_here@xa.org.au>