IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Crash: m_Bots[slotOfEdict(pEdict)] is a bad pointer
JRob
post May 2 2011, 06:20 AM
Post #1


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I just compiled rcbots2 and tried it out. After a compile of minutes, it crashes at the same place.

I pinpointed it to bot.cpp line 2156.

CBot *pBot = m_Bots[slotOfEdict(pEdict)];

if ( pBot->inUse() )

pBot was 83 which is obviously a bad value. I did a quick hack to return NULL if pBot is less than 1000. It hasn't crashed in over an hour yet.

Here is the stack trace.

CBots::getBotPointer
CFlagEvent::execute
CBotGlobals::playerByUserId
CBotEvents::executeEvent
KeyValues::GetName
CRCBotPlugin::FireGameEvent
... some other stuff

http://crash.limetech.org/stack.php?pubid=1811
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 2 2011, 08:23 AM
Post #2


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



need to find out what 'event' it is crashing on (FireGameEvent) , its obviously returning a wrong player id within the game event, or the event has been changed and needs to be updated

i.e. the error is in a sub class of CBotEvents::executeEvent , need to find out which one and then find out the proper structure of that game event, (by using rcbot debug event 1) see what information it has and in what order
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 3 2011, 02:40 AM
Post #3


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



got a feeling that CFlagEvent::execute {
int player = pEvent->getInt("player");

edict_t *pPlayer = INDEXENT(player);

CBot *pBot = CBots::getBotPointer(pPlayer);

}

is part of the problem. player is bad.

can you run a game with no bots and just use 'rcbot debug gameevent 1' (or maybe its 'rcbot debug event 1') , and look out for the Flag event in the console when u either , pickup a flag, capture or drop. Can you remember when it crashed? Was it when a bot picked up the flag /dropped / or captured? Anyway the console information would be good. Cos my TF2 is still downloading from steam , I can't check myself right now....

User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post May 3 2011, 05:23 AM
Post #4


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



QUOTE(Cheeseh @ May 3 2011, 02:40 AM) *

got a feeling that CFlagEvent::execute {
int player = pEvent->getInt("player");

edict_t *pPlayer = INDEXENT(player);

CBot *pBot = CBots::getBotPointer(pPlayer);

}

is part of the problem. player is bad.

can you run a game with no bots and just use 'rcbot debug gameevent 1' (or maybe its 'rcbot debug event 1') , and look out for the Flag event in the console when u either , pickup a flag, capture or drop. Can you remember when it crashed? Was it when a bot picked up the flag /dropped / or captured? Anyway the console information would be good. Cos my TF2 is still downloading from steam , I can't check myself right now....


It happens when the flag is done sitting on the ground and goes back to the base. This is the output I think, there was a lot of spam.

[RCBot] [DEBUG game_event] teamplay_flag_event
[RCBot] [DEBUG game_event] eventtype = 5
[RCBot] [DEBUG game_event] priority = 8


Also how do I get snipers to stop targetting the wall in 2Fort? I tried doing rcbot waypoint angle;rcbot waypoint updateyaw on the sniping points but they still aim at the wall sometimes. How do I fix this?

Also the bots jump way to much, especially if they are standing in 1 spot. How do I fix this?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
JRob
post May 3 2011, 08:55 AM
Post #5


Advanced Member
***

Group: Members
Posts: 52
Joined: 30-April 11
Member No.: 1,970



I edited out this code in bool CBot :: checkStuck (). It stops the bots from jumping like mad and look more natural. They still jitter around.

m_pButtons->jump();
m_pButtons->duck(0.25f,randomFloat(0.2f,0.4f));

Do you have any ideas on how to fix it? Maybe engine->Time() is in milliseconds because they act way too fast. I don't even see them crouch.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Cheeseh
post May 3 2011, 03:13 PM
Post #6


Admin
*****

Group: Admin
Posts: 3,066
Joined: 11-September 03
From: uk
Member No.: 1



QUOTE(JRob @ May 3 2011, 08:55 AM) *

I edited out this code in bool CBot :: checkStuck (). It stops the bots from jumping like mad and look more natural. They still jitter around.

m_pButtons->jump();
m_pButtons->duck(0.25f,randomFloat(0.2f,0.4f));

Do you have any ideas on how to fix it? Maybe engine->Time() is in milliseconds because they act way too fast. I don't even see them crouch.

the stuck code just needs a bit more tweaking

to get bots to crouch u need to use 'bot_crouch 1' command

because the bots use engine bots as puppets , so there are limitations and bugs like that

as fopr the sniper aiming , u might need to check the aiming code , check out getLookAtVector() / LOOK_SNIPE
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 9th November 2024 - 03:41 AM