(Game) Artificial Intelligence

Hello, all. I am wondering how to implement AI in a game. Please do not respond telling me that this is a complicated and advanced topic because I know that. That is why I’m asking for assistance. Without going into much detail, I’m making an MMORPG where a player can elect to become a ‘Commander’ for his/her career and have AI units follow him/her around and attack what he/she attacks. I do not have the slightest notion of how this is supposed to work. I’m hoping someone here does.

P.S. - sorry for the long post!

where is long post?

Most AI are rule based ais. The agents read the info that they can from the world which follows through a chain of if then statements that produce desired outcome. Nothing really fancy here. With MMORPG pawns/pets simple go there and attack this and avoid objects is enough.

Ai’s that play chess, recognize images, show emotion are much harder.

I would recommend reading up on Finite State Machines (FSM) and Decision Trees since most basic game AI is likely to use one of these.

Try not to get too overwhelmed with the AI reference material out there because it can get quite complex, for games you normally just need basic techniques, rules and heuristics.

You have an advantage when implementing AI stuff in Panda because python is a very natural fit for solving AI type problems. :slight_smile:

And remember you just need to fool the player in thinking there is intelligence. Depending on the game design this may not be difficult or take much code.

In simple English most AI in games is either pathfinding with weights (degrees of importance) attached to decisions. Even some chess engines work like this.

SOmething like:

player moves.

npc=if player moves I move to spot beside him. Most weight.
if spot beside character is blocked then I move to spot behind less weight.
if spot behind is blocked I move to other side. Even less weight.
if other side is blocked I stay where I am. Minimum weight.

But then you can have some animations that show his frustration at not being able to move. Or even call up some text insults to the player.

This can be applied to enemies, defense positions, dialogue, how to get thru a maze, etc.

Of course you will need to code it. And even more so there are dozens of pathfinding AI mathmatical models outthere. And all have their strenths and weaknesses. Just look them up- but be prepared for some math.

JB Skaggs

as the proverb says: a line of code is worth 1000 words
you may download here a cool bunch of samples