I have some experience in developing all sorts of (small) games using Unity3D, I have a few personal game projects and I also work for a small game studio. The only subject in game development that I've avoided at all costs was AI, up until now. My other projects required just basic NPC algorithms, so i can't call that AI. On to my problem: I have 2 or more player opponents that have to shoot at each other, taking turns (think of a Worms game). They fire using a ballistic arc, adjusting firing power and gun elevation. The problem is making the CPU player to behave like a human player would, without using firing at random. I have, from other games, and algorithm that computes the angle and projectile velocity required to hit dead-on the target, but that would kill the opponent in the first few seconds. So i need a smarter, human like approach: fire a trial shot, smartly adjust to improve aim. Also account for wind direction and speed that affect the projectile.

After some AI research, I was thinking of using genetic algorithms, but i do not need a perfect solution to my problem (to hit the target in the first round) but rather a constant improving one. Also if the algorithm could be tuned for easy/medium/hard difficulty would be great. I do not necessarily need a complete solution, but a direction to dig to.

  • \$\begingroup\$ How about, determine a % of how often you want the computer to hit accurately, and adjust their aim randomly up to this %age. Or get the computer to fire the first shot randomly, calculate how far out they were, and adjust for the next shot (with a bit of randomness) by this factor. \$\endgroup\$ – Steve Smith Jun 29 '17 at 8:23
  • \$\begingroup\$ Hi, I've had in mind something like that, based on chances, but seems like cheating. Also the target is killed with just one shot, maybe two in the future \$\endgroup\$ – Daniel Ciolte Jun 29 '17 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.