654 Commits

Author SHA1 Message Date
Kawe Mazidjatari
66daec04db Fix compile errors in non cert builds 2023-09-16 13:10:12 +02:00
Kawe Mazidjatari
c9637196b8 Improve CEngineAPI signatures 2023-09-16 13:09:22 +02:00
Kawe Mazidjatari
5bab1bc6af Move CClient pointer adjuster to separate function
All process methods have a shifted CClient pointer, so this will be used more often.
2023-09-16 12:18:32 +02:00
Amos
95cd34eb23 Replace hardcoded sleep threshold constant
Replaced with a cvar.
2023-09-14 09:17:03 +02:00
Kawe Mazidjatari
eaa5347fa3 Only run NVIDIA Reflex if the display driver vendor is NVIDIA
This is to ensure we don't cause any performance hits when running the game on an AMD or Intel GPU.
2023-09-13 22:24:59 +02:00
Kawe Mazidjatari
907e582f55 Remove latency markers
Some parts of the engine have to be rebuild in order to implement this correctly, therefore, it has been removed for now to avoid potential performance problems.

fps_max_rt and fps_max_gfx have been limited to 295 to avoid a contest with the engine's hard limit causing huge performance hits.
2023-09-13 17:37:09 +02:00
Kawe Mazidjatari
4927654da0 Bugfix: only run NVIDIA Reflex if we ran an actual engine frame
CEngine::Frame() tends to return out early if we are ahead of frame time, and therefore need to sleep. In this particular engine, CEngine::Frame() returns true if it had actually executed an engine frame, else it returns false.

Therefore, we end up calling 'NvAPI_D3D_Sleep()' multiple times a frame, and thus causing a major loss in performance. Now we check if we have actually ran a frame (incrementing reflex frame if so). If the frame was not incremented, but 'GFX_RunLowLatencyFrame()' was called, it will not call 'NvAPI_D3D_Sleep()'.

Code has been tested and appears to work on my system (never called twice or more per frame). Needs more testing on other systems to make sure its good.
2023-09-12 20:50:38 +02:00
Kawe Mazidjatari
384ad649bf Update CEngineAPI::PumpMessages() signature
Function has been modified internally.
2023-09-12 17:44:58 +02:00
Kawe Mazidjatari
51a3f4a1c4 Only call 'NvAPI_D3D_SetSleepMode(...)' on pending changes
No need to keep calling this if there are no pending changes.
2023-09-12 17:44:24 +02:00
Kawe Mazidjatari
b87d7bf1c3 More improvements to the comment
Make a bit more sense.
2023-09-12 17:13:12 +02:00
Kawe Mazidjatari
bf29365e04 Fix typo
Should be tick as its possible to run more frames per simulation tick.
2023-09-12 17:09:19 +02:00
Kawe Mazidjatari
bcf7d03d90 Properly place PC_LATENCY_PING marker
Call once we peeked a message.
2023-09-12 13:20:13 +02:00
Kawe Mazidjatari
ea6c15df4c Initial implementation of NVIDIA Reflex Low Latency timing
Propagated latency markers in an attempt to further reduce input latency. Code is pending rigorous testing on several systems, including systems powered by an AMD GPU to make sure we are not impacting performance on systems that does NOT support NVIDIA Reflex.
2023-09-12 11:06:16 +02:00
Kawe Mazidjatari
9df90d4a25 Add cvar for low latency timing (work in progress)
Work in progress NVIDIA Low Latency timing implementation.
2023-09-12 00:19:47 +02:00
Kawe Mazidjatari
804f96625b Move NVIDIA Reflex implementation to library function
Improve code, there will be more NVIDIA GeForce related stuff soon.
2023-09-12 00:08:46 +02:00
Kawe Mazidjatari
85de096f98 Take into account television refresh rates
TV's tend to output @59.939999 FPS, set out frame limiter's to that if FPS happens to be 59 or 60.
2023-09-11 22:48:28 +02:00
Kawe Mazidjatari
07dade5d5d Implement high precision frame limiter
Limits frames at a much higher level of precision than 'fps_max' and 'fps_max_gfx', probably ideal to reduce input latency even more. Also changed the logic of the NVIDIA Reflex frame limiter, to which it would use the desktop's refresh rate if set to '-1'. The new render thread frame limiter has a similar behavior. Using desktop refresh rates on the render thread or NVIDIA Reflex frame limiter requires 'fps_max' to be set to 0 (unlimited), as it would otherwise result in a major performance drop due to a contest if fps_max_(gfx/rt) is set to a similar number as fps_max.
2023-09-11 22:20:24 +02:00
Kawe Mazidjatari
fdb4a4d429 Reverse CGame class
Class structure reversed.
2023-09-11 20:38:18 +02:00
Kawe Mazidjatari
0fe7b40506 Add inline DX device getters 2023-09-11 01:28:17 +02:00
Kawe Mazidjatari
bf01287129 Add cvar for NVAPI frame limiter
Might be useful for someone.
2023-09-10 01:44:04 +02:00
Kawe Mazidjatari
21093ca1a1 Implement NVIDIA Reflex Low Latency technology 2023-09-09 15:12:58 +02:00
Kawe Mazidjatari
bc59f1349d Use CUtlVector for map list 2023-09-05 17:34:22 +02:00
Kawe Mazidjatari
cb1a69e82a Ban system refactor
Use CUtlVector, and remove every copy caused by passing vectors by value. CUtlVector does not support copying. Also removed all extraneous std::string copies caused by calling itoa instead of std::to_string, or std::stoll, etc. All features have been tested and work as designed.
2023-08-31 00:16:25 +02:00
Kawe Mazidjatari
db6ccff8c2 Calculate processing time for each message 2023-08-28 02:45:37 +02:00
Kawe Mazidjatari
d7448be952 Improve CClientState fields 2023-08-27 00:20:35 +02:00
Kawe Mazidjatari
4e1d99bf9d CClientState adjustments
Mapped out and aligned slightly more.
2023-08-26 01:25:07 +02:00
Kawe Mazidjatari
03ee817ca1 More of CNetChan mapped out 2023-08-23 00:15:26 +02:00
Amos
ee3e2b8f2a Use CUtlString 2023-08-22 19:32:21 +02:00
Kawe Mazidjatari
e8bffae822 Fix compiler error
Small rename.
2023-08-22 01:12:22 +02:00
Kawe Mazidjatari
befd38bf51 Interface factory system rewrite
Removed all extraneous copies by adding the class 'InterfaceReg' which will construct a new interface, and link it to the engine's static register. The Source Engine macro 'EXPOSE_INTERFACE_FN' will help utilizing this. The game module from the plugin is not obtained through the process environment block, so the executable is no longer sensitive to names.
2023-08-22 01:11:49 +02:00
Kawe Mazidjatari
20cc4b1439 Rename CClientState field
Renamed to 'm_bUseLocalSendTableFile'. If set, the 'CClientState::ProcessSendTable()' method drops the SVC_SendTable message, and keeps using the local file instead.
2023-08-21 20:43:36 +02:00
Kawe Mazidjatari
c8752420a0 Use new Dev* logger functions
These get compiled in if IsCert() returns false.
2023-08-21 20:38:07 +02:00
Kawe Mazidjatari
71b0781715 Utilize 'DevMsg()' for uncertain builds only
Only uncertain builds will contain DevMsg()/DevWarning() prints. For retail, Msg() and Warning() should be used instead.
2023-08-21 19:12:29 +02:00
Kawe Mazidjatari
545ccac064 Improve CClient class
Added:
 - m_nDisconnectTick
 - m_nSendtableCRC
