.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   Let the revolution begin!!! (http://forums.bots-united.com/showthread.php?t=3301)

botman 31-12-2004 02:47

Let the revolution begin!!!
 
Check this out...

www.botman2.com/videos/HPB_bot2_alpha.avi

I got bots working in Counter-Strike: Source!!!

P.S. That video isn't going to stay there long. Somebody might want to mirror it before this time tomorrow. :|

(source code coming soon)

EDIT: Viva la revolution!

botman

Cpl. Shrike 31-12-2004 02:51

Re: Let the revolution begin!!!
 
One word. (or two)

Botman you rule

===============
EDIT: Viva la revolution!

===============
EDIT: mirror here

Botmans HPB bot2 alpha movie

Botmans HPB_bot2_Alpha_Source.zip

Cheeseh 31-12-2004 02:54

Re: Let the revolution begin!!!
 
can always count on the bot-man 8D

botman 31-12-2004 03:51

Re: Let the revolution begin!!!
 
As promised, here is the server plugin source code...

www.botman2.com/downloads/HPB_bot2_Alpha_1.zip

You will need to have created a Mod first (using Steam "Play Games" and double-clicking on "Source SDK", then double-clicking on "Create a Mod", and choosing "Start a mod from scratch").

Unzip the .zip file into your "MyMod/src/utils" folder and read the ReadMe.txt file found in the "MyMod/src/utils/HPB_bot2" folder.

Have fun!!!

botman

cannonfodder 31-12-2004 04:11

Re: Let the revolution begin!!!
 
hmmm... I wonder who suggested this ...

gameclients->ProcessUsercmds(pBot->edict, &read_buf, 1, 1, 0, false, false);

I'm still going to one-up you by figuring out how to get at the baseclass though.
If the client can do it I still think the plugin can.

botman 31-12-2004 04:30

Re: Let the revolution begin!!!
 
GO FOR IT! I'd love to see somebody get that working reliably inside a plugin. I still think it's impossible (at least to maintain it over various upgrades to the engine and game DLL files) since you assume that you know what is contained in the CBaseEntity and CBasePlayer classes based on what's in the SDK. There is nothing that forces MOD authors to use either of these classes as they exist in the SDK (MODs can add or remove stuff from them without your knowledge and this will break things because function pointers and member variables won't match up anymore).

BUT HEY! Give it a shot and see what you can do! :)

botman

cannonfodder 31-12-2004 04:48

Re: Let the revolution begin!!!
 
I don't believe you can change cbaseentity without crashing the engine. Since there are engine funcs to get to this (which I thought I could use, but I can't :( ).

If they change cbaseentity & engine then you'll have to recompile anyway.

cbaseplayer can obviously change and I would expect it to.

cannonfodder 31-12-2004 07:53

Re: Let the revolution begin!!!
 
So it appears that
CSDKPlayer* pPlayer = ((CSDKPlayer *)CBaseEntity::Instance( g_pEdict ));

actually returns a REAL pointer to cbaseentity. Even when called in a plugin. I was able to create a bot and get him to move by calling

pPlayer->PlayerRunCommand( &cmd, MoveHelperServer() );

This calls back into server.dll, since the function pointers were set up there !

I had to stub out MoveHelperServer since I don't have one in the plugin, but everything else appears to work. I was able to kill the bot, and it would respawn
right away.


Rifleman 31-12-2004 09:06

Re: Let the revolution begin!!!
 
Ah and yes botman , is the plugin can only be compiled with Microsoft Visual Studio .NET ? I only have MSVC 6

@$3.1415rin 31-12-2004 09:53

Re: Let the revolution begin!!!
 
nice work botman ! ( who expected anything else but this development ?! )

about MSVC: http://wiki.bots-united.com/index.ph...Life%202%20SDK

Zacker 31-12-2004 14:59

Re: Let the revolution begin!!!
 
Fantastic work Botman! Nice to see that you are still kicking ass:)

stefanhendriks 31-12-2004 16:16

Re: Let the revolution begin!!!
 
w00t w00t w00t dr00l dr00l dr00l!!!!

i am gonna read the source and try it myself aswell. I am eager to see how close iw as myself... ;)

stefanhendriks 31-12-2004 16:27

Re: Let the revolution begin!!!
 
I took a look at the code...

botman congrats! you succeeded in the theory i had in mind as well (as the little snippet in 'i don't like this'). Congrats!

Actually i was thinking that i had to do a lot more copying of code for WriteUserCmd and such, but it seemed it was not that much after all.

The bot will crash in HL2DM for now, but thats a fault at valve, but no worries, they have fixed it (got confirmation from alfred) and will be updated on a next steam update of HL2DM ;)

I am gonna change this lovely code... perhaps i can even get it to work for my ITM project...

one question though:
i see you use the gameinfomanager to let a bot change team. I assume this is on purpose? Because a bot should *actually* try to join the game via usercommands? (or some sort of 'menuselect' thingy?).

botman 31-12-2004 17:20

