Questions about Quake bots

Discuss Artificial Intelligence and Bot programming.
Post Reply
daemonicky
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Questions about Quake bots

Post by daemonicky »

I thought that, instead of looking into lot of code, I will ask questions. I had AI at school, but have not made bot myself. I understand mostly theory.

I think that even some other people can join this thread and ask questions about bots there. I think that standard format might be nice, so You can look up questions and answers easily. I propose doing :?: for new questions.

Thanks for answers. :)

How does a Quake bot (QBot) work in general :?:
===================================

I imagine the gather what is around them and then they decide what to do. So if you imagined it as a black box then its inputs are "what is around me", "my state" and output is "my state". From "my state" the movement, actions, ... is derived.

I guess that they should have some "momentum" to their current action because otherwise they might be jumping from action to action each frame; for example: going to left, then right, then left ...; I have seen this behaviour in few games.

There should be some interface by which bot attaches to player, I mean, he takes controll over player character, that is what makes him a game bot. I imagine that it might be done by settting player's attributes, I am not sure if You can override button attributes (If they are those attributes You should not touch), but movement is certainly possible to do this way ...

Is it possible to change arbitrary Quake monster AI into a QBot :?:
===============================================

I guess it is by making this interface (setting correct player's attributes).

If it is possible. Has anyone tried it? How smart were these bots? :)

Are there any QBot standards :?:
=======================

For example standard interface to player character so differend kinds of bots can be exchanged; so You can have several .

Does some QBots use state space search :?:
===============================

http://en.wikipedia.org/wiki/State_space_search , these guys ( http://en.wikipedia.org/wiki/Tree_traversal and http://en.wikipedia.org/wiki/Graph_traversal) are examples of cpecific SSS.

Does some QBots use state STRIPS or some other planning algorithm :?:
===================================================

Do these QBots communicate together :?:
==============================

By communication I mean telling each other "hey, there is the other player", "hey, I found a medikit over there". And is there a standard bot language for it?

Are there some QBots who do chat :?:
===========================

By chat I mean some non useluf communication to just amuse the people watching bots. For example "how are you", "fine, what about you", "they killed osama today", "nonsense, he is hiding at mine basement ... oops", "you are a noob", "no u" ...

There used to be Kooky bot. There are some other internet chat bots. Can some Quake bot do that? :)
in Half Life there is not squad tactics, it is all emergent (having simple rules but appearing complex when You look at it).
Think, touch, movetype, solid, traceline ...
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

How does a Quake bot (QBot) work in general? ...
This is an overly broad question. Every bot takes a completely different approach. FrikBot does something like what you describe excepting it's not a finite state machine, but more like a hierarchical state machine but with no barriers between states erected, I referred to it as a layered AI approach at the time.
There should be some interface by which bot attaches to player, I mean, he takes controll over player character, that is what makes him a game bot. I imagine that it might be done by settting player's attributes, I am not sure if You can override button attributes (If they are those attributes You should not touch), but movement is certainly possible to do this way ...
There is essentially now, with engine modifications. Like if you want to use Darkplaces you can finally use MOVETYPE_WALK for non players. Prior to this, it all had to be emulated. The majority of the FrikBot code is creating the platform to emulate players. The actual AI only takes up a tiny portion of the overall code. Previous bots did not do this and emulated the players only through weird 'smart monster' trickery. It's funny you think the movement is certainly possible, as it's by far the hardest part. Overriding button values, the engine doesn't care about and does not restrict.
Is it possible to change arbitrary Quake monster AI into a QBot?
Possible. A lot of work however.
Are there any QBot standards
No.
Does some QBots use state space search
As most of them are closed source it's impossible to say, though the expense of these algorithms make me think probably not. When writing a QuakeC bot you must remember you're doing it in an interpreted language not really designed for AI. This was all at a time where we were squeezing out every opcode to keep performance smooth. These kind of structures are more for the ease of managing state complexity, Quake bots typically don't have that much complexity. Additionally most bots were written going on 13 years ago - long before some of these methods were initially published.
ArchAngel
Posts: 37
Joined: Fri Jun 03, 2011 7:33 pm

Post by ArchAngel »

It's been a few years since I did any QC development but here's some of what I can tell you:

How does a Quake bot (QBot) work in general?
QC bots are mostly special case monsters. They *think* each frame and assess each of their goals in order of priority, if there's someone to shoot then blat them, if they're in reach of a collectable then collect it, if there's none of the above the begin the move code.
There are a few additional bits that a bot has over a standard monster, these are the fakey client elements that add in scores and the like.

Is it possible to change arbitrary Quake monster AI into a QBot?
Yes, it's actually not that hard. Change the monster navigation or think code to that of a bots and then you've got your hybrid.

Are there any QBot standards?
Most quake bots are written into the progs.dat, this tends to mean that compiling multiple bots together is pretty tricky. If you have engine based bots then you can potentially fake clients and have them compete over a network like normal players. The closest thing you get to standards are the fact that many bots are based off a common source - IE Reaper clones, tutor bot clones, globot clones etc.

Does some QBots use state space search?
Not that I know of, to do it in QC you'd have to record a bots eye view of the level as it explored it. It would potentially be easier from within an engine as you could cheat and give the bot advanced knowledge of the level.

Do these QBots communicate together
I had heard of one or two bots that were looking into this kind of thing, but I've not seen it done yet.

Are there some QBots who do chat?
Yeah, IIRC there was a lesson for the tutor bot that gave it some ELIZA type skills.

Disclaimer...
It's been years since I did any actual QC coding, so if anyone wants to contradict anything I've put here, do feel free :)
FrikaC
Site Admin
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Post by FrikaC »

