A couple of weeks ago I released version 0.3 of Recording Helpers, a client-side plugin for L4D2. After spending countless of my own hours working on making videos for L4D2 I finally decided to make a single plugin to help out with the process.
Before Recording Helpers, my process for recording involved many cfgs, addon vpks, and even SourceMod plugins. In order to make simple cvar changes I had to run server-side admin tools. It wasn’t very fun. So, I wanted to try to make a client-plugin to make the process easier.
Recording Helpers at first simply removed FCVAR_DEVELOPMENTONLY from all CVars. At some point in development of the source engine, this CVar flag was added and made default for all new CVars. Unless a CVar had FCVAR_RELEASE set, it would be hidden from users. Many of the CVars hidden like this were still accessible, either through launch parameters, gamemodes.txt “hacks”, or addons like SourceMod, so the DEVONLY flag has been nothing but an annoyance to legitimate users. Removing these was a no brainer.
But let’s talk about something more interesting: Third person camera support. Thirdpersonshoulder mode was available by default (not cheatflagged, public) for L4D2′s release and many months following. However, about a year after release, Valve released an update disabling thirdperson mode (IIRC through FCVAR_CHEAT), meaning that it could only be used with cheats enabled. This was fine for most people. Video makers could still use thirdperson in their recordings, they just couldn’t play using thirdperson.
After some time, however, people began to complain about no longer being able to use thirdperson in coop games. On October 15, 2010, Valve released an update making thirdperson available in cooperative game modes. Unfortunately, this killed thirdperson for versus modes pretty hard. The new anti-thirdperson code looked something like this:
void thirdpersonshoulder_cmd(CCommand & command)
{
if(!GameRules::HasPlayerControlledZombies())
{
input->ToThirdPersonShoulder(); // global CInput * input
}
}
Although I didn’t realize it at the time of the change, similar checks were embedded in the CInput camera code, in order to halt other attempts at using thirdperson. I tried hard patching this code out, but I had no luck. Not wanting to risk VAC bans and other things, I looked for a workaround.
As it turns out, GameRules::HasPlayerControlledZombies() is simply a lookup in a global KeyValues file called “gamemodes.txt”, a file packed away in the update/ VPKs. This file has a single section for each gamemode in the game (coop, versus, scavenge, etc.) containing various settings and properties for each. One of these settings is, in fact, the “playercontrolledzombies” boolean. By simply modifying gamemodes.txt, we could tell the game that versus does *not* have player controlled zombies, and start using thirdpersonshoulder again.
Unfortunately, however, this workaround had reprecussions. For starters, releasing a modification like this would mean that players could “cheat” by using thirdpersonshoulder in live matches. For this reason, I never overtly released or distributed the hack. I only ever directly distributed it to video makers I knew and trsuted.
There were other drawbacks of the workaround, though. As you can imagine, the thirdperson command was not the only piece of code to query “HasPlayerControlledZombies”. Turning the setting off also triggered the ingame HUD to improperly render various versus mode elements. The game also produced some sounds, actions, and props differently. This was a fairly nice deterrent to those who would like to use it as a cheat, but it was also unfortunate for video makers. If you wanted to use thirdperson, you’d also have to give up on Damage Pounce amount announcements, and scoreboard displays.
But, the workaround worked well enough. I was satisfied with it for a long time. However, once I started working on RecordingHelpers, making a *real* fix for thirdpersonshoulder became intriguing again.
To be continued….
Recent Comments