SDK Known Issues List

From Valve Developer Community
Revision as of 01:44, 17 January 2006 by Imatard (talk | contribs) (build_sample_shaders.bat)
Jump to: navigation, search
Note.png Note: A lot of this code is for HL2:MP — yet much is applicable to HL2: SP/LC. If you can't find the said function, don’t fret, it is not in your SDK version.

Contents

bin/tier0_i486.so fails to shut down when using threads

It looks like this would be fixed if Valve would recompile bin/tier0_i486.so with the -fuse-cxa-atexit gcc option. I can't wait for Valve to fix this, so instead:

Workaround: In the mean time what I've done with my mod is add an alarm(10); to the bottom of void CServerGameDLL::DLLShutdown(void) so that if bin/tier0_i486.so fails to exit, it will be killed.

sdkshaders: fix for spaces in path

Issue: Any attempt to compile the SDK shaders for a mod with spaces in the path name results in failure:

(ie: "C:\Program Files\Steam\SteamApps\SourceMods\MODNAME\src\src\sdkshaders")

This is due to the fact that the perl scripts and bat files have not been properly modified to handle spaces in the path.


Fix: Ray "VisualPhoenix" Barbiero has provided the following patches:

Note: These patches have been tested on paths with and without spaces.

updateshaders.pl

--- mod/src/devtools/bin/updateshaders.pl	2005-07-14 09:58:54.000000000 -0500
+++ mod/src/devtools/bin/updateshaders.pl	2005-10-11 23:42:36.000000000 -0500
@@ -105,7 +105,7 @@
 	{
 		$xboxswitch = "-xbox ";
 	}
-	print MAKEFILE "\t$g_SourceDir\\devtools\\bin\\perl.exe $g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl $xboxswitch -shaderoutputdir $shaderoutputdir -source \"$g_SourceDir\" $shadername\n";
+	print MAKEFILE "\t\"$g_SourceDir\\devtools\\bin\\perl.exe\" \"$g_SourceDir\\devtools\\bin\\" . $shadertype . "_prep.pl\" $xboxswitch -shaderoutputdir $shaderoutputdir -source \"$g_SourceDir\" $shadername\n";
 	my $filename;
 	if( $shadertype eq "fxc" )
 	{
@@ -199,14 +199,14 @@
 		# We only generate inc files for fxc and vsh files.
 		if( $g_xbox )
 		{
-			print MAKEFILE " $shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc";
+			print MAKEFILE " \"$shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc\"";
 		}
 		else
 		{
-			print MAKEFILE " $shadertype" . "tmp9\\" . $shaderbase . "\.inc";
+			print MAKEFILE " \"$shadertype" . "tmp9\\" . $shaderbase . "\.inc\"";
 		}
 	}
-	print MAKEFILE " $shaderoutputdir\\$shadertype\\$shaderbase\.vcs";
+	print MAKEFILE " \"$shaderoutputdir\\$shadertype\\$shaderbase\.vcs\"";
 }
 print MAKEFILE "\n\n";
 
@@ -221,11 +221,11 @@
 		# We only generate inc files for fxc and vsh files.
 		if( $g_xbox )
 		{
-			print MAKEFILE "\tdel /f /q $shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc\n";
+			print MAKEFILE "\tdel /f /q \"$shadertype" . "tmp_xbox\\" . $shaderbase . "\.inc\"\n";
 		}
 		else
 		{
-			print MAKEFILE "\tdel /f /q $shadertype" . "tmp9\\" . $shaderbase . "\.inc\n";
+			print MAKEFILE "\tdel /f /q \"$shadertype" . "tmp9\\" . $shaderbase . "\.inc\"\n";
 		}
 	}
 	print MAKEFILE "\tdel /f /q \"$shaderoutputdir\\$shadertype\\$shaderbase\.vcs\"\n";

buildshaders.bat

--- mod/src/materialsystem/stdshaders/buildshaders.bat	2005-07-14 10:00:36.000000000 -0500
+++ mod/src/materialsystem/stdshaders/buildshaders.bat	2005-10-11 23:01:08.000000000 -0500
@@ -36,7 +36,7 @@
 REM ****************
 :set_xbox_args
 set xbox_args=-xbox
-set targetdir=%vproject%\shaders_xbox
+set targetdir="%vproject%\shaders_xbox"
 goto build_shaders
 
 
@@ -45,8 +45,8 @@
 REM ****************
 :set_mod_args
 
-if not exist %sourcesdk%\bin\shadercompile.exe goto NoShaderCompile
-set ChangeToDir=%sourcesdk%\bin
+if not exist "%sourcesdk%\bin\shadercompile.exe" goto NoShaderCompile
+set ChangeToDir="%sourcesdk%\bin"
 
 if /i "%4" NEQ "-source" goto NoSourceDirSpecified
 set SrcDirBase=%~5
