Skip to content

Conversation

Blixibon
Copy link
Member

@Blixibon Blixibon commented Mar 2, 2025

This branch represents a minimum viable product for Mapbase running on the updated Source 2013 Multiplayer branch.

The current goal of this branch is to support Mapbase on Team Fortress 2. Preliminary support for HL2:DM and singleplayer HL2 also exist, although the latter is still not viable on this branch due to engine issues.

This branch is being developed in cooperation with the Team Fortress 2: Classic team, and many "generic" fixes or improvements from Team Fortress 2: Classic will be added to this branch in the future.


This branch has the following limitations:

  • Mapbase's shader changes (parallax corrected cubemaps, projected texture fixes, etc.) have not yet been implemented.
  • The VScript in this branch is functional, but it is in very bad shape internally and needs work. It may also not yet support everything TF2 supports.
  • Mapbase's build automation scripts have not yet been adapted to the new dependencies.

Feature removals

Before using this branch, be aware that we intend to remove features from the game that are barriers to modding and/or that we are reasonably certain will not (or cannot) be used by mods.

Most of these removals were originally meant for Team Fortress 2: Classic in particular, but many of them are being upstreamed to Mapbase due to an overlap of work with other TF2 mods. We are still working out the details of exactly what would be necessary to remove, but for now, this is what's on the chopping block:

  • The coaching system
  • Free/trial account checks
  • EOTL duck related features (duck still exists)
  • TF2 achievements
  • Promotional codes
  • Main menu "training" popups
  • Casual and competitive match type checks
  • Matchmaking dashboard and associated panels
  • Badge, PvP rank, and comp match summary panel
  • tf_wearable_campaign_item
  • Some fields for CEconItemDescription
  • Contracker panels and quests
  • Store/ad panels
  • Vast majority of econ item tool code
  • YouTube and twitch.tv integration
  • Campaign medals
  • Trading

If you are developing a TF2 mod which will rely on one or more of these features, please let us know.

Mapbase VScript + TF2 VScript

Mapbase and the TF2 SDK have their own separate implementations of VScript. The ideal state of Mapbase VScript in this branch would be a hybrid that supports everything TF2 VScript supports. Since they both derive from Alien Swarm, they have a common baseline, but they have also gone through several years of independent and sometimes convergent changes. As a result, these implementations still collide catastrophically overall and have serious conflicts.

There are three main points of complication:

  • TF2 VScript has an overhauled script variant system which frees memory differently. Some of these changes conflict with fixes in Mapbase which resolved memory leaks in other ways.
  • TF2 VScript has its own ways of registering and tracking script descriptions which partially diverge from Mapbase.
  • Mapbase VScript has several features that were inspired by features in later Source games, such as the NetProps or Convars singletons. As the new branch contains much of the original code for these features, Mapbase now awkwardly contains both their original implementations as well as the independent implementations based on them.

For the time being, I have nested most conflicting sections of code from TF2 VScript in #ifndef MAPBASE_VSCRIPT and merged sections where I'm reasonably certain the functionality is identical, although I did have to forego a number of Mapbase changes (e.g. some of the new memory safety fixes for Vectors/script variants) because I wasn't sure how to merge or #ifdef them without risking further issues.

Many of the sections I wasn't sure about merging involved changes from @samisalreadytaken and @z33ky, who may have a better impression of how their features could coexist with TF2 VScript.

TF2 vs. Mapbase syntax

Some functions in Mapbase and TF2 have the same name, but different syntax. I've added a preprocessor to prioritize TF2 VScript's syntax when playing MP games (TF2 or HL2:DM) while prioritizing Mapbase's syntax in SP games (HL2).

Currently, singletons such as NetProps and Convars which exist in both TF2 and Mapbase will use Mapbase's version. These singletons still have some syntax differences which may not yet be compatible with all TF2 vscripts.

Other issues

  • Weapon models on other players may occasionally disappear.
  • In TF2, certain HUD effects (e.g. the timer above dropped intel) may flicker while cloaked as the spy.
  • Ropes may not be visible at the moment. (I need to look into the rope code)

Future features