Re: Let the revolution begin!!!
 
I'm not sure about the best way to select a team. I notice that there is a client-side cvar now (something like cl_team or some such sillyness) that teamplay_gamerules.cpp uses to select the player model. That stuff may only be used by HL2DM and/or TF2.

I don't know how to get plugin entities to set client-side cvars yet.

I did notice that weapon select is now done as part of the cmd structure (instead of sending a text command with the weapon name that you want to switch to). Just set the proper bit in the cmd structure and do the WriteUsercmd() like you do for movement.

Obviously, there's still LOTS of stuff to do, but hopefully we can help each other out and get a nice "empty" bot template going for the Source engine.

botman

stefanhendriks 31-12-2004 17:24

Re: Let the revolution begin!!!
 
yes, i also noticed that on the weapon part ;) The cl_team thing is something odd for me too. I also noticed that the chooseteam(2) code does not work properly, the argument you pass is somehow overwritten by autoteambalance or something alike (i bet it is game dll specific code, so the argument you give is not used at all).

I am now investigating this piece of code, via the server interface:

Code:


        float fPitch = pBot->fIdealPitch;
        float fYaw  = pBot->fIdealYaw;

        // PROCESS AIMING
        engine->CrosshairAngle( pBot->edict, fPitch, fYaw );

i hope it works well, i just saw my bots walking backwards with a yaw of 180... and a pitch of 180... when this is the same as in HL1, i think we can copy/paste a lot of code. But i am not sure yet..

stefanhendriks 31-12-2004 17:39

Re: Let the revolution begin!!!
 
noticed:

* you can change team to any one you want, the argument is a bit different: 1 = spectator, 2 = terror, 3 = counter-terrorists

* my bots keep walking backwards, even when forward speed is set to 200. Even when removing the crosshairangle and such.

EDIT:
in addition to the second point. It seems 'forward move' is related to something. When i use -200 , my bots walk (on the T side) forward. THe same bot walks sideways in de_cbble.

perhaps you need to link this with pitch/yaw things. I did not look into this yet.

Jerry 31-12-2004 18:45

Re: Let the revolution begin!!!
 
Quote:

Originally Posted by stefanhendriks
noticed:

EDIT:
in addition to the second point. It seems 'forward move' is related to something. When i use -200 , my bots walk (on the T side) forward. THe same bot walks sideways in de_cbble.

perhaps you need to link this with pitch/yaw things. I did not look into this yet.

Maybe the bot uses the orientation of the map ;).

@$3.1415rin 31-12-2004 19:07

Re: Let the revolution begin!!!
 
nice work, next week i'm back at my normal PC :)

they still use normal angles in source2 ? 0°-360° or whatever ? I mean, calculation is based on radian, i.e. 0-2Pi, so why not that ?

stefanhendriks 31-12-2004 19:32

Re: Let the revolution begin!!!
 
@asp, why do it the hard way or the more human way? ;)

stefanhendriks 31-12-2004 19:53

Re: Let the revolution begin!!!
 
ok, i had a little bit more time to fiddle around:

- the forward speed is somehow relative to the map. I did not yet figure this out. However, when i tried using IN_FORWARD (for buttons) only, it did not work either. Also a combination of 'forwardspeed=200' plus the IN_FORWARD bit, did not work either.

I tried figuring out this relative computing of the speeds, but i think its like this: The game dll itself has code to let clients move around the map; they also rely on 'forwardmove' and 'sidemove' and such. I do not see some computing there; though i have to admit i did not do a very indepth search.

Perhaps the engine itself handles movement for fake clients differently?

- edit:
also not luck with the crosshair function, despite what kind of pitch or yaw i pass through there... :S

- edit 2:
about the crosshair thingy; i think this is due the fact that the plugin sets info first, and then the game dll. Meaning the game dll overwrites the crosshair info? (fixme!)

Cheeseh 31-12-2004 20:58

Re: Let the revolution begin!!!
 
ok how the hell do I debug with .Net and HL2 ?? :( sorry Im a bit mad at it... (most of the time it crashes and I have to close CS:S cause it blocks the MSVC window when it wants to break.. so its stops debugging..)

Also it doesnt debug the source, only the dissasembly which is a bit crap since I cant read that damn stuff

botman 31-12-2004 21:17

Re: Let the revolution begin!!!
 
I have notes in the ReadMe.txt file that explains how to set up .NET 2003 for debugging the plugin.

Does that not work for you?

botman

Cheeseh 31-12-2004 21:52

Re: Let the revolution begin!!!
 
Yeah I did that but there are problems such as not copying the DLL file to the bin folder, even though it says "1 file(s) copied" I don't see it in the counter-strike source/bin folder.

I'll read over it all again ( I tried doing it myself without reading too much)...

this is gonna be my new years, I can tell for sure :p

oh it seems the default dir was c:\program files\valve\steam\... where mine should just be in c:\program files\steam , trying again

Bluesman 31-12-2004 22:54

Re: Let the revolution begin!!!
 
Keep up the good work botman...you are the best! :)