- m_nMmDev

Fixed incorrect placement for:
- m_LastMovementTick
2023-08-21 16:33:45 +02:00
Kawe Mazidjatari
de55d84795 Rebuild CNetChan::ProcessMessages()
Full rebuild for future 'proper' rate limit implementation.
2023-08-21 16:29:28 +02:00
Kawe Mazidjatari
d528ec69f1 Add wrapper for reading netmsg types 2023-08-21 16:28:04 +02:00
Kawe Mazidjatari
a5d1de8ead Rename local variable 2023-08-20 13:50:59 +02:00
Amos
320ff7fb0f Assert equal or above 0
Code bug because cannot go below.
2023-08-18 22:21:36 +02:00
Amos
fe1cc93cff CNetChan::FlowNewPacket(): Add a comment and also check the other loop
Added 2 comments that speaks for them self's, and 2 additional checks for the second loop as I had triggered several cases where it would loop indefinitely still, as we break out of the parallel loop and continue into the old school loop for the remainder of the outSeqNr - currentIndex frames. This should fix all problems related to this function. After numerous of tests with varying arbitrary outSeqNr values that were vastly larger than the current packet flow index, the bug was no longer triggered. A similar test had also be performed were multiple clients would do this at the same time, and even then; the server frame time(s) remained identical and the whole thing never hung.
2023-08-18 21:24:35 +02:00
Amos
26da5fd503 Increment by 4, since loop does 4 frames at a time
Compensate for compiler optimizations performed on CNetChan::FlowNewPacket().
2023-08-18 15:03:56 +02:00
Amos
2caccf6c91 Fix bug in CNetChan::FlowNewPacket()
Loop runs for 'CNetChan::m_nOutSequenceNr' frames, with no bounds. A corrupt or invalid packet will hang the engine for several seconds.
2023-08-18 13:06:00 +02:00
Amos
4f2a9601b4 Rebuild CNetChan::FlowNewPacket()
Rebuild for a future bug fix.
2023-08-18 12:47:16 +02:00
Amos
174f9b46f3 Fully map out net frame and flow structures
Mapped out 'netframe_header_s', 'netframe_s', and 'netflow_s' entirely.
2023-08-18 02:33:41 +02:00
Amos
3c36b606f0 Add function for checking if there's still pending data in reliable waiting buffers 2023-08-16 00:15:01 +02:00
Amos
2ff35a94cd Add inline for getting server time 2023-08-16 00:06:03 +02:00
Amos
00f7415380 Fixup CClient types 2023-08-14 00:30:20 +02:00
Amos
2768b925b0 Make assert better
Check if not below zero.
2023-08-13 20:26:52 +02:00
Kawe Mazidjatari
30031e3275 Don't allow stringcmd's if client isn't active
Potential exploit vector, executing stringcmd's during signon states where it shouldn't be used.
2023-08-08 19:25:12 +02:00
Kawe Mazidjatari
9a9d6b290a Fix typo 2023-08-08 19:05:12 +02:00
Kawe Mazidjatari
849372d68e Show server CPU, frame time and current tick as well 2023-08-08 12:55:17 +02:00