Advertisement

AI character Contol

Started by March 25, 2010 03:26 AM
2 comments, last by evren bingol 14 years, 8 months ago
Say you can posses an Ai characters which uses a FSM during a game.And you want to control him and you want him to , say, dribble a ball. Would you key presses/ joyistick hits trigger the necessary states like, drrbble the ball state. Or would you disable the FMS totaly and write a new logic piple for controllign the character while possesed instead of using the code which AI characters use when they are not possesed. So to make it clear would the AI still run while it is possesed in parrallel or you disable it. THanks
A good approach which I've made use of is to decouple the actor (character) state from how it's controlled. In essence, you would treat an AI character in exactly the same way as you would a player character -- the vast majority of the game logic can tell no difference between the two. However, behind the scenes each actor has an associated controller. The controller is responsible for telling the actor what to do. Using this approach you could have one kind of actor, and two kinds of controllers - human and AI. The human controller issues commands based on user input. The AI controller receives some kind of sensory input and alters the FSM state accordingly. Then it issues commands based on the current state of the FSM.

Another benefit that comes out of this is that you can switch controllers during runtime. Want to create an animated cut-scene? No problem. Just replace the HumanController of the player's actor with a CinematicController, pre-programmed to act exactly as you want it to. When the cut-scene ends, switch back to human control.
Advertisement
Yep, its important to separate the animation and the logic. An interesting fact, revealed at a GDC roundtable a couple years ago: AI characters in FIFA are controlled completely through a simulation of the player's game pads.

So for them it looks like:

Human->Input layer->Animation layer (in the case of a player)
AI layer->Input layer->Animation layer (in the case of an AI)

Many people think them mad to go this way, but it ensure than the AI and the players have the exact same capabilities.
Thanks guy for all the replies.
That's what i was thinking too but just wanted to make sure.

This is was for a soccer game i am working on. One person project.

So i did everything from animation to rigging to AI.
So animations are terrible because it is programmer art and i dont have time to work on the arts aspect.



but here is an early stage of the game i have been working on it for one month.
and It is terrible.

Thanks a bunch .

This topic is closed to new replies.

Advertisement