Bot Spawn Points In Maps

Discuss Artificial Intelligence and Bot programming.
Post Reply
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Bot Spawn Points In Maps

Post by Team Xlink »

Hello.


I was wondering how I could easily make a bot spawn point in a map just like the monsters have?

I was wondering about the idea of doing it in a generic way but I suppose the Frik Bot would benefit the most people.

Thank you.
Karatorian
Posts: 31
Joined: Tue Aug 17, 2010 4:26 am
Location: Rindge, NH, USA
Contact:

Post by Karatorian »

This would actually be extremely easy to implement. When a player or bot spawns, it generally uses the "find" builtin to locate a info_player_whatever (depending on the game mode) entity to spawn at. For bot spawn points, all you'd need to do in the map would be to create a info_bot_whatever entity.

However, for this to work, you'd need to add support for it to whatever bot you wanted to use the spawn points. This would actually be a pretty simple change. Specifics would depend on the bot in question, but it would actually be a good project for a newbie.

Sometime early in the bot's spawn code it will find a spawn point and use some info from it to spawn there. Once that code is found, it's a simple matter to change the classname (or classnames) searched for. However, the bot might use the same code as the players do to locate a spawn point. In that case you'd have to make a copy of the function (with a new name), make the changes to the copy, and change the bot to use the function. Still pretty easy.

That would get you up and running. Of course, this simple hack could be improved a bit. For instance, if you just use a simple classname replace (like I suggest above), then the bots would require bot spawn points to spawn at all. It would be better to have them fall back to regular player spawn points if the map doesn't have bot spawns. This would be pretty basic as the spawn point locating code usually checks a couple of different fallback classnames, so you can see how that is done.

Another good extension of the idea would be to make using the bot spawn points optional in some way, probably with a serverinfo key. That way people could turn them off if they'd rather the bots be more like the players and use the same spawn points.
TheHyperborian
Posts: 10
Joined: Sat Jul 23, 2011 12:35 am

Re: Bot Spawn Points In Maps

Post by TheHyperborian »

Team Xlink wrote:Hello.


I was wondering how I could easily make a bot spawn point in a map just like the monsters have?

I was wondering about the idea of doing it in a generic way but I suppose the Frik Bot would benefit the most people.

Thank you.
You can spawn a bot literally anywhere on the map, the info_player_start and info_deathmatch_start are just safe spots. If you spawn something into a solid or another entity you will get a telefrag and they will explode.

I have had maps with 100's of AI bots running around spawning on waypoints. If you don't want them to telefrag you use pointcontents() to check if the spot is solid or not before spawning the bot.
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Re: Bot Spawn Points In Maps

Post by Team Xlink »

TheHyperborian wrote:
Team Xlink wrote:Hello.


I was wondering how I could easily make a bot spawn point in a map just like the monsters have?

I was wondering about the idea of doing it in a generic way but I suppose the Frik Bot would benefit the most people.

Thank you.
You can spawn a bot literally anywhere on the map, the info_player_start and info_deathmatch_start are just safe spots. If you spawn something into a solid or another entity you will get a telefrag and they will explode.

I have had maps with 100's of AI bots running around spawning on waypoints. If you don't want them to telefrag you use pointcontents() to check if the spot is solid or not before spawning the bot.
If I recall correctly from two years ago, I was trying to implement bot only spawn points, I believe I succeeded by just mimicking the info_player_deathmatch and calling that for re spawning the bots, never the less, the problem was solved.
Post Reply