Artificial Intelligence Depot
Visiting guest. Why not sign in?
News, knowledge and discussion for the AI enthusiast.
FEATURES COMMUNITY KNOWLEDGE SEARCH  
CounterStrike Bot
Building an intelligent Bot
 
• CounterStrike Bot

I am currently working on a project which requires me to develop an intelligent Counterstrike Bot. I am not sure how to go about starting and implementing the AIs into the codes. Hope to get some help and advice. Thanks!

6 posts.
Friday 30 May, 04:00
Reply
• CS bot

I would break up the process into Requirements, Design, implementation, and testing. Do you have all your requirements yet? or are you on design? or where?

I would probly look for existing bots and see if you can reuse code.

Is there anything specifically you are having problems on? Starting and implementing a CS bot is a big topic.

18 posts.
Saturday 31 May, 16:10
Reply
• Types of Artificial Intelligence to be adopted?

I have found the botman's bot source code, but I am not sure how should i modify the code in order to enhance the intelligence.

There are so many different types of AI available but which one should I consider given that I only have a few months to complete the project and have little knowledge on AI.

6 posts.
Sunday 01 June, 11:26
Reply
• CS Bots

Do you know if the bots use nodes to move from point A to point B? Or do the bots run around wherever they want and check for collision on objects? I think in Half-life they used nodes for a lot of the squad type stuff.

Anyway, for the brains you probly don't want to use neural networks or genetic algorithms or anything fancy like that. You'd probly be better off using a good old fashioned state machince for the brains. The state machine can be as simple or complex as you want it to be. It could be just a bunch of condition statements strung together.. however I would try to make it a little more elegant.

So an example would be this: if your bot was in the SNEAK_AROUND state, he would probly walk slowly and shoot discreatly. In all states you would probly want the bot to react to an enemy by killing the enemy however, you have knife, grenades, and 2 types of guns so you have some designing to do as far as how you want the bot to kill and in what states.

You are going to want to also make the bot fun. I would make the bots as hard as you can and then make them dumber if they're too hard. Also remember that a good bot doesn't just aim good... a good bot will act as much like a human player as possible ... without going for the Awp every time!! :)

Let me know if you have any more questions or comments.
-John Holman

18 posts.
Sunday 01 June, 16:48
Reply
• Requires AI for brain

The bots use waypoints to navigate through the maps (Only certain maps)

Unfortunately I cannot use state machine for the brain. I am required to implement the AI for the intelligence. As much as I wanted to model it like a human player, but is it possible if I am going to adopt Genetic Algorithm so as to allow the bots to learn and evolve? Or is there a better alternative that I can fall on?

6 posts.
Monday 02 June, 04:03
Reply
• CS bot intelligence

Can you tell me exactly what you want to accomplish? I can't help you unless I know what exactly you want them to do. Sounds like you want them to learn but I need more info :)

Why can't you use state machines? Is this like a school project or something?

18 posts.
Monday 02 June, 15:44
Reply
• AI Brain for project

This is my final year project for my uni. The requirement is for me to use AI as bot's brain. Unfortunatly I am uncertain about the directions. Currently I am reading on GA but not sure if thats the correct approach. I am hoping to make the bot evolve as the game plays. Kindly enlighten.
Thanks!

6 posts.
Tuesday 03 June, 06:03
Reply
• cs bot learning

Here's what I would do if I wanted them to learn. I assume you want them to act as a team correct? See this is where I need more info... I'm talking about implementation before I have all the requirements :) but here we go anyway.

Basically, the things I see you needing is, recon for the game data, and brains to interpret that data into a final action.

Recon would be easy if you want them to cheat. There's nothing wrong with cheating if you can make it fun.

The brains could basically take in data, formulate goals, plans, and actions, and then perform those actions. Now if you want them to learn, you could weight the goals, plans, or actions based on the outcome but this would be very tricky as the data would be different every time.

Another way is to just formulate those goals,plans,and actions and use the one that had worked the best regaurdless of the data.

If you want to have emergent behaviors, perhaps you could have each individual bot pick a location and go there. If it works then keep doing it. If not go somewhere else.

There are many possiblilities. Again, I need more info about the specific types of behaviors you want from the bots as these different methods have certain strengths and weaknesses. I would suggest thining about what types of behaviors you want and then worrying about implementation later. Learning is a broad topic too.

18 posts.
Tuesday 03 June, 22:59
Reply
• Learning Bots

Hi,

I just read your thread of messages and might have a suggestion.

Even though I don't really know much about game bots, I think John mentioned a point valuable beyond most requirements you may have.

If I am not mistaken the idea is to a use a pre-compiled library of plans in some language, which can be as simple as the unextended STRIPS language.

