.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   pfnRunPlayerMove - why it may crash? (http://forums.bots-united.com/showthread.php?t=5078)

jeefo 12-04-2006 19:57

Re: pfnRunPlayerMove - why it may crash?
 
CS1.5 Working without problems with or without this entity. I have no idea why this sh*t crashing, maybe because pod's trying pickup the entity, but entity already removed from the map, that cause bot to pickup weapon that already has null ptr.

Tested this maps with Official CSBot on CZ, there is not any problems...

KWo 18-05-2006 23:14

Re: pfnRunPlayerMove - why it may crash?
 
That pfnRunPlayerMove function crashes also in such situations - If You let Your bot to shoot at some breakable with entity having some v.impulse value > 0, as soon it is shooting at it, the CS crashes in pfnRunPlayerMove. All speeds arguments of bot were as 0, nothing special there, but the game crashes exactly in that function (at least the debugger of MS VC++ 2005 Express shows it). mingw shows the crash in mp.dll (the memory can't be read).

jeefo 19-05-2006 09:26

Re: pfnRunPlayerMove - why it may crash?
 
Quote:

Originally Posted by KWo
That pfnRunPlayerMove function crashes also in such situations - If You let Your bot to shoot at some breakable with entity having some v.impulse value > 0, as soon it is shooting at it, the CS crashes in pfnRunPlayerMove. All speeds arguments of bot were as 0, nothing special there, but the game crashes exactly in that function (at least the debugger of MS VC++ 2005 Express shows it). mingw shows the crash in mp.dll (the memory can't be read).

Debugger VC++ 2005 Pro, everytime shows crash somewhere in mp.dll or metamod, however, there is a call for pfnRunplayermove in callstack window, from bot library, but crash is not in this function. Just as a test i've add try/catch block on this function and set MSVC option Enable C++ Excpetions = Yes With SEH Exceptions (/EHa)
Code:

try
{
  (*g_engfuncs.pfnRunPlayerMove) (GetEntity (), m_vMoveAngles, m_fMoveSpeed, m_fSideMoveSpeed, 0, pev->button, pev->impulse, static_cast <byte> (m_iMsecVal));
}
catch (...)
{
  CFile Err ("error.log", "at");
  Err.Printf ("pfnRPM %s - CRASH!\n", STRING (pev->netname));
  Err.Close ();
}

File "error.log", was never created, but game is crashes as always. Try/catch catching all errors even something like that "*((int *) 0) = 0;", or if error not occurs in our library. So i think error is in mp.dll, and not caused buy pfnRPM.

jeefo 19-05-2006 09:30

Re: pfnRunPlayerMove - why it may crash?
 
Ok! Maybe it might help. Found workaround for this bug, add to dll.cpp in DispatchSpawn function.

Code:

  else if (strcmp (STRING (pent->v.classname), "player_weaponstrip") == 0)
  {
      pent->v.target = MAKE_STRING ("fake");
      pent->v.targetname = MAKE_STRING ("fake");
  }

Weapons is stripped as always, but game is not crashing...

KWo 20-05-2006 08:09

Re: pfnRunPlayerMove - why it may crash?
 
Thanks fo the hint, but is there also some workaround for this what I was elaborating about crash with breakables they have v.impulse > 0? It crashes also in mp dll, but last bot function called before crash is pfnRunPlayerMove.

jeefo 20-05-2006 08:20

Re: pfnRunPlayerMove - why it may crash?
 
Ok, please tell me one map with such entities...

Quote:

It crashes also in mp dll, but last bot function called before crash is pfnRunPlayerMove
pfnRPM is engine fnction, and maybe it last because it called 10 times in a frame for 10 bots? :)

KWo 20-05-2006 08:44

Re: pfnRunPlayerMove - why it may crash?
 
cs_arabstreets. In the building where terrorists spawn, there are some barrels. They have v.impulse about 60.

The Storm 20-05-2006 11:07

Re: pfnRunPlayerMove - why it may crash?
 
Not sure if will help but use pEdict->v.impulse in runplayermove()
I see in to the PODbot_mm sources that you call runplayermove() in this way
Code:

g_engfuncs.pfnRunPlayerMove (pEdict, vecMoveAngles, pBot->f_move_speed, pBot->f_sidemove_speed, 0, pEdict->v.button, 0, gpGlobals->frametime * 1000);
Try to make it in this way and check if will work
Code:

g_engfuncs.pfnRunPlayerMove (pEdict, vecMoveAngles, pBot->f_move_speed, pBot->f_sidemove_speed, 0, pEdict->v.button, pEdict->v.impulse, gpGlobals->frametime * 1000);
As you see after pEdict->v.button I had added pEdict->v.impulse instead of zero. Not sure if in this way it will work but you can try. :)

jeefo 20-05-2006 11:52

Re: pfnRunPlayerMove - why it may crash?
 
Nothing changed, crash as always :(

The Storm 20-05-2006 12:49

Re: pfnRunPlayerMove - why it may crash?
 
Then no very good fix but at last it will work. Check if the edict have impulse > 0 and if yes then ignore it.
From EPB
Code:

bool IsShootableBreakable(edict_t * pent)
{
    return (pent->v.impulse == 0
            && pent->v.takedamage > 0
            && pent->v.health < 1000.0
            && !FBitSet(pent->v.spawnflags, SF_BREAK_TRIGGER_ONLY));
}



All times are GMT +2. The time now is 04:00.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.