@@ -75,7 +75,7 @@
 
 :NoShaderCompile
 echo -
-echo - ERROR: shadercompile.exe doesn't exist in %sourcesdk%\bin
+echo - ERROR: shadercompile.exe doesn't exist in "%sourcesdk%\bin"
 echo -
 goto end
 
@@ -129,7 +129,7 @@
 REM ****************
 REM Execute distributed process on work/build list
 REM ****************
-"%SrcDirBase%\devtools\bin\perl" "%SrcDirBase%\materialsystem\stdshaders\runvmpi.pl" %xbox_args% -changetodir "%ChangeToDir%" %SDKArgs%
+"%SrcDirBase%\devtools\bin\perl" "%SrcDirBase%\materialsystem\stdshaders\runvmpi.pl" %xbox_args% -changetodir %ChangeToDir% %SDKArgs%
 
 REM ****************
 REM Copy the generated files to the output dir.

runvmpi.pl

--- mod/src/materialsystem/stdshaders/runvmpi.pl	2005-07-14 10:00:34.000000000 -0500
+++ mod/src/materialsystem/stdshaders/runvmpi.pl	2005-10-11 22:34:02.000000000 -0500
@@ -41,7 +41,7 @@
 $shaderpath =~ s,/,\\,g;
 chdir $changeToDir;
 
-$cmdToRun = "shadercompile.exe $noMPI $xboxFlag -shaderpath $shaderpath -mpi_workercount 32 -allowdebug $gameFlag";
+$cmdToRun = "shadercompile.exe $noMPI $xboxFlag -shaderpath \"$shaderpath\" -mpi_workercount 32 -allowdebug $gameFlag";
 system $cmdToRun;
 
 # other options..

build_sample_shaders.bat

--- mod/src/sdkshaders/build_sample_shaders.bat	2005-07-14 09:57:02.000000000 -0500
+++ mod/src/sdkshaders/build_sample_shaders.bat	2005-10-11 23:38:18.000000000 -0500
@@ -9,7 +9,7 @@
 
 
 rem **** Call the batch files to build our stuff.
-call ..\materialsystem\stdshaders\buildshaders.bat sdk_shaders -game "%__GameDir%" -source ..
+call ..\materialsystem\stdshaders\buildshaders.bat sdk_shaders -game "%__GameDir%" -source .\..
 goto end

vphysics patch from Jay at Valve

Jay says this fixes a bug. Although it doesn't stop the Physical Mayhem bug from happening, I've applied it, and at least it doesn't seem to make things worse. More info here.

--- ./mod/src/dlls/physics.cpp  2005/03/26 17:44:28     1.2
+++ ./mod/src/dlls/physics.cpp  2005/09/14 03:21:23     1.3
@@ -1683,6 +1683,9 @@

 void CCollisionEvent::UpdateTouchEvents( void )
 {
+       // Turn on buffering in case new touch events occur during processing
+       bool bOldTouchEvents = m_bBufferTouchEvents;
+       m_bBufferTouchEvents = true;
        for ( int i = 0; i < m_touchEvents.Count(); i++ )
        {
                const touchevent_t &event = m_touchEvents[i];
@@ -1697,6 +1700,7 @@
                }
        }
        m_touchEvents.RemoveAll();
+       m_bBufferTouchEvents = bOldTouchEvents;
 }

 void CCollisionEvent::UpdateDamageEvents( void )

Here's another for Jay. I haven't tested this yet, but what's the worst that it could do? :)

--- ./mod/src/game_shared/physics_main_shared.cpp       2005/02/18 04:45:54     1.1.1.1
+++ ./mod/src/game_shared/physics_main_shared.cpp       2005/11/04 02:01:53
@@ -371,6 +371,8 @@
        return link;
 }

+static touchlink_t *g_pNextLink = NULL;
+
 //-----------------------------------------------------------------------------
 // Purpose:
 // Input  : *link -
@@ -380,6 +382,10 @@
 {
        if ( link )
        {
+        if ( link == g_pNextLink )
+        {
+            g_pNextLink = link->nextLink;
+        }
                --linksallocated;
        }
        g_EdictTouchLinks.Free( link );
@@ -442,7 +448,9 @@
 //-----------------------------------------------------------------------------
 void CBaseEntity::PhysicsCheckForEntityUntouch( void )
 {
-       touchlink_t *link, *nextLink;
+       Assert( g_pNextLink == NULL );
+
+    touchlink_t *link;

        touchlink_t *root = ( touchlink_t * )GetDataObject( TOUCHLINK );
        if ( root )
@@ -453,7 +461,7 @@
                link = root->nextLink;
                while ( link != root )
                {
-                       nextLink = link->nextLink;
+                       g_pNextLink = link->nextLink;

                        // these touchlinks are not polled.  The ents are touching due to an outside
                        // system that will add/delete them as necessary (vphysics in this case)
@@ -476,7 +484,7 @@
                                }
                        }

-                       link = nextLink;
+                       link = g_pNextLink;
                }

                g_bCleanupDatObject = saveCleanup;
