.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
RCBot 2
Old
  (#1)
redcomet
Member
 
Status: Offline
Posts: 3
Join Date: Jul 2006
Default RCBot 2 - 07-12-2006

I got a bug in me to make at least a somewhat working bot program for a mod, so I downloaded RCBot 2. After I fixed the solution and everything I compiled and everything worked pretty well. However I noticed that the bots were moving really really fast and sometimes over shooting their way points and in some cases continually running around a loop point for a few seconds before moving on.

I tryed to lower their speed by modifying the runPlayMove function but found something weird.

I put a variable reporting mechanizm into the function to tell me how the bot is moving even though the function correctly sets the forward, side, etc, for some reason no mater what speed I set as max the bot would still move at the same speed in game.

So at a later point in time I changed my status code to this:

Code:
    CBotCmd cmdLast = m_pPlayerInfo->GetLastUserCommand();

    Msg( "Bot Data:\n" );
    Msg( "-----------------------\n");
    Msg( "Forward Speed: \"%f\"\n", cmdLast.forwardmove );
    Msg( "Side Speed: \"%f\"\n", cmdLast.sidemove );
    Msg( "Upward Speed: \"%f\"\n", cmdLast.upmove );
    Msg( "Buttons Down: \"%i\"\n", cmdLast.buttons );
    Msg( "Impulse: \"%i\"\n", cmdLast.impulse );
    Msg( "Weapon Select: \"%i\"\n", cmdLast.weaponselect );
    Msg( "\n\n\n\n" );
Notice the call to get last user command. What it does it go get the last bot command executed on the bot.

I got in game and was surprised to find that for some reason the values were sky rocketing at around 600 for forward at all times and upwards of 1700 for sideways at times..

Code:
Bot Data:
-----------------------
Forward Speed: "576.200317"
Side Speed: "1748.183472"
Upward Speed: "0.000000"
Buttons Down: "0"
Impulse: "0"
Weapon Select: "0"
As compared to the data collected on the command sent to the bot:

Code:
Bot Data:
-----------------------
Forward Speed: "-38.637028"
Side Speed: "10.352784"
Upward Speed: "0.000000"
Buttons Down: "0"
Impulse: "0"
Weapon Select: "0"
Also my bot does weird things such as sprint whenever possible and is in general out of control.
I was wondering if this is a project of the source sdk or something I have to do to the code. My files are pretty much straight rcbot code, all except for my own bot plugin for a different mod other then css or hl2dm.

I figure that there might be a conflict between the default dumb bot actions and what rc bot wants to do. For example, if you just create a dumb bot it will wondering around randomly, my theory is that what my bots are doing is a combination of that and rc bot's movements causing the really fast and random moveing.

So my question is how would I disable the dumb bot movement if that is indeed the problem.

Also, Cheeseh, I cannot register for your forums, otherwise I would have posted there. I fill out the form but do not receive a confirmation email.

Thanks for any help.
  
Reply With Quote
Re: RCBot 2
Old
  (#2)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: RCBot 2 - 10-12-2006

Hmm, I don't know what would cause that, first thing though is that I don't know if the Players LastCmd is updated for bots ? Do the LastCmd values always stay the same ?

Have you updated your source code to the latest SDK from valve? (SDK tools in steam -> Create Mod -> Source Code only) And extract source code over your current location of the Hl2 SDK, the same sdk where rcbot2 resides in (/utils) I usually do that to update the latest sdk each time, as it could be a version issue and that the RunPlayerMove() function is not correctly assigned to the correct memory address and the wrong function is getting called.

BTW I've changed my forum to use SMTP email so try registering again
  
Reply With Quote
Re: RCBot 2
Old
  (#3)
redcomet
Member
 
Status: Offline
Posts: 3
Join Date: Jul 2006
Default Re: RCBot 2 - 10-12-2006

No the last command values do change, and they change corresponding to what the bot is actually doing.

I downloaded the sdk brand new before I started working on this, maybe 2 days ago.

THanks for fixing the forums I will try to register again.

edit:
No go, my new account (redcomet) is not getting sent as email to my gmail account

Last edited by redcomet; 10-12-2006 at 21:09..
  
Reply With Quote
Re: RCBot 2
Old
  (#4)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: RCBot 2 - 10-12-2006

The only things (I think) that would cause that is a "corrupted" playerinfo.h in the = operator of the CBotCmd class, causing the values to not copy correctly, OR The "cmd" is not passed correctly (which it should be) or cmd is corrupted, or something is altering memory where it shouldn't. Unless you've got or programs/plugins running with HL2?

you could also try adding:
m_pController->PostClientMessagesSent();
before the runplayermove call, It may or may not help since the bot framework given by valve has it.

Ps: I approved your account at the rcbot forums, and altered my SMTP settings again to see if it works next time
  
Reply With Quote
Re: RCBot 2
Old
  (#5)
redcomet
Member
 
Status: Offline
Posts: 3
Join Date: Jul 2006
Default Re: RCBot 2 - 10-12-2006

hm No that function did not fix it, I will have to start working with it again in a few days, I have finals this week..

Also I should mention I just tryed running them in hl2dm and they worked fine.

In dods they are skrewing up as well as my mod...

Last edited by redcomet; 10-12-2006 at 22:01..
  
Reply With Quote
Re: RCBot 2
Old
  (#6)
limpan
Member
 
limpan's Avatar
 
Status: Offline
Posts: 1
Join Date: Jul 2006
Default Re: RCBot 2 - 31-12-2006

Hi,
Iīm working on a mod to hl2dm with bots, itīs not a plugin, and I noticed this "default dumb bot actions" when I updated the SDK with the latest release.
After some headscratching Iīd come up with a solution to my problem.

When creating a bot you create an edict_t with something like this:
Code:
edict_t *pEdict = ::engine->CreateFakeClient(szName);
and with that I can get an CHL2MP_Player (but in a plugin you donīt have access to CBaseEntity ):
Code:
CHL2MP_Player*pPlayer=((CHL2MP_Player*)CBaseEntity::Instance(pEdict));
pPlayer->ClearFlags();
pPlayer->AddFlag( FL_CLIENT | FL_FAKECLIENT );
anyway I removed the flag FL_FAKECLIENT from the AddFlag() function and the dumb default behaviour was gone and my bots moved as they should.

The problem now was when I removed a bot from the server the game crashed on some flag checking function but that was fixed with adding the FL_FAKECLIENT flag right before the bot being removed.

This will probably not help a plugin if this is the problem and if it is then itīs up to valve to change their engine code that handles fakeclients
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com