The engine assigns channel ID's to paks, which it then uses to determine whether to error out or warn when a certain pak file failed to load.
Paks loaded with a higher channel ID, such as the load screens or gladiator cards, won't call Error() in the engine if the loading thereof failed, where paks with a lower channel ID, such as common.rpak will.
Paks with a higher channel ID are quite verbose in the console, as the game often switches between gladiator card rpaks from scripts to update the banners in the world dynamically. User can now explicitly set the channel ID, with the default being 4 which only logs core engine and sdk paks, along with preloaded and level paks.
The async file read system uses a similar concept, this was confirmed when reversing Pak_SetupBuffersAndLoad as this calls FS_OpenAsyncFile for its patch files with the log channel that was assigned during Pak_LoadAsync. This code already had logging, but has been adjusted to follow the design of the system. Async file reads however are disabled by default as these are very verbose and will degrade performance of the game.
Instead of manually calling each surface instance directly from CImguiSystem::SampleFrame(), allow the caller to install their own surfaces. Also, only lock the buffer mutex if we are going to take a snapshot of the draw data. The system now also only renders to the backend if there's draw data to be rendered. Slightly reworked and reordered the control flow of the system to make it easier to catch bugs. The system can now also be disabled using the -noimgui command line option.
The implementation currently only servers as reference, but if we ever have to replace the engine's implementation with the SDK's one, it should now be fully compatible and working.
Must be inherited through CTier1AppSystem to match the game's interface. Removed extraneous IAppSystem virtual method declarations as they are no longer needed to pad the vftable out.
In this engine, GetTier() doesn't exist, GetDependencies() however does exist (confirmed by the vftable for CInputStackSystem) and therefore we should adjust all interfaces to make it use this instead.
The method in the engine now takes a pointer to a context and pops it if its found in the stack by index. Adjusted SDK rebuild to reflect this change. The rest of the input stack system remained unchanged.
SourceSDK doesn't contain this feature, but it has to be implemented for reworking CInputStackSystem::PopInputContext() as this has changed; the method allows for popping the provided index to element rather than following a strict push/pop order.
Save even more performance by not calling the ImguiSystem message handler at all when the imgui surface isn't active; we don't need to track input movement at all when this isn't active. Also dropped the blockage of all window messages except 'WM_SETCURSOR', added a detailed comment as to why this is blocked.
ImGui_ImplWin32_WndProcHandler will return out early anyways if Dear Imgui itself isn't initialized, there is therefore no need to lock any mutex here when the system isn't initialized. Return out early.
There were reports of high input latency even though we implemented NVIDIA Reflex and AMD Anti-Lag 2.
The reason for this increased latency was because CThreadFastMutex was being used in the window procedure instead of a CThread mutex.
The contention for CImguiSystem::m_systemInitState in CImguiSystem::MessageHandler() is high, and therefore we should not use CThreadFastMutex as its only effective in its fastness when the contention isn't high. Using CThreadMutex instead resulted in an extreme reduction of input latency.
Dedicated server or Client only builds will warn to the console if something is trying to set a convar, or execute a concommand that doesn't exist. Dedicated server builds don't have client commands/convars, and visa versa.
Some specific paks are loaded through code (common.rpak, ui.rpak. etc). We have implemented a system that also loads 2 common rpaks that are of our own (common_sdk.rpak and ui_sdk.rpak).
There is al additional syustem we had implemented earlier that allows you to mount rpaks during level load, which will get loaded before the actual level rpak, this is useful as when we port a map that has evolved slightly from its original one, only needing 20 new models, it makes more sense to load the original rpak + a new one that contains the 20 new models to save disk space.
This is also useful for mounting paks specific to mods for a certain map, however since we have some core mods (flowstate) we have to add it to the settings for for each level. These paks also get dropped and reloaded each time on level changes causing longer load times and more memory usage during level loads.
This system mounts paks after all common paks are loaded (from both the engine and sdk), and keeps them active just like the common paks throughout level changes until they are either manually unloaded, or the game has been closed.
When CURLParams::failOnError is set, it makes code stop instantly when the request has errored somewhere (400 or higher response codes), but this prevents code from displaying the error reason attached to the failed request.
Setting this to false by default fixes the problem; if this option needs to be used it should be set explicitly.
In release we should only check if the handle is NULL for performance reasons (the release engine executable never sets DC_INVALID_HANDLE on invalid handles. In debug we also check on DC_INVALID_HANDLE as this is easier to cache in memory.
TITAN and GOLIATH had a small typo in their microluts, causing the lookup to be incorrect. Decimal 30 has bit 1 2 3 and 4 set, TITAN and GOLIATH could only use bit 4 and 5 which is what 30 in hex represents. This caused traverse types of type 1 2 and 3 to appear in TITAN and GOLIATH navmeshes.
The code originally did a 2D AABB, which has several negative effects. Its cheaper to calculate on load however the NavMesh results are less accurate as the boxes won't be subdivided on the Z axis during the build process. The second issue is that the raycast will query all overlapping triangles in a rectangle on a XY plane, for a detailed mesh, this could mean having to test over 1000 triangles for a simple ray cast accorss the geometry. A sample that collected 1000 triangles to test has been reduces to just 3 with this change. The build times have also been reduced by 50% (Kings Canyon NavMesh now builds in 32 minutes rather than 60+ minutes).
The NavMesh must be build with the actual radius and not its scaled extents. Titanfall 2 single-player NavMesh tile headers confirmed this. Also added a getter for the hull's radius.
The algorithm can create multiple portals of different traverse types between 2 specific polygons, this option allows the user to override this behavior by limiting this to 1.
16 was causing the clients to get kicked when they hover and moving their cursor over the characters in character select very fast. The scripts tell the server to update the view to other clients but unfortunately the system relies on string commands (ClientCommand) and is pending a rewrite to incorporate a proper RPC just like Server and UI has. For now we increase the limit to 32 as 32 is still outside the exploitable range when the game is ran without dev tools enabled.
Field name and field type were incorrectly set, GetServerByToken only returns 1 server and is always an object but it was always treated as an array of servers. Fixed field name and field type.
Out-of-band message ID 'N' is MatchInfo update (calls CHLClient::RemoteMatchInfoUpdated() which then calls UICodeCallback_RemoteMatchInfoUpdated. The RemoteMatchInfo data can be retrieved through script function GetRemoteMatchInfo()).
This code doesn't compile on VS2017 15.6 (does on 2019 and above). We also don't need to ABS; removed the ABS code as the code is currently only used for unsigned types and we probably do want to take the sign into account when getting mins/maxs from signed values too. If not then this could always be ABS'd by the caller to explicitly set the behavior.
CServer::GetClient() will never return NULL as it returns address of client in array. Removed extraneous checks as its misleading, and added const where possible.
The rebuild was wrong, the reported issue was that during auto-aim, the rotation speed is higher than original with a weaker magnet. Since the dissasembly and decompile of this function wasn't correct, along with not being able to reproduce the issue locally, it was hard to debug the problem (the difference between the rebuild and the original implementation was very small, where only experienced players noticed it). Since I have concluded that we don't need this function rebuilt as nothing else in the function needed adjustments, we can therefore just hook it and add the multiplication scalars on the computed joy angles. This now seems to yield correct behavior based on new tests that were performed with these changes.
The loader no longer loads from WinMain as this caused problems during shutdown. It was switched back to LauncherMain with several adjustments to make it work perfectly for both initialization and shutdown.