.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   Half-Life 2 SDK (http://forums.bots-united.com/forumdisplay.php?f=62)
-   -   I don't like this! (http://forums.bots-united.com/showthread.php?t=3281)

stefanhendriks 30-12-2004 18:27

Re: I don't like this!
 
ah, in the VERC thread , where i posted about the bot document. Someone actually confirmed he got bots working (AND WALKING!) .. in his mod. So thats including mod source, but always nice to hear someone got it to work.

http://www.chatbear.com/board.plm?a=...4991&v=flatold

cannonfodder 30-12-2004 19:40

Re: I don't like this!
 
That's one of the things I guess I don't understand. Assuming you somehow have access to the basentity (and EVERYTHING that goes with it), why can't you include your own code for the runcommand ?

On the other hand, can't you create usercmds's and call into the servers processusercmds (which appears to be what a normal client does).

BTW, I think in that thread he did it the same way botman did, by including code in the server.dll.

BTW2, botman mentioned that you can't get angles, but I'm not sure what he ment there. The client gets the angles through the engine->GetViewAngles. This should also be available to a fakeclient.

stefanhendriks 30-12-2004 20:00

Re: I don't like this!
 
lemme search that link:
http://www.hl2coding.com/forums/viewtopic.php?t=74

its for server plugins...

i tried the processusercmds thingy before, but i ended up in some trouble. I thought the function itself also needed a cBasePlayer? Dunno what it was exactly.

cannonfodder 30-12-2004 20:33

Re: I don't like this!
 
Sorry, I meant theones posting on verc about getting bots working. I think he
is doing it in the server.dll.

processusercmds needs the edict which you got from createfakeclient and a buffer of commands. It then gets the cbaseentity from cbaseentity::instance(edict). The serverplugin can also do this by calling server->EdictToBasEntity, assuming it understands cbaseentity.

stefanhendriks 30-12-2004 20:58

Re: I don't like this!
 
i tried some more, and for a moment i thought i could get it working (compiling). But nope, it does not want to work:

Code:

          CUserCmd cmd; // create command
          bf_read *buf = NULL;        // the buffer
          bf_write *write_buf = NULL; // write buf?
          cmd.Reset();
          // Write it into buf
          WriteUsercmd( write_buf, &cmd, &cmd ); //
         
          // put cmd into buf somehow
         
          gameclients->ProcessUsercmds(clients[iClients].pEdict, buf, 1, 1, -1, false, false);

the WriteUserCmd cannot be compiled with the server plugin. So, in other words, i cannot seem to fill the buffer; unless i write some own magical function to compress it so HL2 understands it. This seems to be a tough one though.

botman 31-12-2004 00:36

Re: I don't like this!
 
WriteUsercmd is used on the client to send user key presses to the server so the server can process them.

Since bots don't have a network connection, they can't send packets to the server. :(

botman

cannonfodder 31-12-2004 00:39

Re: I don't like this!
 
What does a network connection have to do with it ? The plugin code can call processusercmds directly through the interface. Isn't it just a matter of formatting it correctly ?

botman 31-12-2004 00:48

Re: I don't like this!
 
The only place I see WriteUsercmd being used anywhere in the SDK source code is in...

cl_dll\in_main.cpp

All the 'cl_dll' code is stuff that runs on the client.

EDIT: Doooh! I didn't see that you were talking about ProcessUsercmds. Yes, that does seem to be available in the IServerGameClients interface and IServerGameClients is available to plugins. Hmmmmmm....

botman

cannonfodder 31-12-2004 01:02

Re: I don't like this!
 
I tooks botmans code and I was able to compile it into a plugin (by defining GAME_DLL). First I thought I need to use serverents->EdictToBaseEntity to get at the baseentity, but when I try to open an interface to serverents it won't let me.

So I tried cbaseentity::instance which does return an entity, but eveything is 0's. So I'm assuming that what it returned is not the real baseentity, but only what my code thinks is the real base entity (Since my code thinks it's the server.dll).

When I run it, it does create a bot, but I don't have the think code working yet so it doesn't move.

So.. Anyone have an idea how to get at the baseentity for the bot edict ????

botman 31-12-2004 01:07

Re: I don't like this!
 
That's the problem. You CAN'T access CBaseEntity or CBasePlayer from a plugin.

botman


All times are GMT +2. The time now is 06:18.

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