Repository navigation
Conversation
Member
Author
|
A couple other notes:
|
Blixibon
force-pushed
the
mapbase/feature/archaic-mapbase-code-rewrite
branch
10 times, most recently
from
November 16, 2026 05:40
27d5bd3 to
a491a02
Compare
Blixibon
force-pushed
the
feature/combined-sp-mp
branch
from
November 16, 2026 05:56
e993b91 to
6da1e0b
Compare
Blixibon
force-pushed
the
mapbase/feature/archaic-mapbase-code-rewrite
branch
from
November 16, 2026 06:19
a491a02 to
5585bd4
Compare
Blixibon
force-pushed
the
feature/combined-sp-mp
branch
4 times, most recently
from
November 17, 2026 00:47
e7d9834 to
91de33e
Compare
… for multiple and variable shadow map resolutions
…mized classname matching
Blixibon
force-pushed
the
mapbase/feature/archaic-mapbase-code-rewrite
branch
from
November 17, 2026 01:24
5585bd4 to
563c1c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rewrites and refactors Mapbase code of various origin that was written early in the project to be more efficient and less janky. This targets the combined SP/MP branch due to the MP branch already containing some refactors that were needed to support TF2.
As part of this refactor, a number of particularly obscure features have been removed. Instances of this are in bold.
mapbase_shared (generic code, map-specific files)
mapbase_sharedhas been split into a header file. Mainly to declutter it, but also to move theMODTITLECOMMENTstructs out ofgameinterface.%mapname%_manifest.txt) to override the default map-specific file paths has been removed, as has themapbase_manifestentity. These were very seldom used and documented, and there was a report that the latter may not have been functional. If you need to load non-standard files, use the exposed VScript functions.mapbase_load_default_manifestcvar (which could disable all default map-specific files) is retained.Most other changes are general refactoring or organization. I would have liked to do more to revisit the way the map-specific file enum and array are defined due to how messy the
#ifdefs are, but I don't think a more intricate solution is necessary for it.mapbase_game_log
Completely removed. Was not finished or documented. A similar system should use a modified gamestats.
mapbase_con_groups (console groups)
The original idea behind console groups was to achieve a Source 2-style system where you not only have custom colors and separation for groups of console messages, but can also configure them by editing a script file. However, this feature is neither well-documented nor have I felt that this has been useful under its past implementation, as all console groups were in a hardcoded array.
Console groups are now defined as direct struct objects, and then passed by reference to
CGMsg. This allows custom console groups to be declared quickly and easily.CGMsgitself has also been refactored to use a macro instead of a dedicated function that always has to useva_list. Performance is proven to be near-identical to callingMsgdirectly.To avoid linker issues, the console group code has been pulled out of
tier1and moved intocommonto be included directly by the projects that use it. Game-related console groups have also been moved into their own file (game_con_groups) to partition them further.The compiler will throw an error if a file includes the original
tierversion ofmapbase_con_groups.h.Additionally, two new console groups have been added for MP: Death Notices and Game Coordinator, with the latter being TF2-specific.
mapbase_matchers_base/matchers
Mainly pulled the matcher cvars out of
tier1and intomapbase_shared.cpp, since they had conflicts between the client/server. For now, I've only defined cvars for the server. Also cleaned up some of the comments.Remove CHudIcons
CHudIconswas added from the VDC tutorial for adding the Game Instructor. However, this actually contains duplicated functionality for loading HUD textures. In the Alien Swarm SDK,CHudIconsreplaced all HUD texture functionality, but that isn't the case in Source 2013, which appears to have been a mistake in the tutorial. The calls for loading instructor textures have been moved toCHud, as have the calls for loading them in the instructor HUD.Projected textures
The
ASW_PROJECTED_TEXTURESpreprocessor has been removed, with its associated code folded either into base code or into theMAPBASEpreprocessor. Additionally, to avoid data from being lost across the engine divide (and other ABI issues), the new variables inFlashlightState_thave been moved into a separateFlashlightStateExtras_tstruct managed directly by the client shadow manager for each projected texture. (technically it's used on every shadow as well, which isn't necessary and allocates a few extra bytes, but I felt that this was easier and less risky than a pointer to data in the projected textures)Additionally, shadow depth textures are passed to the shader via render parms again, as is the case in SP branch Mapbase. This was lost in the initial MP port because the render parms sent pointers, which weren't sent properly in 64-bit, but that led to issues with decals flickering when multiple projected textures are shining at once. This has been fixed and restored.
There's also a feature riding with this that's more-or-less completely new: Shadow depth textures are now split into 4 different sets of different resolutions, which by default are 2048x2048, 1024x1024, 512x512, and 256x256 (as opposed to just 2048x2048). The idea is that more shadow maps can be allocated for lower resolutions without a significant increase in overall memory; for example, 4 instances of 1024x1024 shadow maps can fit into one 2048x2048 shadow map. Mappers can use specific resolutions via keyvalues, or they would otherwise fall back automatically if there's too many projected textures visible at once. The number of textures allocated for each resolution can also be set in a script file, rather than through command line params.
Global strings
Mapbase's "global strings" feature (hardcoded micro-optimizations in
GlobalStrings.h/.cppadapted from HL2 code) has been completely removed and replaced with a new base entity function calledClassMatchesDirect(), which uses the pre-existingAllocPooledString_StaticConstantStringPointerto find pooled strings extremely quickly and when using string literals. There's also an overload which takes astring_tdirectly and just compares the pointers.Instances of global strings filling in for base code have been reverted, but the original code calls
ClassMatchesDirectinstead when applicable.The compiler will throw an error if a file includes
GlobalStrings.hor uses any of its functions or variables.Weapon data parsing
HL2-specific weapon data values have been moved to a new custom weapon parse class, as is the case in TF2 and HL2DM.