Jump to content
  • Advertisement
Sign in to follow this  

what's behind counter strike

This topic is 2975 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello guys,

i'm thinking of a simple third-person shot. man against cpu in a maze. something like counter strike. but i have no idea how to let the computers fight back in an intelligence way. can you give me some ideas?

Share this post

Link to post
Share on other sites
Hooo boy. That's a whole book there, sir.

In fact, there are plenty to recommend. For starters, hit up Mat Buckland's "Programming Game AI by Example". That will teach you a lot of what you need to know. But you still won't have a complete bot at that point.

What I'm trying to say is that going from "I don't know" to "I can do a FPS bot" is likely a many-month educational adventure. Likewise, it isn't something that can be distilled into a forum post (which is why people write books on the subject).

Share this post

Link to post
Share on other sites
Hello. Here's the way I would go about solving this problem.

First I'd break the problem down into componenets. What might the bot need to be able to do?

- Find you
- Aim at you when you are in line of sight
- Shoot at you when you are in its aim
- Choose an appropriate weapon from its arsenal
- Use the environment to its advantage
- Throw flash bangs round corners when it thinks you are nearby
- Replenish ammo from pickups
- Get new weapons from pickups

And there may be more things you would want your bot to do.

Many of these could be discarded in a simplified version of the bot. By giving it unlimited ammo, only one possible weapon (e.g. machine gun), making it pretty dumb, and making its aiming and path finding quite artificial, you could limit the list to something like:

- Find you given that it always knows your position
- Shoot at you when you are in line of sight given that the bot always faces towards the player

For the first point you'd implement something quite standard like the A* algorithm.

For the second point you would implement appropriate weapon damage on the target player everytime you implement the shooting animation for the bot. Make it miss a random number of times per number of shots. The number of times it misses per number of shots it takes would be a way to implement a simple difficulty level for the bot.

You can then make the bot smarter and more realistic by adding features to it in order of priority. (The hardest ones to implement might be having the bot use the environment to its advantage, and being able to do things like flash bang round corners).

To make the pathfinding a bit more interesting for example, you could implement an algorithm to simulate the bot having to deduce or guess where you might be. The result of this algorithm would then be fed into the A* algorithm as the target destination for the bot.

etc, etc...

I hope that's helpful!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!