@@ -489,6 +497,8 @@
                }
        }

+    g_pNextLink = NULL;
+
        SetCheckUntouch( false );
 }

Getting the SDK to work under -Wall -Werror

If you're a professional programmer with any familiarity with GNU then the first thing you probably did was attempt to compile the SDK with -Wall -Werror, and were then disappointed by all the violations in Valve's code out of the box. Here's a list of fixes to make this work. (This list is by no means complete - I fixed many problems before I realized this would be something worth wiki-ing.)

I just noticed Valve uses -fpermissive! *barf*! So, if anyone out there had already noticed that, I now have a work in progress to fix all the scary hacks that -fpermissive would normally error on... coming soon. --Bloodykenny 20:46, 25 Oct 2005 (PDT)

offsetof errors

Unfortunately, these are due to a bug in gcc, noted here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16618. It was fixed in 3.4.2, but I haven't tried upgrading to 3.4.2 yet, as it is likely to break the linkage to Valve's .so files.

Update - I'm now using gcc 3.4.4 and everything seems fine. I had to rebuild glibc and such in a sandbox, but it was no big deal, and it fixes the offsetof errors. Will update again if I ever see an issue, but it's been a while now with no problem. --Bloodykenny 20:44, 25 Oct 2005 (PDT)

Downcast explicitly

One should always downcast explicitly. This squelches useful warnings, and self-documents your intent to downcast.

--- mod/src/public/tier0/fasttimer.h    2005/06/11 22:14:36     1.2
+++ mod/src/public/tier0/fasttimer.h    2005/09/14 00:25:19
@@ -253,7 +253,7 @@
 inline void CCycleCount::Init( float initTimeMsec )
 {
        if ( g_ClockSpeedMillisecondsMultiplier > 0 )
-               m_Int64 = initTimeMsec / g_ClockSpeedMillisecondsMultiplier;
+               m_Int64 = int64(initTimeMsec / g_ClockSpeedMillisecondsMultiplier);
        else
                m_Int64 = 0;
 }

Poor abused templates

  • This code fixes some badly used Memory Templates, and provides compatibility with Unix based systems.
