2922 Commits

Author SHA1 Message Date
Kawe Mazidjatari
d7448be952 Improve CClientState fields 2023-08-27 00:20:35 +02:00
Kawe Mazidjatari
ea2c71242e Map out entity structures more
More types and improvements for base entity classes.
2023-08-27 00:20:23 +02:00
Kawe Mazidjatari
8b45e1a4e5 Also throw asserts 2023-08-26 01:28:30 +02:00
Kawe Mazidjatari
4e1d99bf9d CClientState adjustments
Mapped out and aligned slightly more.
2023-08-26 01:25:07 +02:00
Amos
5ddc9d1884 Write each field individually
Cluster links were written with an additional padding as the struct is 11 in size, so it gets padded to 12. Cluster links now get correctly written to the disk.
2023-08-25 08:47:12 +02:00
Kawe Mazidjatari
52bc73abb0 Fix AIN building bugs
Fixed writing of:
- Path nodes
- Node links
- Path clusters
- Cluster links

The previous globals 'g_pppAiNodeClusters' and 'g_pppAiNodeClusterLinks' were of type CUtlVector. These have been retyped and renamed accordingly.

Also mapped the CAI_Cluster class out slightly more.
Rebuild of path clusters and cluster links are still not correct; parsing a file in from r2, results in a different file on the disk, at the very offset the clusters are being written in (one field is off, this will be investigated soon).
2023-08-24 23:44:57 +02:00
Kawe Mazidjatari
c21747c4c6 CAI_NetworkBuilder::SaveNetworkGraph() improvements
Always create safe path, cache index pointer and make heavy prints non-cert only.
2023-08-24 10:35:54 +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
ee6e1a6cf0 Map CAppSystemGroup out more
Added members:
- CUtlDict<int, unsigned short> m_SystemDict;
- CAppSystemGroup* m_pParentAppSystem;

Added functions:
- FindSystem (untested and unused at the moment!)
2023-08-22 01:07:01 +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
4c7d0325fa Declare and use 'PLATFORM_INTERFACE' instead 2023-08-21 20:40:35 +02:00
Kawe Mazidjatari
a44b38eb15 Add new CMake options
Add options for IsRetail() and IsCert().
2023-08-21 20:40:05 +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
c3bc8345f7 Uncomment
Uncomment, was commented previously due to the lack of the CUtlString class.
2023-08-21 18:52:05 +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
45b10aa0e9 Rename NetDataBlockReceiver method
This is a debug method that is called from 'CClientState::ProcessDataBlock()'.
2023-08-21 16:32:39 +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
905ae5a202 Add netmsg type defines
These 2 are used in CNetChan::ProcessMessages.
2023-08-21 16:28:37 +02:00
Kawe Mazidjatari
d528ec69f1 Add wrapper for reading netmsg types 2023-08-21 16:28:04 +02:00
Kawe Mazidjatari
8c87ad219f Add more bitbuf inlines
Added:
- Tell()
- GetNumBitsLeft()
- GetNumBytesLeft()
2023-08-21 16:14:54 +02:00
Kawe Mazidjatari
0066b82da7 Light cleanup 2023-08-21 11:35:24 +02:00
Kawe Mazidjatari
c344dde672 Add bitbuf getters 2023-08-21 11:28:55 +02:00
Kawe Mazidjatari
650f961fb0 Add float platform macro's 2023-08-21 11:28:04 +02:00
Kawe Mazidjatari
a5d1de8ead Rename local variable 2023-08-20 13:50:59 +02:00
Kawe Mazidjatari
c7c4672b27 Make it a discrete function
Cheaper for runtime.
2023-08-20 13:44:06 +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
6e292359d9 CBaseEntity::m_rgflCoordinateFrame is a matrix3x4_t
Change type and add static assert to prevent mistakes made by accidentally making the struct bigger (which will create many bugs).
2023-08-18 00:44:52 +02:00
Amos
bacfff184c Fix clock correction subtraction bug
Must be converted to actual msecs in floats since 'sv_clockcorrection_msecs' uses msec as base to store the cvar value.
2023-08-18 00:43:44 +02:00
rexx
abf6c33c45 Update global.cpp 2023-08-17 20:26:10 +01:00
rexx
1c179434d3 fix dedi compile
sets pylon language in a cvar change callback instead of accessing directly, as networksystem does not have a DEDICATED define
2023-08-17 20:22:28 +01:00
rexx
356f0ce7c0 send language to MS 2023-08-17 20:02:42 +01:00
Amos
4601c65bc6 Fix bots stuck in air
Make sure we set a frame time and command time.
2023-08-17 02:00:50 +02:00
Amos
5e47e45d83 Take clock drift into account during lag compensation clamp
Client's clock could be behind or ahead of the server's, take this into account. Note that this code has been tested over night and only had a few hits when new baseline snapshots were applied on the server, or when there was a clock drift. It still requires an actual playtest with several players on low and high latency to determine if this is even needed.
2023-08-17 01:59:54 +02:00
Amos
e66680881b Add 'sv_clockcorrection_msecs' cvar to SDK 2023-08-17 01:56:42 +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
c7f1cfbaaa Improve unlag exploit fix
- Check and clamp if commandTime is above serverTime (too far in future).
- Check commandTime delta before checking if above serverTime or below lastCommandTime.
2023-08-15 22:53:42 +02:00
Amos
ebe7a997ac Fixup comments 2023-08-15 20:20:29 +02:00
Amos
75e327e447 Normalize pitch angles
Prob not needed, but other unclamped angles/vectors were able to crash games in the past, so just normalize this too.
2023-08-15 20:19:38 +02:00
Amos
3ff85c174a Finish unlag exploit fix
- Make sure cmdTime is never lower than last.
- Make sure delta doesn't exceed maxUnlag.
- Make sure latency gets clamped to maxUnlag (clamp appears to be missing in the engine).
- Only check for cmdTime if we are not discarding the cmd; previously, already processed queued cmd's got checked before being discarded.
2023-08-15 00:45:58 +02:00
Amos
631e6d9e17 Work in progress unlag exploit fix
Temporary lag compensation exploit fix by clamping the difference. Exploiter could carefully control the detonation time of a grenade, or alter the ability cool downs by altering the 'CUserCmd::command_time' field before sending it up.
2023-08-14 20:47:02 +02:00