Beyond the base feature set, we hope what Mapbase does for TF2 will eventually be on a similar level to what Mapbase does for HL2. We have discussed adding better support for custom weapons and optional support for more than 2 teams, like what TF2:C has.

I also intend to add some features to HL2:DM which I was working on prior to the SDK update, including integration of Mapbase's upcoming protagonist and animation state systems, although I will focus on those at a later time (and potentially in a separate pull request).

How to use this branch

I do not currently have a build prepared, although if you are developing a TF2 mod using the SDK code, you should be able to merge this branch and use it as-is. We recommend using Git so that further changes can be easily pulled in the future.

The shared content VPK normally used in Mapbase mods has some scripts which weren't meant to be used with TF2, so it should not override TF2's file paths. Instead, you can put it in between TF2 and HL2 content, like this:

			game_lv				|appid_440|tf/tf2_lv.vpk
			game+mod			|appid_440|tf/tf2_textures.vpk
			game+mod			|appid_440|tf/tf2_sound_vo_english.vpk
			game+mod			|appid_440|tf/tf2_sound_misc.vpk
			game+mod+vgui		|appid_440|tf/tf2_misc.vpk

+			game+mod			|gameinfo_path|../mapbase_shared/shared_misc
+			gamebin				|gameinfo_path|../mapbase_shared/shared_misc/bin
+			game+mod+vgui			|gameinfo_path|../mapbase_shared/shared_content_v7_0.vpk

			game				|appid_243750|hl2/hl2_textures.vpk
			game				|appid_243750|hl2/hl2_sound_vo_english.vpk
			game				|appid_243750|hl2/hl2_sound_misc.vpk
			game+vgui			|appid_243750|hl2/hl2_misc.vpk
			platform+vgui		|appid_243750|platform/platform_misc.vpk

Note that this file structure will likely change for any eventual build release.

You can also choose to forego the Mapbase VPK entirely, although entity icons/dev texture assets and some specific Mapbase features (e.g. map-specific files, console groups) may not be fully functional.

Mapbase FGDs for Source 2013 Multiplayer (including TF2) can be found here: https://github.com/mapbase-source/source-fgds/tree/mapbase-mp

misyltoad and others added 30 commits February 18, 2025 18:49
…lveSoftware#797)

* fix prediction for jumping when huntsman is charged/released

* remove SetInternalChargeBeginTime override from CTFCompoundBow

ValveSoftware#797 (comment)
cattslmao and others added 30 commits August 22, 2025 15:57
this skips a pre-mature/extra bone setup during particle simulation
and flexing by allowing for the last frame's attachment position to be used

technically this is a bit of a hack but it works well from my analysis.

it gets rid of almost all of the particle cost in team fights besides sprite rendering

Co-authored-by: mastercoms <[email protected]>
cheap water LOD was disabled with local specular
due to shipping constraints
but re-enabled for ep2 on xbox 360

this change now re-enables it for all platforms

Co-authored-by: mastercoms <[email protected]>
some players report that they have tracked down some cases
where the player model could still update its rendering
outside the class menu

this is commonly observed through FPS increasing when
using the scoreboard

may only be relevant for some custom HUDs

Co-authored-by: mastercoms <[email protected]>
g_ragdoll_fadespeed was not being used in TF2 ragdolls
despite being used in other games

fix cl_ragdoll_forcefade not working on the same frame
if delay is 0

fix cosmetics not respecting ragdoll fade settings

Co-authored-by: mastercoms <[email protected]>
despite being a less efficient renderer, DX8 is still used for
performance reasons due to its lower quality settings.
we can continue to provide these lower quality settings
with the much more robust and efficient DX9 renderer,
which will benefit the playerbase and game.

engine change: mastercomfig/tf2-patches-old@eaac092#diff-260f8c14c7dd12646fa64721dcdf647450005b5002ce33047bc6a9ccb578daac

Co-authored-by: mastercoms <[email protected]>
this fixes platform inconsistencies between Linux and Windows
on certain floating point values.

for example, on Windows servers, small ammo packs will grant 41 metal when
on Linux servers they provide the intended 40 metal.

Ceil2Int is also faster computationally

Co-authored-by: mastercoms <[email protected]>
Various performance related commits carried over from TC2.
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.