.:: 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
Lets get this stuff rolling!
Old
  (#1)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Lets get this stuff rolling! - 12-12-2004

http://realbot.bots-united.com/files/serverplugin_bot.zip



Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Lets get this stuff rolling! - 12-12-2004

A couple of tips...

1. engine->ClientCommand() sends a command to the client. This is not what you want. You want to send a command to the server AS THOUGH it came from a client (i.e. the "jointeam" stuff).

2. The ServerActivate() function in the empty plugin passes the maxClients value in as a parameter. You should store this off somewhere in a global variable and use that as the MAXCLIENTS value. This means that a bot plugin CANNOT be loaded and unloaded dynamically since the ServerActivate() will only be called when the server is starting up (and at map change). If you load the plugin while the server is already running, you won't know what maxClients is because ServerActivate won't ever be called.

botman
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#3)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Lets get this stuff rolling! - 12-12-2004

botman thanks for your reply.

I thought i read that the engine->ClientCommand() issues a client command "as if the client typed this"... so it executes the command for that client itself.

as in eiface.h
Code:
// Issue the specified command to the specified client (mimics that client typing the command at the console).
 virtual void  ClientCommand( edict_t *pEdict, const char *szFmt, ... ) = 0;
for 2. Yes, its temporarily, though atm i don't think it will cause a problem. Because i simply use that for my own registration of bots. And since its cleared out, even with every new round a maxclients change, i cannot harm the system... though there SHOULD be a check ofcourse, so i won't create clients when there are no slots etc.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#4)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Lets get this stuff rolling! - 12-12-2004

something i noticed: i figured the source was not the very latest. I had lots of more comments and such. Somehow it did not save it correctly :S


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#5)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: Lets get this stuff rolling! - 13-12-2004

It looks like that function is mainly for impulse style commands.


sfx1999.postcount++
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#6)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Lets get this stuff rolling! - 13-12-2004

I've seen it used for cd play/stop stuff too. So i am not sure if it should be used...


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#7)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Lets get this stuff rolling! - 13-12-2004

See the phrase "to the specified client" in that comment.

The server sends a string to the client. The client executes that command. So if the command is something that happens locally on the client, it will happen on the client (like starting/stoppping the CD). If the command is something that isnt' executed on the client (like a "kill" command), it will be sent back to the server and received in the server's ClientCommand() function (where the client's edict is passed in as a parameter).

Since fake clients don't have a client, you can't send commands to them and thus can't have them come back to the server's ClientCommand() function. That was why I had to create a FakeClientCommand() for the HPB bot.

botman
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#8)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Lets get this stuff rolling! - 13-12-2004

ah, that makes sense! Ofcourse, fakeclients don't get server messages (commands).

Ok, that makes it more difficult. I still can't understand the RunPlayerCommand principle yet, i just can't run it since afaik its in the player class which i cannot access through the plugin. Digging further


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#9)
Jerry
Member
 
Jerry's Avatar
 
Status: Offline
Posts: 10
Join Date: Dec 2004
Location: Woerden, The Netherlands
Default Re: Lets get this stuff rolling! - 13-12-2004

Check out:
IGameMovement (igamemovement.h)

Code:
     //========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
     //
     // Purpose: 
     //
     // $Workfile:     $
     // $Date:         $
     // $NoKeywords: $
     //=============================================================================//
     
     #if !defined( IGAMEMOVEMENT_H )
     #define IGAMEMOVEMENT_H
     
     #ifdef _WIN32
     #pragma once
     #endif
     
     #include "vector.h"
     #include "interface.h"
     #include "imovehelper.h"
     #include "const.h"
     
     //-----------------------------------------------------------------------------
     // Name of the class implementing the game movement.
     //-----------------------------------------------------------------------------
     
     #define INTERFACENAME_GAMEMOVEMENT    "GameMovement001"
     
     //-----------------------------------------------------------------------------
     // Forward declarations.
     //-----------------------------------------------------------------------------
     
     class IMoveHelper;
     
     //-----------------------------------------------------------------------------
     // Purpose: Encapsulated input parameters to player movement.
     //-----------------------------------------------------------------------------
     
     class CMoveData
     {
     public:
         bool            m_bFirstRunOfFunctions;
     
         EntityHandle_t    m_nPlayerHandle;    // edict index on server, client entity handle on client
     
         int                m_nImpulseCommand;    // Impulse command issued.
         QAngle            m_vecViewAngles;    // Command view angles (local space)
         QAngle            m_vecAbsViewAngles;    // Command view angles (world space)
         int                m_nButtons;            // Attack buttons.
         int                m_nOldButtons;        // From host_client->oldbuttons;
         float            m_flForwardMove;
         float            m_flSideMove;
         float            m_flUpMove;
         
         float            m_flMaxSpeed;
         float            m_flClientMaxSpeed;
     
         // Variables from the player edict (sv_player) or entvars on the client.
         // These are copied in here before calling and copied out after calling.
         Vector            m_vecVelocity;        // edict::velocity        // Current movement direction.
         QAngle            m_vecAngles;        // edict::angles
         QAngle            m_vecOldAngles;
         Vector            m_vecAbsOrigin;        // edict::origin
         
     // Output only
         float            m_outStepHeight;    // how much you climbed this move
         Vector            m_outWishVel;        // This is where you tried 
         Vector            m_outJumpVel;        // This is your jump velocity
     
         // Movement constraints    (radius 0 means no constraint)
         Vector            m_vecConstraintCenter;
         float            m_flConstraintRadius;
         float            m_flConstraintWidth;
         float            m_flConstraintSpeedFactor;
     };
     
     
     //-----------------------------------------------------------------------------
     // Purpose: The basic player movement interface
     //-----------------------------------------------------------------------------
     
     class IGameMovement
     {
     public:
         virtual            ~IGameMovement( void ) {}
         
         // Process the current movement command
         virtual void    ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove ) = 0;        
     
         // Allows other parts of the engine to find out the normal and ducked player bbox sizes
         virtual Vector const&    GetPlayerMins( bool ducked ) const = 0;
         virtual Vector const&    GetPlayerMaxs( bool ducked ) const = 0;
         virtual Vector const&   GetPlayerViewOffset( bool ducked ) const = 0;
     };
     
     
     #endif // IGAMEMOVEMENT_H
The only problem is that there is a CBasePlayer parameter and that isn't (easily) accessible through a plugin .


Imagination is more important than knowledge. Knowledge is limited - Albert Einstein
  
Reply With Quote
Re: Lets get this stuff rolling!
Old
  (#10)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Re: Lets get this stuff rolling! - 13-12-2004

surely interesting indeed. I tried retrieving pPlayer pointers or doing something like that, but i got into real trouble doing so. So no luck on that field yet.


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
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