Now, you also want your bots to learn and improve some performance measure as I understand. As interesting and rewarding the study of GAs may be, I think this is a feature that should go under the 'Future Work' section of your project.

Instead you might want to look into simple neural networks for evaluation of a bot's actions and thus enabling the bot to learn which plans are best applied in which situations.

I am not at home right now, so I don't have access to the exact references but: There is research by two guys (Ackley and Litman) about how neural networks can be used for this. As always, Russel's and Norvig's book will serve as a good intro to some other methods of learning. And if you want to check out how to employ plans download JAM - a Practical Reasoning System implementation in Java that uses pre-compiled plans and can do some fancy stuff.

My apologies in case all of this does not make sense in the context of bots.

- Bruno

10 posts.
Wednesday 04 June, 09:32
Reply
• bots and a planning system

Yeah, you could even have goal/plan generation functions that build goals/plans out of existing actions. This is called a planning system.

I've thought about this before and what I did was have my actions all built. They aren't going to change and they are the smallest items in the planning system. These would be functions like goto, kill_enemy, throw flashbang... ect.

Now one level up is the plans. This is composed of all the little actions. So one plan might be enter_building. This consists of a set of actions like goto(door), throw_flashbang, open_door, and walk_inside.

The goals are the top most level in the planning heirarchy. They would be like rescue_hostages, or kill_all_enemies, or something like that. They would basically consist of several plans to carry out and complete the goal.

So I guess you're gonna have to think about what you want to generate and what you just want to leave constant. I agree with Bruno in that you probly don't need to use a GA. Some sort of simple ranking system on how well the goal/plan worked could do pretty well I would think.

-John Holman

18 posts.
Wednesday 04 June, 16:34
Reply
• bots and their environment

If you allow me, I would like to ask a question.

I am used to prgramming intelligent agents which usually run in a well-controlled software environment (i.e. simulation) or which gather as much information from a network as necessary.

Now, when we are talking about bots in a game, how does a bot get its percepts? What is it a bot would perceive in a game?

And, is there a good book to read up on AI in games development? At uni I never had any exposure to AI in games.

Cheers,

- Bruno

10 posts.
Sunday 08 June, 12:39
Reply
• bots in games

There are many ways to have game bots perceive things. In games it's usually whatever works and produces the best behavior in the quickest time. A lot of times the computers haven't been fast enough to do what the developers wanted one way so they had to do what is called "cheating" in the AI game world. Cheating just means that the bot has more game info than the player would... like the bot might know of all the positions of every player.

So there's lots of ways a bot can get precepts in a game. For enemy locations, there's usually some construct that tells the bot there's an enemy around based on the bots sight and other senses. In its simplest form you might have an n^2 algorithm where the construct checks every bot against each other and alerts one if it's near another. You can also do things like ray casting. Cast a ray in the bots line of sight and see what it hits and that's what the bot sees. You can use this for bot collision detection also.

You can also have nodes pre set like waypoints. This is what the game halflife did. You set up nodes all over the map in tactical positions. The bots can then go to those points in a group tactical manner and look like they are going where there's cover... ect. This looked very neat and believable.

Some general things that a bot would percieve in a game is: Other players, obstacles, manipulatable objects, .... these things are usually on a need to know basis. If it's not going to change behavior of the bot then you don't need to know it.

In professional games it's not necissarily how you do it, just is it fun at the end.

A good book to read is AI Games Programming Wisdom, edited by Steve Rabin.

Hope that helps.

-John Holman

18 posts.
Sunday 08 June, 16:03
Reply
• Main Idea

I need to come up with a Bot that improves complex problem solving through experience. Thus I would need the bot to evolve and learn. I know that it can be done by using Genetic Algorithm but can someone advice me how can I do that?? Thanks!

6 posts.
Wednesday 11 June, 14:15
Reply
• GA with cs bot

Well, I don't think I would use a GA for the CS bot but here's how I might do it.

I would probly use the nodes that you were talking about for moving around. Or make your own somehow. Then you're gonna have to decide what functionality you want. Do you want them to learn on a macro level or micro level.. eg. do you want them to behave intelligently as a group or more as individuals?

Also what's your environment for the GA? Remember GAs are all about the evolution of a better race by selecting the good individuals to breed further. Are you gonna run a program that goes through several generations of bots like 10,000 or so and end up with a set of good bots then use them in game? Or are you doing all your breedng/mutating/selection in game? You're gonna have to go through a lot of games if it's in game.

You're gonna need to define what bots did good and what ones did bad so that you can weed out the bad bots from the good and produce better batches of bots. This will probly be the hardest part. If your critera for a good bot is number of kills but all the bot does is rambo around, then that might not produce good co-operative bots. Also if a bot doesn't get any kills at all, but is really good at covering, flashbanging, smoking ... or whatever, you might want that bot around even if it didn't get a lot of kills.

