SDK Known Issues List Fixed: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(add BotPutInServer linker failures)
(add Jerky Movement when player is on moving lift/elevator)
Line 1: Line 1:
This page is intended to store important SDK bugs/known issues that existed in previous released but have now been fixed.  If your mod is based on an older SDK release, you may still be experiencing some of these bugs.
This page is intended to store important SDK bugs/known issues that existed in previous released but have now been fixed.  If your mod is based on an older SDK release, you may still be experiencing some of these bugs.
== Jerky Movement when player is on moving lift/elevator ==
{{Note|This issue was fixed in the 2006-08-04 SDK Update}}
"I'm not sure if it's the issue or not, but I remember a bug like this in episode 1," said Jay on HL Coders  "If it's the same issue, then setting smoothstairs to zero will fix it (but cause other problems).  If that's the case then you need to add some logic to disable stair smoothing when the player is on an elevator."
Here's the code from ep1
<b>baseplayer_shared.cpp:</b>
<pre>
static ConVar smoothstairs( "smoothstairs", "1", FCVAR_REPLICATED, "Smooth player eye z coordinate when traversing stairs." );
//-----------------------------------------------------------------------------
// Handle view smoothing when going up or down stairs
//-----------------------------------------------------------------------------
void CBasePlayer::SmoothViewOnStairs( Vector& eyeOrigin )
{
CBaseEntity *pGroundEntity = GetGroundEntity();
float flCurrentPlayerZ = GetLocalOrigin().z;
float flCurrentPlayerViewOffsetZ = GetViewOffset().z;
// Smooth out stair step ups
// NOTE: Don't want to do this when the ground entity is movingthe player
if ( ( pGroundEntity != NULL && pGroundEntity->GetMoveType() ==
MOVETYPE_NONE ) && ( flCurrentPlayerZ != m_flOldPlayerZ ) &&
smoothstairs.GetBool() &&
m_flOldPlayerViewOffsetZ == flCurrentPlayerViewOffsetZ
)
{
int dir = ( flCurrentPlayerZ > m_flOldPlayerZ ) ? 1 :-1;
float steptime = gpGlobals->frametime;
if (steptime < 0)
{
steptime = 0;
}
m_flOldPlayerZ += steptime * 150 * dir;
const float stepSize = 18.0f;
if ( dir > 0 )
{
if (m_flOldPlayerZ > flCurrentPlayerZ)
{
m_flOldPlayerZ = flCurrentPlayerZ;
}
if (flCurrentPlayerZ - m_flOldPlayerZ >stepSize)
{
m_flOldPlayerZ = flCurrentPlayerZ -stepSize;
}
}
else
{
if (m_flOldPlayerZ < flCurrentPlayerZ)
{
m_flOldPlayerZ = flCurrentPlayerZ;
}
if (flCurrentPlayerZ - m_flOldPlayerZ <-stepSize)
{
m_flOldPlayerZ = flCurrentPlayerZ +stepSize;
}
}
eyeOrigin[2] += m_flOldPlayerZ - flCurrentPlayerZ;
}
else
{
m_flOldPlayerZ = flCurrentPlayerZ;
m_flOldPlayerViewOffsetZ = flCurrentPlayerViewOffsetZ;
}
</pre>


== BotPutInServer linker failures ==
== BotPutInServer linker failures ==

Revision as of 22:09, 12 August 2006

This page is intended to store important SDK bugs/known issues that existed in previous released but have now been fixed. If your mod is based on an older SDK release, you may still be experiencing some of these bugs.

Jerky Movement when player is on moving lift/elevator

Note.pngNote:This issue was fixed in the 2006-08-04 SDK Update

"I'm not sure if it's the issue or not, but I remember a bug like this in episode 1," said Jay on HL Coders "If it's the same issue, then setting smoothstairs to zero will fix it (but cause other problems). If that's the case then you need to add some logic to disable stair smoothing when the player is on an elevator."

Here's the code from ep1

baseplayer_shared.cpp:

static ConVar smoothstairs( "smoothstairs", "1", FCVAR_REPLICATED, "Smooth player eye z coordinate when traversing stairs." );

//-----------------------------------------------------------------------------
// Handle view smoothing when going up or down stairs
//-----------------------------------------------------------------------------
void CBasePlayer::SmoothViewOnStairs( Vector& eyeOrigin )
{
	CBaseEntity *pGroundEntity = GetGroundEntity();
	float flCurrentPlayerZ = GetLocalOrigin().z;
	float flCurrentPlayerViewOffsetZ = GetViewOffset().z;

	// Smooth out stair step ups
	// NOTE: Don't want to do this when the ground entity is movingthe player
	if ( ( pGroundEntity != NULL && pGroundEntity->GetMoveType() ==
MOVETYPE_NONE ) && ( flCurrentPlayerZ != m_flOldPlayerZ ) &&
smoothstairs.GetBool() &&
		 m_flOldPlayerViewOffsetZ == flCurrentPlayerViewOffsetZ
)
	{
		int dir = ( flCurrentPlayerZ > m_flOldPlayerZ ) ? 1 :-1;

		float steptime = gpGlobals->frametime;
		if (steptime < 0)
		{
			steptime = 0;
		}

		m_flOldPlayerZ += steptime * 150 * dir;

		const float stepSize = 18.0f;

		if ( dir > 0 )
		{
			if (m_flOldPlayerZ > flCurrentPlayerZ)
			{
				m_flOldPlayerZ = flCurrentPlayerZ;
			}
			if (flCurrentPlayerZ - m_flOldPlayerZ >stepSize)
			{
				m_flOldPlayerZ = flCurrentPlayerZ -stepSize;
			}
		}
		else
		{
			if (m_flOldPlayerZ < flCurrentPlayerZ)
			{
				m_flOldPlayerZ = flCurrentPlayerZ;
			}
			if (flCurrentPlayerZ - m_flOldPlayerZ <-stepSize)
			{
				m_flOldPlayerZ = flCurrentPlayerZ +stepSize;
			}
		}

		eyeOrigin[2] += m_flOldPlayerZ - flCurrentPlayerZ;
	}
	else
	{
		m_flOldPlayerZ = flCurrentPlayerZ;
		m_flOldPlayerViewOffsetZ = flCurrentPlayerViewOffsetZ;
	}

BotPutInServer linker failures

Note.pngNote:This issue was fixed in the 2006-01-12 SDK Update

Fix: This is fixed in the latest (February 12th or later) SDK from Valve by adding the files to the build:

--- mod/src/dlls/hl_sdk.vcproj  2005-08-04 17:01:08.000000000 -0500
+++ mod/src/dlls/hl_sdk.vcproj  2006-02-12 13:52:33.000000000 -0600
@@ -3374,6 +3375,12 @@
                                Name="HL2MP"
                                Filter="">
                                <File
+                                       RelativePath=".\hl2mp_dll\hl2mp_bot_temp.cpp">
+                               </File>
+                               <File
+                                       RelativePath=".\hl2mp_dll\hl2mp_bot_temp.h">
+                               </File>
+                               <File
                                        RelativePath=".\hl2mp_dll\hl2mp_client.cpp">
                                </File>
                                <File

Assert iAddBucket >= 0 && iAddBucket < NUM_BUCKETS

Note.pngNote:This issue was fixed in the 2006-08-04 SDK Update

Add after float flPercent = (zCoords[iCurParticle] - minZ) / (maxZ - minZ);:

// DM: WTF happens here?
if ( (maxZ - minZ) == 0 || flPercent < 0 )
	flPercent = 0.0f;

vphysics patch from Jay at Valve

Note.pngNote:This issue was fixed in the 2006-08-04 SDK Update

In addition to the vphysics bug/feature listed below where ShouldCollide can cause it to engage Physical Mayhem, an additional requirement for vphysics is this - again quoted from Jay. Need to figure out where in the code to patch in some docs on this - in the meantime:

Calling UTIL_Remove() or delete on an entity during a callback may corrupt vphysics.

The following patch uses an assert to document this requirement from the closed-source side of things:

--- mod/src/dlls/physics.cpp    2005/10/16 16:26:25     1.4
+++ mod/src/dlls/physics.cpp    2006/05/29 17:39:03
@@ -141,6 +141,7 @@

        // IPhysicsCollisionSolver
        int             ShouldCollide( IPhysicsObject *pObj0, IPhysicsObject *pObj1, void *pGameData0, void *pGameData1 );
+       int             ShouldCollide_Default(IPhysicsObject *pObj0, IPhysicsObject *pObj1, void *pGameData0, void *pGameData1);
        int             ShouldSolvePenetration( IPhysicsObject *pObj0, IPhysicsObject *pObj1, void *pGameData0, void *pGameData1, float dt );
        bool    ShouldFreezeObject( IPhysicsObject *pObject ) { return true; }
        int             AdditionalCollisionChecksThisTick( int currentChecksDone )
@@ -482,6 +483,21 @@
 }

 int CCollisionEvent::ShouldCollide( IPhysicsObject *pObj0, IPhysicsObject *pObj1, void *pGameData0, void *pGameData1 )
+{
+       int x0 = ShouldCollide_Default(pObj0, pObj1, pGameData0, pGameData1);
+#if !defined(NDEBUG)
+       int x1 = ShouldCollide_Default(pObj1, pObj0, pGameData1, pGameData0);
+       if ( x0 != x1 )
+       {
+               Assert(0 && "ShouldCollide must return the same value regardless of the order of the two objects that are passed in");
+               ShouldCollide_Default(pObj0, pObj1, pGameData0, pGameData1);
+               ShouldCollide_Default(pObj1, pObj0, pGameData1, pGameData0);
+       }
+#endif
+       return x0;
+}
+
+int CCollisionEvent::ShouldCollide_Default( IPhysicsObject *pObj0, IPhysicsObject *pObj1, void *pGameData0, void *pGameData1 )
 {
        CallbackContext check(this);

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 );
 }

Other info and links

See SDK Known Issues List for issues in the latest SDK.