Tuesday 24 January 2012

AI coding.

I will cover some topics topics for the unknowing, and ofcourse from my point of view and how I see it, wouldn't be fun otherwise.

First of all
AI:
Most people know that AI stands for artificial Intelligence, often called Artificial Stupidity, or in some cases "MOM!!! The computer is cheating!".

The ideal AI is made with the goal to behave like a person expects another person to behave. A quite hard task since a computer is where good a fixed states of rules, and reasoning but not so good with random behaviors or adapting to change. A person on the other hand is very good to behave randomly or eradict and most are atleast to some degree equpied to adapt to changes. Most FPS games, that are by design mostly skillbased, fast triggerfinger and good aim will make you better, are still beaten by a wellwriten AI, this is because the AI can see allways at once, it can snap it's aim to the first microsized piece of hitbox that appears, and it's aim is allways perfect.

Some will cry "I have seen the bots for CS, they sux lolollooloololoo HAX!" and yes they often do, because people want to be able to win. But people call this cheating because a human can't see all ways at once, I am not saying that the AI is looking trough walls, that would be cheating. It's more the fact that the AI might turn a full 360 degrees, register everything thats in it's field of vision and react to it. And it can probably do that, based on the engine, say atleast 30 times a second. So as field of view goes, the AI will register anything visible from it's point of view 30 times a second, I have a hard time writing this, with the screen in focus and trying to find the coke bottle on the floor at the same time. (it was in the living room)

Add on top of that the computers increadible power to calculate things in 3 dimensions, how did you think any game was represented, (one an average today I would bet over a million triangles worth of data are rendered per frame in a modern game) and an AI only need one ray, to know where to aim and shoot prefectly, some more work comes with grenades and slow moving projectiles like rockets and other things with an area effect.

So there are some decisions to take regarding to the AI, do we want it to be best at somthing, do we want it to adapt, do we need speed or strength, how much can we simplify without it being notised.

Simplification is the best friend of a AI programmer, and data that is ready to act on at decision time, the fewer things that needs to be updated, calculated and changed, the better.

In my current project since the AI is managing both your troops as well as the enemy, (the only different is how the orders are issued), makes it possible to cheat as much as I want, since no side will get an unfair advantage, but at the same time I need to make sure that it balances out with the decisions the player does get to make.Weapon layout, skills of team members etc, as well that it should looke esticaly pleasing in some way when you actually do see combat, in many cases I could just do some random rolls and be done with it, but since any point can potentialy be seen at any time it's better to do it well, and do it right.

No comments:

Post a Comment