--- mod/src/public/tier1/utlmemory.h    2005/02/18 04:45:58     1.1.1.1
+++ mod/src/public/tier1/utlmemory.h    2005/09/14 00:24:15
@@ -293,7 +293,7 @@
 {
        Assert( num > 0 );

-       if (IsExternallyAllocated())
+    if (CUtlMemory<T>::IsExternallyAllocated())
        {
                // Can't grow a buffer whose memory was externally allocated
                Assert(0);
@@ -349,7 +349,7 @@
        if (m_nAllocationCount >= num)
                return;

-       if (IsExternallyAllocated())
+    if (CUtlMemory<T>::IsExternallyAllocated())
        {
                // Can't grow a buffer whose memory was externally allocated
                Assert(0);
@@ -376,7 +376,7 @@
 template< class T >
 void CUtlMemory<T>::Purge()
 {
-       if (!IsExternallyAllocated())
+    if (!CUtlMemory<T>::IsExternallyAllocated())
        {
                if (m_pMemory)
                {
@@ -495,7 +495,7 @@
 {
        Assert( num > 0 );

-       if (IsExternallyAllocated())
+    if (CUtlMemory<T>::IsExternallyAllocated())
        {
                // Can't grow a buffer whose memory was externally allocated
                Assert(0);
@@ -551,7 +551,7 @@
        if (CUtlMemory<T>::m_nAllocationCount >= num)
                return;

-       if (IsExternallyAllocated())
+    if (CUtlMemory<T>::IsExternallyAllocated())
        {
                // Can't grow a buffer whose memory was externally allocated
                Assert(0);
@@ -579,7 +579,7 @@
 template< class T, int nAlignment >
 void CUtlMemoryAligned<T, nAlignment>::Purge()
 {
-       if (!IsExternallyAllocated())
+    if (!CUtlMemory<T>::IsExternallyAllocated())
        {
                if (m_pMemoryBase)
                {

Missing EOF linefeeds

First you'll need to `cvs rm -f mod/src/dlls/worker_scientist.h` since that file is blank, unused, and will make the script below not run. :)

Then run:

#!/usr/bin/perl -w

use strict;
foreach (`find mod -name *.cpp -or -name *.h`) {
    chomp;
    open(F, "+<", $_) or die "$! on $_";
    seek(F, -1, 2) or die "$! on $_";
    my $c;
    read(F, $c, 1) or die "$! on $_";
    if ($c ne "\n") {
        print "$_\n";
        print(F "\n");
    }
}

Garbage after #endifs

A common mistake in the SDK, obviously trivial to fix, but here for your conveniance:

diff -w -u -r1.3 ai_basenpc.cpp
--- dlls/ai_basenpc.cpp 2005/06/11 22:14:26     1.3
+++ dlls/ai_basenpc.cpp 2005/09/10 18:16:13
@@ -8450,7 +8450,7 @@

        return shotDir;
 }
-#endif HL2_DLL
+#endif // HL2_DLL

 //-----------------------------------------------------------------------------



diff -w -u -r1.1.1.1 npc_BaseZombie.cpp
--- dlls/hl2_dll/npc_BaseZombie.cpp     2005/02/18 04:45:52     1.1.1.1
+++ dlls/hl2_dll/npc_BaseZombie.cpp     2005/09/10 20:57:40
@@ -1582,7 +1582,7 @@

 #ifdef DEBUG_ZOMBIES
                        DevMsg("Wandering\n");
-#endif+
+#endif

                        // Just lost track of our enemy.
                        // Wander around a bit so we don't look like a dingus.



diff -w -u -r1.2 memalloc.h
--- public/tier0/memalloc.h     2005/02/19 18:24:26     1.2
+++ public/tier0/memalloc.h     2005/09/10 05:12:39
@@ -133,6 +133,6 @@
 #define MEM_ALLOC_CREDIT_CLASS()
 #define MEM_ALLOC_CLASSNAME(type) NULL

-#endif !STEAM && NO_MALLOC_OVERRIDE
+#endif // !STEAM && NO_MALLOC_OVERRIDE

 #endif /* TIER0_MEMALLOC_H */




snprintf strangeness

There are several conflicting snprintf defines and other snprintf porting bugs in the SDK, which need to be fixed for Werror compatibility:

diff -w -u -r1.1.1.1 interface.h
--- public/tier1/interface.h    2005/02/18 04:45:58     1.1.1.1
+++ public/tier1/interface.h    2005/09/10 06:09:25
@@ -33,8 +33,6 @@

 #define HMODULE void *
 #define GetProcAddress dlsym
-
-#define _snprintf snprintf
 #endif

 // TODO: move interface.cpp into tier0 library.



diff -w -u -r1.1.1.1 interface.cpp
--- tier1/interface.cpp 2005/02/18 04:45:59     1.1.1.1
+++ tier1/interface.cpp 2005/09/10 21:18:20
@@ -191,7 +191,7 @@
                Q_snprintf( str, sizeof(str), "%s.dll", szAbsoluteModuleName );
                hDLL = LoadLibrary( str );
 #elif _LINUX
-               _snprintf( str, sizeof(str), "%s_i486.so", szAbsoluteModuleName );
+               Q_snprintf( str, sizeof(str), "%s_i486.so", szAbsoluteModuleName );
                 hDLL = dlopen(str, RTLD_NOW);
 #endif

Broken comments

Ending a // comment with \ is just begging for trouble...

diff -w -u -r1.1.1.1 collisionutils.cpp
--- public/collisionutils.cpp   2005/02/18 04:45:56     1.1.1.1
+++ public/collisionutils.cpp   2005/09/10 23:59:09
@@ -2299,7 +2299,7 @@

        return true;
 }
-
+/*
 //--------------------------------------------------------------------------
 // Purpose:
 //
@@ -2314,7 +2314,7 @@
 //    0-----2
 //
 //--------------------------------------------------------------------------
-
+*/
 //-----------------------------------------------------------------------------
 // Purpose: find the minima and maxima of the 3 given values
 //-----------------------------------------------------------------------------

First big pass at -Wall and consistent code

Convert stricmp, _alloca etc to Q_stricmp, stackalloc versions. Fix basetype declarations like 0 to 0.0f when appropriate. Comply with STL min/max. Comply with POSIX/BSD naming inline (and appropriate #ifdefing) in all cases where a cross-platform compatibility utility function does not yet exist.

You'll need to remove the inappropriate -D defines in the Makefile for the str/printf/alloc things. Those are now fixed by using the correct functions in the code to begin with, however I don't have a patch for the Makefile included in the file below.

http://www.ihud.com/file.php?file=1131153963/patch_hl2_sdk_wall_sanity.txt

BotPutInServer linker failures

Various BotPutInServer lines will fail to link in DEBUG mode. Commenting the BotPutInServer lines out works just fine. It may have some negative affect on bots. I quite frankly have not looked into that stuff at all, other than to see that it breaks the build.

Fix: A better way would be adding hl2mp_bot_temp.h and hl2mp_bot_temp.cpp to the HL project under the Source Files->HL2MP folder. hl2mp_bot_temp.h and hl2mp_bot_temp.cpp can both be found in yourmod/src/dlls/hl2mp_dll folder.

Server: Host_Error: SV_PackEntity: SendTable_Encode returned false (ent %d).

Here %d will be replaced by whatever the entity number is that caused the error. No single entity is allowed to write more than 2KB to the network stream. This error happens when an entity overflows that buffer.

Fix: If you need an entity to occasionally transmit more than 2K of data, you will need to split it up into multiple entities, each transmitting part of the data. You should ensure of course that no entity -consistently- transmits 2K of data, as it would bog down your network. Some entities might want to send a large amount on map initialization etc, however. Another possible workaround for some situations (may not always be possible), is to update data a little bit each frame, so that no one frame has a big change.

Server: The client's health variable is pointlessly sent across the wire twice.

Fix: Diff And Patch

  • There is no line 1888 within c_baseplayer.cpp in the stock MP, or SP SDK's - do i just tack the code onto the end (The BaseClass::SetGroundEntity(ground); is also not there) --Amckern 22:46, 5 Nov 2005 (PST)

Ah, sorry. That patch was against an already-modified file, not a fresh SDK. The SetGroundEntity is part of my mod. :) Yes tack it onto the end. After you do so, post the diff back here! --Bloodykenny 09:25, 12 Nov 2005 (PST)

--- mod/src/cl_dll/c_baseplayer.cpp     2005/06/30 05:54:09     1.6
+++ mod/src/cl_dll/c_baseplayer.cpp     2005/07/16 21:33:33
@@ -1888,3 +1888,7 @@
    BaseClass::SetGroundEntity(ground);
}

+
+int C_BasePlayer::GetHealth() const {
+    return g_PR->GetHealth(entindex());
+}



--- mod/src/cl_dll/c_baseplayer.h       2005/07/11 03:28:41     1.9
+++ mod/src/cl_dll/c_baseplayer.h       2005/07/16 21:05:31
@@ -103,7 +103,7 @@

        // Data handlers
        virtual bool    IsPlayer( void ) const { return true; };
-       virtual int             GetHealth() const { return m_iHealth; };
+       virtual int             GetHealth() const;

        // observer mode
        virtual int                     GetObserverMode() const;



--- mod/src/dlls/player.cpp     2005/07/12 07:38:04     1.33
+++ mod/src/dlls/player.cpp     2005/07/22 00:45:48
@@ -58,6 +58,8 @@
 #include "nav_mesh.h"
 #include "env_zoom.h"

+#include "player_resource.h"
+
 #ifdef HL2_DLL
 #include "combine_mine.h"
 #include "weapon_physcannon.h"
@@ -4295,6 +4297,9 @@
        m_lastx = m_lasty = 0;

        m_lastNavArea = NULL;
+
+    // update now so that our new health gets sent with the respawn notice
+    g_pPlayerResource->SetPlayerHealth(entindex(), m_iHealth);

        /// @todo Do this once per round instead of once per player
        if (TheNavMesh)



--- mod/src/dlls/player_resource.cpp    2005/06/19 02:54:04     1.5
+++ mod/src/dlls/player_resource.cpp    2005/07/22 00:44:35
@@ -85,6 +85,13 @@
 }

 //-----------------------------------------------------------------------------
+// Purpose: Sets health value for a particular client (used to set on spawn so the data will be sent synchronously)
+//-----------------------------------------------------------------------------
+void CPlayerResource::SetPlayerHealth(int entindex, int health) {
+    m_iHealth.Set(entindex, health);
+}
+
+//-----------------------------------------------------------------------------
 // Purpose: The Player resource is always transmitted to clients
 //-----------------------------------------------------------------------------
 int CPlayerResource::UpdateTransmitState()



--- mod/src/dlls/player_resource.h      2005/06/18 21:16:29     1.3
+++ mod/src/dlls/player_resource.h      2005/07/22 00:42:57
@@ -26,6 +26,8 @@
        virtual void UpdatePlayerData( void );
        virtual int  UpdateTransmitState(void);

+    void SetPlayerHealth(int entindex, int health);
+
 protected:
        // Data for each player that's propagated to all clients
        // Stored in individual arrays so they can be sent down via datatables

Then you can remove the SendPropInt and RecvPropInt for CBasePlayer::m_iHealth. (However, I don't have a patch for that yet since it's not a backwards-compatible change. Will post a patch once I've done so, if no on else beats me to it.)

Server: weapon_citizensuitcase Assert on startup

Fix: Install copy of the SP SDK, then copy the scripts/ directory over

Server: Some bullet weapons set to do 0 damage.

Fix: Need to edit their AddAmmoType which are strangely set to 0 for some reason.

Server: Some projectile weapons set to do 0 damage.

Fix: Need to edit their source files and set a damage.

Client: --- Missing Vgui material vgui/steam/games/icon_cz

Fix: These files are used in the currently inaccessible Friends IM client. Create 4 vmts in their places of any design to remove the error.

  • materials\VGUI\steam\games\icon_cs.vmt
  • materials\VGUI\steam\games\icon_dod.vmt
  • materials\VGUI\steam\games\icon_hl2mp.vmt
  • materials\VGUI\servers\icon_secure_deny.vmt

Here's a patch to create files for the first three. (I don't see the icon_secure_deny.vmt error, so didn't create anything for it.)

--- materials/VGUI/steam/games/icon_cs.vmt      1969-12-31 18:00:00.000000000 -0600
+++ materials/VGUI/steam/games/icon_cs.vmt      2005-07-28 01:54:17.000000000 -0500
@@ -0,0 +1 @@
+"UnlitGeneric" {}
--- materials/VGUI/steam/games/icon_dod.vmt     1969-12-31 18:00:00.000000000 -0600
+++ materials/VGUI/steam/games/icon_dod.vmt     2005-07-28 01:54:19.000000000 -0500
@@ -0,0 +1 @@
+"UnlitGeneric" {}
--- materials/VGUI/steam/games/icon_hl2mp.vmt   1969-12-31 18:00:00.000000000 -0600
+++ materials/VGUI/steam/games/icon_hl2mp.vmt   2005-07-28 01:54:15.000000000 -0500
@@ -0,0 +1 @@
+"UnlitGeneric" {}

Fix2: Add clear to your rc file in cfg (extract from gcf if non-existant)

Server: The crossbow causes an assertion failure.

Fix: Comment out ai_activity.cpp line 53. This doesn't appear to be something that can be fixed in code?

Server? Client?: RL explosion invisible

Per http://www.chatbear.com/board.plm?a=viewthread&t=970,1107153392,30132&id=786504&b=4991&v=flatold

Fix: No known workaround.

sv_gravity is not associated with physics gravity

When gravity is changed, the physics gravity isn't updated Fix: in movevars_shared.cpp:

static void GravityChanged_Callback( ConVar *var, const char *pOldString )
{
	if(physenv)
		physenv->SetGravity( Vector(0, 0, -var->GetFloat() ) );
}
ConVar	sv_gravity		( "sv_gravity",DEFAULT_GRAVITY_STRING, FCVAR_NOTIFY | FCVAR_REPLICATED, "World gravity.", GravityChanged_Callback );

To do: Diff this

Server: util.cpp (531) : Assertion Failed: !"UTIL_GetLocalPlayer"

Occurs when taking damage to yourself from tossing a table straight up into the air.

Fix: The following patch fixes the Assert, and appears to be more functionally correct as well. Validation from Valve that the patch is correct would be appreciated. Diff And Patch

Index: mod/src/dlls/player.h
===================================================================
--- mod/src/dlls/player.h 2005/02/19 22:20:29 1.2
+++ mod/src/dlls/player.h 2005/02/24 00:35:30
@@ -459,6 +459,7 @@
     // mass/size limit set to zero for none
     static bool CanPickupObject( CBaseEntity *pObject, float massLimit, float sizeLimit );
     virtual void PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize = true ) {}
+    virtual bool IsHoldingEntity( CBaseEntity *pEnt );
     virtual void ForceDropOfCarriedPhysObjects( CBaseEntity *pOnlyIfHoldindThis = NULL ) {}
     virtual float GetHeldObjectMass( IPhysicsObject *pHeldObject );

Index: mod/src/dlls/player.cpp
===================================================================
--- mod/src/dlls/player.cpp 2005/02/21 00:05:42 1.3
+++ mod/src/dlls/player.cpp 2005/02/24 00:35:33
@@ -7447,3 +7447,7 @@
     return cmd;
 }

+bool CBasePlayer::IsHoldingEntity( CBaseEntity *pEnt )
+{
+    return PlayerPickupControllerIsHoldingEntity( m_hUseEntity, pEnt );
+}

Index: mod/src/dlls/physics_impact_damage.cpp
===================================================================
--- mod/src/dlls/physics_impact_damage.cpp 2005/02/18 04:45:50 1.1.1.1
+++ mod/src/dlls/physics_impact_damage.cpp 2005/02/24 00:42:24
@@ -417,12 +417,22 @@
     else if ( pEvent->pObjects[index>GetGameFlags() & FVPHYSICS_PLAYER_HELD )
     {
     // if the player is holding the object, use it's real mass (player holding reduced the mass)
-    CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
-    if ( pPlayer )
-    {
+    CBasePlayer* pPlayer = NULL;
+    {for (int i = 1; i <= gpGlobals->maxClients; i++) {
+        CBasePlayer *temp_player = UTIL_PlayerByIndex(i);
+        if (temp_player
+            && temp_player->edict()
+            && temp_player->IsHoldingEntity(pEvent->pEntities[index])
+        ) {
+            pPlayer = temp_player;
+            break;
+        }
+    }}
+    Assert(pPlayer && "object with FVPHYSICS_PLAYER_HELD but no player holding it");
+    if (pPlayer) {
     float mass = pPlayer->GetHeldObjectMass( pEvent->pObjects[index] );
-    if ( mass > 0 )
-    {
+        Assert((mass > 0) && "player was holding object so mass should be non-zero");
+        if (mass > 0) {
             invMass = 1.0f / mass;
         }
     }

Note: Instead of iterating all players, why not consider adding a m_pHolder var and GetHolder and SetHolder functions to CBaseEntity

(You could, though it's unlikely to impact performance much since this is not a frequently called function. Bloodykenny 17:55, 19 Jul 2005 (PDT))

Assert !"UTIL_GetLocalPlayer" when using combine ball

Fix: Diff And Patch

diff -u -r1.1.1.1 prop_combine_ball.cpp 
--- mod/src/dlls/hl2_dll/prop_combine_ball.cpp 2005/02/18 04:45:52 1.1.1.1 
+++ mod/src/dlls/hl2_dll/prop_combine_ball.cpp 2005/02/24 01:34:21 
@@ -788,9 +788,9 @@ 
     pPhysicsObject->GetPosition( &vecPosition, NULL ); 
     pPhysicsObject->GetVelocity( &vecVelocity, NULL ); 

-    CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); 
-    if ( pPlayer ) 
+    if (gpGlobals->maxClients == 1) 
     { 
+    CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); 
     Vector vecDelta; 
     VectorSubtract( pPlayer->GetAbsOrigin(), vecPosition, vecDelta ); 
     VectorNormalize( vecDelta );

Note: This really is a dirty fix because the combine ball always has to face the player because the model was design without a back side

Server: CreateEvent: event 'break_prop' not registered

This was implemented before breakable props were finished clientside

Fix: Find it and comment it out

I'm not sure what you're saying the fix is here. Or is that just a statement explaining why the bug exists in the SDK? Bloodykenny 17:57, 19 Jul 2005 (PDT)

HL2.exe mysteriously segfaults if you forget to put the client.dll and server.dll in your mod's bin directory

Fix: Don't do that.


Server/Client: Negative entitygroundcontact crash.

The implications of this SDK bug are not at all clear, but in debug mode you'll get an assert, and in release mode it will presumably segfault. The patch assumes anything negative or really large is bogus and dumps it.

I'm starting to wonder if maybe this is another symptom of the Physics Mayhem bugs. --Bloodykenny 17:24, 4 Nov 2005 (PST)

Fix: Diff And Patch

--- mod/src/game_shared/usercmd.cpp 2005/02/18 04:45:54 1.1.1.1
+++ mod/src/game_shared/usercmd.cpp 2005/03/23 02:24:00
@@ -290,7 +290,12 @@
 #if defined( HL2_DLL )
     if ( buf->ReadOneBit() )
     {
-        move->entitygroundcontact.SetCount( buf->ReadShort() );
+        int count = buf->ReadShort();
+        if ((count < 0) || (count > 140)) {
+            Msg("Ignoring strange entitygroundcontact count: %d\n", count);
+            return; // why can this be less than 0, Valve? change to ReadWord()???
+        }
+    move->entitygroundcontact.SetCount( count );

     int i;
     for (i = 0; i < move->entitygroundcontact.Count(); i++)

Client: Spinning around quickly with the Stun Baton as your active weapon causes the screen to flash white

It's worth noting that recent updates to HL2DM have fixed this. However there has not yet been an SDK code update to show what the fix is. Basically Valve seems to have made the glow fade out completely in between swings.

Fix: Fix unknown

Assert on line 866 of mod/src/game_shared/basecombatweapon_shared.cpp

Fix: I haven't been able to determine exactly why this is an assert. It's just "Assert(0);" with no accompanying explanation, but commenting it out results in no problems it seems. Diff And Patch

--- mod/src/game_shared/basecombatweapon_shared.cpp     2005/02/18 04:45:53     1.1
+++ mod/src/game_shared/basecombatweapon_shared.cpp     2005/03/04 03:45:36     1.2
@@ -863,7 +863,7 @@
        CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
        if ( vm == NULL )
        {
-               Assert( false );
+               //Assert( false );
                return false;
        }

Client: The mod can appear to have frozen on initial startup

Originally posted by Garry here: http://www.chatbear.com/board.plm?a=viewthread&b=4991&t=234,1117553034,6915&s=0&id=868372

Fix: Issue a "progress_enable" command just before "map <mapname>".

engine->ClientCmd("progress_enable");

engine->ClientCmd("map test");

This should fix local servers. For connecting to a remote multiplayer server, the only issue appears to be that you can't switch to another window and then switch back to HL2. Doing so causes HL2 to never render progress info until load is fully complete. That seems to be an HL2 core bug unrelated (though very similar in appearance) to the fix above.

USE_VCR_MODE linker errors

This is because Valve wants to be able to somehow replay all of the things that happen in a mod and get back the exact same output. I'm still confused as to how that would work, or what the value really is, but anyway, if you need things like threading, you'll hit these errors.

My mod needed threading and commenting these out has never caused any issue. Though apparently it means my mod can't use VCR mode.

Fix: Comment out the appropriate lines in protect_things.h, for whatever VCR thing was failing. Note, don't just block out the whole file - the string part at the top is actually useful.

Hammer crashes after wake up from screen saver

I have encountered a bug in hammer, running under XP Pro. I am using the "Windows XP" screen saver. And I have "Fast User switching" and "Use Welcome Screen" turned on. With my account that is password protected as well as guest account turned on. (Guest account is not logged in)

  • 1: First run Hammer and open up a map.
  • 2: Leave hammer running in the foreground. Wait for screen saver to start.
  • 3: Wait a minute after screen saver starts, and use mouse mouse to wake up computer from screen saver.
  • 4: Type in user password to re-enter windows and the standard windows error dialog is displayed asking to submit error report to microsoft or not fallowed by a memory error message box.

This is not always reprodceable. But it has happened to me 3 times today so I am posting it here. If I find a way to reliably reproduce the error I will post the info here. Be sure to save your work before leaving your computer with hammer running!


Source Crashes when alt+tab during background map loading

  • When you alt + tab out of the game when the background map is loading, you will end up with a crash. Debug points to a frame count hack that I have no idea how to fix. Someone that knows how to add a curTime event may be able to fix this bug.

Here's a stack trace following a screen change and a crash:

>	engine.dll!0da99893() 	
 	engine.dll!0db000e2() 	
 	engine.dll!0db0046f() 	
 	engine.dll!0dafba15() 	
 	engine.dll!0da9995a() 	
 	engine.dll!0da6247d() 	
 	engine.dll!0db2e05c() 	
 	engine.dll!0d9e3907() 	
 	engine.dll!0da6f816() 	
 	engine.dll!0da7a31c() 	
 	engine.dll!0da7a9b3() 	
 	engine.dll!0da853b5() 	
 	engine.dll!0da854a2() 	
 	engine.dll!0da8553f() 	
 	engine.dll!0db2309c() 	
 	engine.dll!0db22c67() 	
 	MaterialSystem.dll!0d58d0c5() 	
 	engine.dll!0daa50fb() 	
 	engine.dll!0db22eee() 	
 	engine.dll!0db22d24() 	
 	engine.dll!0db22d2f() 	
 	engine.dll!0db22dcc() 	
 	launcher.dll!1000369b() 	
 	launcher.dll!10007f70() 	
 	launcher.dll!10007f70() 	
 	launcher.dll!100057f8() 	

Lighting in Compile (RAD)

There is currently a rather severe lighting bug during RAD. Visible symptoms include: black models while in shadows cast by light_environment; large, unlit sections in "outdoor" type areas.

Fix: Pending.

Using the Sheild Scanner npc_cscanner is not possible unless you name the map with d3_c17 as a prefix

I was expecting the flag for strider scout scanner to be the sheild scanner version of the npc_cscanner, but it seems that the flag is there, but currently in the default hl2 code it does nothing.

So I replaced in the Scanner constructor function the code that compares the first 6 letters of a map name to d3_c17 with

if( IsStriderScout() )
	 {
		 // Streetwar scanners are claw scanners
		 m_bIsClawScanner = true;
	 }
	 else
	 {
		 m_bIsClawScanner = false;
	 }

You then need to cut and paste the code into the spawn function before precache is called.

Other info and links

See also this nice general HL2 bug list on the steam forums. Many of the issues seem imbedded down inside the closed-source side of things, so they are outside the scope of this SDK Known Issues list.

There's also this Patch HL2 petition where users sign their name to beg Valve to fix the aforementioned bugs.