Mistakes. Nothing is worse than an AI opponent who can headshot you from fifteen miles away, or always picks the perfect winning strategy. It breaks the immersion and makes it apparent that you’re playing a routine. Mistakes can make the AI seem more human.
Many FPS games force the AI to miss with its first few shots, warning the player that the AI is there, before going for the kill.
Strategy games could sometimes select a suboptimial strategy, or when evaluating threats may purposefully ignore some proportion of them.
A racing game I worked on calculated when the player was nearby, and then rolled a dice to make the AI cars in front of him understeer through the corner or blow a tyre. It was praised for its realistic AI.
However creating imperfect AI is still something of a challenge. You have to make convincing mistakes, at a convincing rate, rather than perform perfect action after perfect action until making a ridiculous blunder. That can be even worse than playing just a perfect AI. For instance, the programmer working on the racing AI above spent a lot of time on modelling how a car understeers, and what inputs the AI needs to make to cause a convincing understeer. As always, playtesting is vital.
Here’s a good article on what goes into producing these kind of mistakes:
Others have talked about AI, logic, planning, and the importance of making mistakes. And all of these are good and useful in the development of AI.
But the question was about what makes a computer opponent feel alive, and that isn’t achievable through AI. It just isn’t. Players don’t judge a character in a game based upon their strategic level choices; they judge it based on much smaller things.
To make a computer opponent feel alive, what you need is a comprehensive set of high-quality animations and sounds (vocals, especially) for the opponent. The player can’t see the AI. He can’t hear it, he can’t experience it, he can’t know what the opponent is thinking. The appearance of “this character is a living entity” is presented to the player entirely through the animations playing on the character, and the sounds being produced by the character (which again, will mostly be vocals).
It’s important for the character to react to stimuli around him; to look at things nearby, to touch objects nearby (when appropriate to do so), to appear startled when surprised, and to show other emotions when appropriate.
When talking about these things, it’s important to minimise repeats. If the character uses the same “attack” animation every time he attacks, he’s never going to feel alive. If he plays a single looping “idle” animation when he’s not doing anything else, he’s not going to feel alive. If he says the same voice quip twice (especially consecutively), that breaks the illusion that the character is alive.
And that’s pretty much it. If the opponent that you’re trying to make seem alive is physically present in your game, then your success at making them seem alive will mostly be determined by the graphics and sound shown to the player.
If the opponent that you’re trying to make seem “alive” isn’t actually present in the game, as is the case in Chess and StarCraft, then feel free to disregard this reply; your best bet is to follow the AI-focused replies.
Here’s a list of some simple concepts that can make your opponent more vivid:
Give the player some way of divining the ‘intent’ of the AI. This could be as simple as having them yell out “Quantity over Quality” before attempting an accurate headshot attack, “Flank him” while attempting to get behind you, or “Take the leader, nothing else matters” before attacking the protagonist. You could also get more complex, for example, have them give some sign language to their teammates, then change the behaviour of those teammates.
As the opponent gets closer to death, you can give them a sense of desperation. Change their tactics at certain health milestones. Make their later stages more panicky, with greater risk taking on their part (going for the hail mary, rather than slow chipping). Visually communicate this as well (more exaggerated animations, pulsing veins, etc).
Go out with a Bang.
Give them a death that makes the fight with them something worth repeating. Grunts keel over animatedly. Bosses soliloquize. If it’s a proud character, make them refuse to give you the kill, and deal the last of their damage to themselves. You get the drift.