And keep up the good work all you others bot-coders also!

botman 01-01-2005 00:17

Re: Let the revolution begin!!!
 
stefan, regarding the view angles.

I don't set them in the HPB_bot2 WriteUsercmd() function. You will probably want to change that code. Instead of this...

Code:

  buf->WriteOneBit( 0 );  // viewangles[0]
  buf->WriteOneBit( 0 );  // viewangles[1]
  buf->WriteOneBit( 0 );  // viewangles[2]

...try this...
Code:

    EDIT:  Doooh!!!!  The last one is only 8 bits...
  buf->WriteOneBit( 1 );
  buf->WriteBitAngle( cmd->viewangles[ 0 ], 16 );
  buf->WriteOneBit( 1 );
  buf->WriteBitAngle( cmd->viewangles[ 1 ], 16 );
  buf->WriteOneBit( 1 );
  buf->WriteBitAngle( cmd->viewangles[ 2 ], 8 );

...where "viewangles" is the array of angles (I assume in degrees 0-360, but I don't know why they allow 16 bits).

The gameclients->ProcessUsercmds() eventually calls CBasePlayer :: PlayerRunCommand() which does this...
Code:

            if ( pl.fixangle == FIXANGLE_NONE)
            {
                    VectorCopy ( ucmd->viewangles, pl.v_angle );
            }

Since fixangle should normally be 0 (FIXANGLE_NONE) it should be copying the viewangles from your bot cmd into the Player's viewangles variable.

EDIT: When I do this, the bot's don't turn their bodies, but the DO move in a different direction each time the YAW changes in the viewangles. Perhaps the bot's model rendering isn't being handled properly somewhere (your client doesn't know which way they are really facing), so you see them as facing one direction, but they are really facing a completely different direction (Half-Life1 bots had this problem initially too). It should be easy to tell which way they are facing by setting the pitch to zero and have them shoot their weapons every second or so and see which way the bullets go!

botman

stefanhendriks 01-01-2005 14:06

Re: Let the revolution begin!!!
 
thx botman. I do wonder how you figure this stuff out, as it seems most of the time i am looking into the wrong direction :)

Will try that soon!

, edit:

found somewhere in baseplayer_shared.cpp (dunno if it could be of any help)
Code:

//-----------------------------------------------------------------------------
// Eye angles
//-----------------------------------------------------------------------------
const QAngle &CBasePlayer::EyeAngles( )
{
 // NOTE: Viewangles are measured *relative* to the parent's coordinate system
 CBaseEntity *pMoveParent = const_cast<CBasePlayer*>(this)->GetMoveParent();
 if ( !pMoveParent )
 {
  return pl.v_angle;
 }
 // FIXME: Cache off the angles?
 matrix3x4_t eyesToParent, eyesToWorld;
 AngleMatrix( pl.v_angle, eyesToParent );
 ConcatTransforms( pMoveParent->EntityToWorldTransform(), eyesToParent, eyesToWorld );
 static QAngle angEyeWorld;
 MatrixAngles( eyesToWorld, angEyeWorld );
 return angEyeWorld;
}

especially the comment above is interesting...?

Cheeseh 01-01-2005 14:22

Re: Let the revolution begin!!!
 
I'm wondering how to get Vector.Length() to work without getting _pfSqrt external errors (?)

@$3.1415rin 01-01-2005 16:50

Re: Let the revolution begin!!!
 
looks like you can have different coordinate systems and the matrix multiplications are used to transform one into another. if there is the need for info about transformations one could write another wiki article once we know what this is exactly about ...

no idea about that sqrt stuff ... the parameter of sqrt is always >=0 so I dunno where the problem can be ... no hl2 vector class here at the moment :)

stefanhendriks 03-01-2005 17:57

Re: Let the revolution begin!!!
 
got it working... well partially ;)
http://forums.bots-united.com/showth...1474#post31474

Lazy 05-01-2005 17:15

Re: Let the revolution begin!!!
 
Can someone post a compiled dll of this?
Whenever I try to load the one I compiled I get the very descriptive "could not load plugin" error message which makes it hard to track it down.

Whistler 23-11-2010 02:42

Re: Let the revolution begin!!!
 
finally dug this out of some of my backup CDs...
so I mirrored the code here in case someone may still need it:
http://yapb.bots-united.com/files/HPB_bot2_Alpha_1.zip
:)

tschumann 25-05-2016 13:11

Re: Let the revolution begin!!!
 
Quote:

Originally Posted by Whistler (Post 62602)
finally dug this out of some of my backup CDs...
so I mirrored the code here in case someone may still need it:
http://yapb.bots-united.com/files/HPB_bot2_Alpha_1.zip
:)

Thanks! I went looking for HPB_bot2 this evening and there is almost nothing to suggest it ever existed - the comments in RCBot are vague and www.botman2.com no longer exists (and never had a public to it anyway).
Was this the only release anyway?


All times are GMT +2. The time now is 23:03.

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