.:: 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
Re: Hooking into HL2 DLL ?
Old
  (#21)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

Quote:
ugly, and won't work on Linux.
yeah, i need some linux/unix coding practice, never coded in linux/unix enviroment before.

found in CBasePlayer, might help.
Code:
 // Run a user command. The default implementation calls ::PlayerRunCommand. In TF, this controls a vehicle if
 	// the player is in one.
 virtual void			PlayerRunCommand (CUserCmd *ucmd, IMoveHelper *moveHelper);
only problem is, i think this is for vehicles only. I tried with passing NULL on the movehelper and hl crashed :'(.


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#22)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Hooking into HL2 DLL ? - 18-01-2005

botmans method DOES still work. It's the CBasePlayer->ProcessUsercmds() that doesn't work anymore (as of latest cs:s update) I found the cbaseplayer method much tider though than the buffer writing and stuff, but hell it looks like it's gonna be the only way to do it.

Last edited by Cheeseh; 18-01-2005 at 15:57..
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#23)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

cheeseh i thought botmans method was using the ProcessUsercmds, to get the bots to process movement.


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#24)
SteveC
Member
 
Status: Offline
Posts: 37
Join Date: Jan 2005
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

The CBasePlayer->ProcessUserCommands() trick (which I started) doesn't work anymore as has been said, but the CBasePlayer->PlayerRunCommand() doesn't work either, even if you do pass the correct movehelper pointer. The debug error is that the function isn't returning as it expected so it sounds like Valve changed the CBasePlayer class, and therefore changed the virtual function table. However the SDK hasn't been updated (?), so currently we can't use the CBasePlayer class.
I don't know if Valve changed the CBasePlayer to stop us using it or if it was to fix some bugs. I think it's just something they had to do to get the bots working.

PS. Botmans way will always work, because it is based on building a network message. (until they re-write the netcode)
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#25)
SteveC
Member
 
Status: Offline
Posts: 37
Join Date: Jan 2005
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

PS! They have changed stuff, because you can now add bots in HL2: DM !
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#26)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

maybe they chaged it to give us a way to access CBasePlayer & CBaseEntity without using any hacks too.


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#27)
SteveC
Member
 
Status: Offline
Posts: 37
Join Date: Jan 2005
Location: UK
Default Re: Hooking into HL2 DLL ? - 18-01-2005

Hopefully. But we'll just have to wait.
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#28)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Hooking into HL2 DLL ? - 18-01-2005

botmans method is this ...

PHP Code:

void CBot 
:: runPlayerMove()
{
    static 
CUserCmd cmd;
    static 
bf_write write_buf;
    static 
bf_read read_buf;
    static 
unsigned char buffer[CMD_BUFFER_SIZE];  // shared buffer between write_buf and read_buf (EVIL!!!)

    //////////////////////////////////
    
memset(&cmd0sizeof(cmd));
    
//////////////////////////////////
    
cmd.forwardmove m_fForwardSpeed;
    
cmd.sidemove m_fSideSpeed;
    
cmd.upmove m_fUpSpeed;
    
cmd.buttons m_iButtons;
    
cmd.impulse m_iImpulse;
    
cmd.viewangles m_vViewAngles;

    
// SteveC:
    // this changes the fixangle from absolute (which isn't coded for) to none
    // note: has to be run here because it doesn't work in the addbot routine?!?!?
    
m_pBaseEdict->PlayerData()->fixangle FIXANGLE_NONE;
    
    
//////////////////////////////////
    
write_buf.StartWritingbufferCMD_BUFFER_SIZE );
    
WriteUsercmd( &write_buf, &cmd );  // by magic the same data appears in the read_buf!!!
    
read_buf.StartReadingbufferCMD_BUFFER_SIZE );  // this is truly EVIL!!!
    
gameclients->ProcessUsercmds(m_pEdict, &read_buf110falsefalse);
    
//////////////////////////////////

it still works, but as said before (again ) SteveC's CBasePlayer->ProcessUserCmds doesn't work anymore
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#29)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: Hooking into HL2 DLL ? - 18-01-2005

Quote:
Originally Posted by SteveC
PS! They have changed stuff, because you can now add bots in HL2: DM !
your own bots? when I try it still crashes in createFakeclient()
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#30)
SteveC
Member
 
Status: Offline
Posts: 37
Join Date: Jan 2005
Location: UK
Default Re: Hooking into HL2 DLL ? - 19-01-2005

Yeah I had my own bot in HL2: DM. I hadn't converted my movement code so it didn't do anything, just floated there. But it was in the game, in a team, and alive. It died too with a high speed barrel !

I haven't done anything special, just refreshed the SDK content which might have changed stuff.
  
Reply With Quote
Reply


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

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