Skip to content

Rewrite of archaic Mapbase code - #563

Draft
Blixibon wants to merge 7 commits into
mapbase-source:feature/combined-sp-mpfrom
Blixibon:mapbase/feature/archaic-mapbase-code-rewrite
Draft

Blixibon wants to merge 7 commits into
mapbase-source:feature/combined-sp-mpfrom
Blixibon:mapbase/feature/archaic-mapbase-code-rewrite

Conversation

@Blixibon

Copy link
Copy Markdown
Member

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)

  • Some of mapbase_shared has been split into a header file. Mainly to declutter it, but also to move the MODTITLECOMMENT structs out of gameinterface.
  • Support for an automatically loaded manifest file (%mapname%_manifest.txt) to override the default map-specific file paths has been removed, as has the mapbase_manifest entity. 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.
  • Map-specific file manifest keyvalues now use symbol comparisons instead of string comparisons (symbols looked up on level init).
  • Cvars to enable specific map-specific files have been removed. These were causing server/client conflicts and weren't particularly useful. The mapbase_load_default_manifest cvar (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. CGMsg itself has also been refactored to use a macro instead of a dedicated function that always has to use va_list. Performance is proven to be near-identical to calling Msg directly.

mapbase_matchers_base/matchers

Mainly pulled the matcher cvars out of tier1 and into mapbase_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

CHudIcons was 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, CHudIcons replaced 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 to CHud, as have the calls for loading them in the instructor HUD.

@Blixibon

Copy link
Copy Markdown
Member Author

A couple other notes:

  • I want to either get rid of GlobalStrings.cpp/.h or find a better way to implement it. Not sure what to do with it yet
  • Something should probably be done about MapEdit.cpp, although maybe in a separate PR depending on how many changes are needed

@Blixibon
Blixibon force-pushed the mapbase/feature/archaic-mapbase-code-rewrite branch 4 times, most recently from c5ecb3d to adef73e Compare November 14, 2026 03:41
@Blixibon
Blixibon force-pushed the mapbase/feature/archaic-mapbase-code-rewrite branch from adef73e to c460a7f Compare November 14, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant