1
Newbie Coding / Re: Artificial Intelligence
« on: August 08, 2012, 02:24:57 pm »
I think a better AI is something that can be done if we keep in mind that AI serves one purpose only:
Enhance the gameplay/immersion
Currently two things break the immersion/realism:
- AI getting stuck
- predictability
To fix this we don't need super intelligent code, but something that makes users believe it's intelligent.
Randomness is a big help here. If the AI has a list of reasonable actions and chooses randomly from them it will appear smarter.
Rember good ol' pacman, where the "AI" when at a junction chose randomly between moving towards the player or away from it.
It therefore on avarage chased the player but not in a game-breaking-impossible-to-beat way.
By giving different enemies different chances of choosing the direction of the player the programmers made the player believe some enemies were more aggressive than others
Randomness may also help prevent AI getting stuck. Almost any algorithm has weak points where AI can get stuck, but by randomly switching chances of getting stuck for a long time reduce drastically.
As another example:
In a FPS an enemy is running towards the player and we want it to dodge incoming fire.
one option would be to let the AI check for fire, determine dodge options, taking into account travel time, bullet speeds, ammo of player etc..
A much more CPU-friendly option is to assume the player is trying to hit the enemy and just randomly dodge left and right.
Most human players will assume the enemy is actually responding to their fire.
Enhance the gameplay/immersion
Currently two things break the immersion/realism:
- AI getting stuck
- predictability
To fix this we don't need super intelligent code, but something that makes users believe it's intelligent.
Randomness is a big help here. If the AI has a list of reasonable actions and chooses randomly from them it will appear smarter.
Rember good ol' pacman, where the "AI" when at a junction chose randomly between moving towards the player or away from it.
It therefore on avarage chased the player but not in a game-breaking-impossible-to-beat way.
By giving different enemies different chances of choosing the direction of the player the programmers made the player believe some enemies were more aggressive than others
Randomness may also help prevent AI getting stuck. Almost any algorithm has weak points where AI can get stuck, but by randomly switching chances of getting stuck for a long time reduce drastically.
As another example:
In a FPS an enemy is running towards the player and we want it to dodge incoming fire.
one option would be to let the AI check for fire, determine dodge options, taking into account travel time, bullet speeds, ammo of player etc..
A much more CPU-friendly option is to assume the player is trying to hit the enemy and just randomly dodge left and right.
Most human players will assume the enemy is actually responding to their fire.