Inside3D!
     

Spawning Bots Using PutClientInServer();

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Mon Jan 18, 2010 2:23 am    Post subject: Spawning Bots Using PutClientInServer(); Reply with quote

Ok... maybe I'm hopping in way over my head...

Back in the day a person would spawn a bot using something similar to spawning monsters. Now days I've noticed that people are creating bots by using:
SetNewParms();
ClientConnect();
PutClientInServer();

I've tried dissecting FrikaBot... wow, is my head swimming. (No worries Frika... I didn't scratch or dent him!)
As you probably know, using the three functions above, by themselves, just causes you to respawn elsewhere in the level. Well, respawn is probably not right... I assume that you are just re-created as a new player then spawned at the next spawning spot.

Should I be looking the Rankings code borrowed from Alan Kivlin?

Is there any info on this stuff that a fellow can look over? A tutorial or maybe some of you can break it down for me?

Sorry for the lack of AI on my part... I've been out of the scene since 1998!
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon Jan 18, 2010 2:14 pm    Post subject: Reply with quote

The first thing you must know is about the "self" global variable. Those functions do a bunch of crap to "self". You have to make sure "self" is set to the proper entity before calling them. So you might spawn an entity, set self to point to it, then call those functions. But I have no idea if those functions are safe out-of-the-box to call on non-clients. FrikBot may have made modifications.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Mon Jan 18, 2010 2:23 pm    Post subject: Reply with quote

FrikBot uses actual client slots so they are safe to call.

Have a look at BotConnect() from bot.qc - in fact for a first bot I would recommend taking FrikBot and ripping the AI out to save you reinventing the wheel on the boring stuff.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Tue Jan 19, 2010 5:29 am    Post subject: Reply with quote

c0burn wrote:
FrikBot uses actual client slots so they are safe to call.

Have a look at BotConnect() from bot.qc - in fact for a first bot I would recommend taking FrikBot and ripping the AI out to save you reinventing the wheel on the boring stuff.


Yeah, I had thought about doing that.

My goal is to create a simple bot base/skeleton that is up to par with modern Quake bots... spawning as a client, using client physics, today's current ranking system, and directional movement code.
Besides creating a "modernized" bot base... I hope to learn something from the experience. And be able to contribute something to the Quake community here.

I know... I know... there are a few bots out there that are good as a simple bot base. Unfortunately they are outdated (but still good to look at) and I understand that FrikaBot is considered to be a good bot base... however, it has grown up quite a bit and is a bit beyond a simple bot base. Don't get me wrong... FrikaBot is a great bot... but is more of a plug-and-play bot now days.

Anyways, I'm open for tips, suggestions, or just general chatter on this subject.
Maybe FrikaC wouldn't mind me ripping his bot back down to something simpler... 'shudder' it'd be ugly and probably broken in a few places!
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Tue Jan 19, 2010 6:06 am    Post subject: Reply with quote

MauveBot is a very basic DP only bot - and it uses spawnclient() builtin to avoid any messy stuff.

Maybe look into that.
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Tue Jan 19, 2010 6:27 am    Post subject: Reply with quote

c0burn wrote:
MauveBot is a very basic DP only bot - and it uses spawnclient() builtin to avoid any messy stuff.

Maybe look into that.


I have been playing around with DP's bot spawning capabilities. I like this method very much as it is very easy.
The only downfall to a DP bot is that it will always require DP to run... though, it would provide less code to look
through for someone new to bot programming.
I myself lean towards the freedom to use a bot on any engine.
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Thu Jan 21, 2010 6:45 am    Post subject: Reply with quote

Well, I've been picking apart the FrikaBot bot connection and client checking code and am puzzling it out! Slowly but surely! Razz

I do have a few of questions though...

If there are 16 slots available when I alone enter Quake, which slot do I fill... Slot 1 or slot 16?

I noticed that nextent() was used to cycle through entities. Does this cycle through all entities or just the player entities?

The following code suggests that nextent() only cycles through player entities OR player entities are at the end of an "entity list" and nextent() cycles backwards through that list. Are either of these thoughts correct? Or do I need to keep digging?

Code:
   ent = nextent(world);
   max_clients = 0;

   while(ent != world)
   {
      max_clients = max_clients + 1;
      ent = nextent(ent);
   }
   if (max_clients > 16)
      max_clients = 16;

_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
c0burn



Joined: 05 Nov 2004
Posts: 158
Location: Liverpool, England

PostPosted: Thu Jan 21, 2010 7:42 am    Post subject: Reply with quote

On a listen server, you're slot 1. The world is slot 0. The rest of the clients/bots are 2-16.

Nextent cycles through all entities, but that code is called from worldspawn() if I'm remembering rightly so at that time there are only the world and client entities created by the engine. It's just Frik taking advantage of that knowledge so he can count how many client slots there are (you can't read "maxplayers" from QC as it's a command not a cvar).
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
Junrall



Joined: 21 Sep 2009
Posts: 136
Location: North West Oregon, USA

PostPosted: Thu Jan 21, 2010 7:50 pm    Post subject: Reply with quote

Thanks c0burn... that totally makes sense and clears up the muddy water a bit!
_________________
Good God! You shot my leg off!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group