You're gonna need a mutation function that takes existing bot functionality and mutates it into a new plan.

Well, there's some things to think about. Hope that helps.

-John Holman

18 posts.
Wednesday 11 June, 17:13
Reply
• Need Help for CS Bots

Thanks Stormtrooper.
I would like my bots to behave intelligently as a grp and they are suppose to breed as the game plays. The better ones will be those that have the highest frag and minimum death.
I hv got a working source code that's from podbot v2.6. Now trying to digest the code and make modifications from there. But gelt very lost cause I have little clue where should I start modifying. Where are all the inputs...I am just wondering if I can get any help from you, any form. Thanks!

6 posts.
Tuesday 01 July, 03:16
Reply
• cs bots using a ga

ixi,

I don't know how far you are into your project, but here is my first impressions. Pretend like we are playing cs_assault, and you and I are on the terrorist team with a bunch of humans. On the ct team, trying to infiltrate the warehouse are a team of bots. You want to evolve the best behavior for the team, so do it like a team of humans would. Probably what will happen is that human ct's would buy a variety of weapons and attack from a variety of directions. Assuming a constant level of skill amongst the humans (all bots have the same basic ai to keep it simple) the humans with the best strategy (preferred weapon, attack location, and attack team size) will be the most successful, and later, the other humans would try to take advantage of the successful strategies by mimmicking them.

Encode these strategies into a genotype. For example, we can list traits like:

1 - 'I like to be attacking with _X_ number of people, if the group gets bigger than this, I will go off on my own'
2 - 'I will camp for _X * 10_ number of seconds before attacking'
3 - 'I will buy _X_ gun if I have the money'
4 - 'I will attack route _X_ first.'
5 - 'If _X_ teamates die before I do, I will go into camp mode.'

This is probably a good number of characteristics for each bot. The bots can start with random values for each of these characteristics for the beginning of the map. After each round, you can mate the most successful bots to create the strategys that the bots will use next round. This reflects how actual human matches work!

Ok, so to encode these traits (AKA chromosomes), we can say that each trait has 8 possibilities. So for this, we need 3 bits per trait. All the information describing a bot's strategy will look like this:

1 2 3 4 5 = corresponding trait
101 001 111 100 101 = gene for a bot

This is the genotype for each bot. Lets convert this binary gene into a bot's strategy.
1 => 101 = 5, plug 5 into the first trait:
1 - 'I like to be attacking with _5_ number of people, if the group gets bigger than this, I will go off on my own.'
2 => 001 = 1, plug 1 into the second trait (1 * 10):
2 - 'I will camp for 10 number of seconds before attacking.'
3 => 111 = 7, plug 7 into the third trait:
3 - 'I will buy gun number 7 if I have the money' (maybe colt, or awp, however you number them)
etc...

When the round ends we want to mate the most successful bots from the previous round to make the new bots. A review for how you might mate your bots:
example: a bot with a gene of 101 001 111 100 101 might mate with another bot with a gene of 110 001 101 001 101

101 001 111 100 101 = parent 1
110 001 101 001 101 = parent 2

___ 001 ___ ___ 101 = traits that both parents share

so except in the case of mutation or crossover, the traits that the parents share should be reflected in the child. To fill in the blanks for the child, you should flip a coin for each trait to decide which parent to take the trait from. I don't recommend flipping a coin for each bit, it works much better to do it by trait. Pick another pair of parents to mate and create another child for the next generation until all the bots have been created for the team.

A tip that you may already know for selecting parents is called 'tournament' mating. You randomly select 3 parent candidates, and let the best 2 mate. You can use more than 3 if you want. I pick the parent candidates at random, but skew my pick towards the most fit parents with a function like this:

candidate = oldPopulation[ random()^2 ];

This only works if the population is sorted from most fit at the beginning of the array, to least fit and the end of the array. (I recommend a good quicksort algorithm for this).

One thing you should note is that the more traits you have for your genetic algorithm, the longer it takes to see improvements in the population. This is because many traits depend on each other. In the example, the camping trait will only work well if the bot tends to select a gun that works well for camping. The favorite attack place trait also depends on the number of teamates the bot likes to be around, etc. The more traits you have, the longer it will take for the dominating strategies to emerge and be used in your population.

I have an applet on the internet for playing around with genetic algorithms that you can use to get a feel for what population sizes work with what problems, etc. http://www.missouri.edu/~clj4hf/TravellingApplet.html
This may help tune your intuitions to what works well with genetic algorithms, but writing your own will help better!

I hope this helps =)

tr0p

15 posts.
Friday 05 September, 04:17
Reply