Is it possible to change arbitrary Quake monster AI into a QBot?
Yes, it's actually not that hard. Change the monster navigation or think code to that of a bots and then you've got your hybrid.
I took this to mean making an arbitrary monster's cpde into a full fledged bot, so more "Write a bot from scratch. Be hampered by using an existing monster's model and code as a base".

What you're proposing, a smart monster utilizing better navigation, isn't that difficult, to which I agree. With my interpretation, the difficulty would be in making all the bot code and giving them the abilities to make it worthwhile (jumping, etc). Most bot code out there isn't really compatible with how the monsters function, the only exception I can think of would be the tutorbot code.
ArchAngel
Posts: 37
Joined: Fri Jun 03, 2011 7:33 pm

Post by ArchAngel »

FrikaC wrote:I took this to mean making an arbitrary monster's cpde into a full fledged bot, so more "Write a bot from scratch. Be hampered by using an existing monster's model and code as a base".

What you're proposing, a smart monster utilizing better navigation, isn't that difficult, to which I agree. With my interpretation, the difficulty would be in making all the bot code and giving them the abilities to make it worthwhile (jumping, etc). Most bot code out there isn't really compatible with how the monsters function, the only exception I can think of would be the tutorbot code.
Yes, you have a point. I suppose it depends if you're treating it as a learning exercise in how bots work, in which developing from the base of a monster and slowly adding more bot like code is possibly a reasonable way to go. But as you say most of the more advanced bots tend to do things in a very different manner to the average monster.
dfblogic
Posts: 5
Joined: Wed May 18, 2011 6:19 pm

Post by dfblogic »

Lots of information about Quake bots in this Thesis:

http://www.kbs.twi.tudelft.nl/Publicati ... n-MSc.html

Disclaimer: I have not studied it, only scanned through it. Does seem to be very detailed.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

Some time ago I wrote the FragBot, partially inspired in some of the FrikBot concepts (although haven't used any of its code, I decided to wrote it by myself). It was meant for use as a NPC in a now defunct mod, and is based in a small stack of "target entities". Every think cycle, the bot scans around and updates the target stack adding, removing and/or ordering it according weights a special function gives to every stack element, taking in account several factors (bot interests/needs, near players interests/needs, near threats, etc), and then act accordingly to the highest priority target in the stack (try to grab it, walk to it, avoid, attack, use, etc). It was a very interesting exercise, and not really that hard to make actually. There's a video demoing the bot behavior in the "what are you working on ?" thread.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
daemonicky
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Post by daemonicky »

frag.machine wrote:Some time ago I wrote the FragBot, partially inspired in some of the FrikBot concepts (although haven't used any of its code, I decided to wrote it by myself). It was meant for use as a NPC in a now defunct mod, and is based in a small stack of "target entities". Every think cycle, the bot scans around and updates the target stack adding, removing and/or ordering it according weights a special function gives to every stack element, taking in account several factors (bot interests/needs, near players interests/needs, near threats, etc), and then act accordingly to the highest priority target in the stack (try to grab it, walk to it, avoid, attack, use, etc). It was a very interesting exercise, and not really that hard to make actually. There's a video demoing the bot behavior in the "what are you working on ?" thread.
Beautiful. :) I would do it similar way: make list of possible moves with additional information in them, then let AI choose the best. I made Ludo AI, so turn-based game, this way (for player on move every place each piece can go to when given dice -places blocked by own pieces are ignored- with information what piece moves, whether he would go to one of "home/goal position", enemy position, how long is this road ... after that there were several AI to choose from, each was selecting its own best move - longest, shortest, random, "goal/home", enemy "kill").

How did you manage Your bot not to exchange goals too often? I mean, every frame you can have this list of goals ready for You. Did you have some way to pospound it (like "this task takes 3 seconds" or "nextthink = time + 0.2") or was it not necessary :?:
Think, touch, movetype, solid, traceline ...
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

daemonicky wrote:
frag.machine wrote:Some time ago I wrote the FragBot, partially inspired in some of the FrikBot concepts (although haven't used any of its code, I decided to wrote it by myself). It was meant for use as a NPC in a now defunct mod, and is based in a small stack of "target entities". Every think cycle, the bot scans around and updates the target stack adding, removing and/or ordering it according weights a special function gives to every stack element, taking in account several factors (bot interests/needs, near players interests/needs, near threats, etc), and then act accordingly to the highest priority target in the stack (try to grab it, walk to it, avoid, attack, use, etc). It was a very interesting exercise, and not really that hard to make actually. There's a video demoing the bot behavior in the "what are you working on ?" thread.
Beautiful. :) I would do it similar way: make list of possible moves with additional information in them, then let AI choose the best. I made Ludo AI, so turn-based game, this way (for player on move every place each piece can go to when given dice -places blocked by own pieces are ignored- with information what piece moves, whether he would go to one of "home/goal position", enemy position, how long is this road ... after that there were several AI to choose from, each was selecting its own best move - longest, shortest, random, "goal/home", enemy "kill").

How did you manage Your bot not to exchange goals too often? I mean, every frame you can have this list of goals ready for You. Did you have some way to pospound it (like "this task takes 3 seconds" or "nextthink = time + 0.2") or was it not necessary :?:
Yes, there's a "interest time" for every target in the stack, so current top target is not swapped while interest_time > time. This time is defined by the same function that weights the bot's interest in the target.

The cool thing about this approach is that you can shape the bot's personality/behavior just changing the weights for interest and interest time. Aggressive bots will spend less time healing themselves (or grabbing armor) and more time searching for better weapons and ammo. You can even implement more complex behaviors like healers or body guarders just applying higher priorities to clients in the bot's interest list.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply