   AI for samurai game
  Hi All,I''ve reached a stage in my mobile game where I want to start designing the AI. The AI will be used by the enemy players, namely small japaneese fighters of all sorts.Can anyone supply me with a link to article/resources that would fit the game?BTW: It is a mobile game => it runs on mobile phones => limited power => Algorithms should be as simple as possible, even at the cost of "lesser" AI. 
  How can anyone help you when we know absolutly nothing about your game. Is it a platformer, a fps, an arcade game or what? For all we know, it could be Samurai Tetris... (exageration)Please provide details. ;Small samurai AI - note he is rather short. ;  why do you need to know anything about the game other than it's a samurai game to suggest AI ideas?basically you just want a state machine.  most game AI is state machines, simply becayse they are easy to code and easy to make sense of.so you basically just want some pretty basic behavior: switch ( opponentMove ) { case OPPONENT_IS_ATTACKING:    executeBlock(); break; case OPPONENT_IS_JUMPING:    executeDuck() or executeUppercutAttack(); case ETC:    do other stuff}[source]you'll then obviously want some kind of difficulty levels in there or skill levels or something.  so you can have the opponent react with the correct counter only if he rolls something higher than his skill.  you'll also want to set aggression levels in you opponents.  then you can choose your attack/defense based on the aggression level.  i.e. some opponents will hold back until you attack, others will attack you on site.the above is all written from a fighter type game perspective (like mortal combat).  you could easily apply it to a 1st or 3rd person game.  since it's a mobile platform i made a safe assumption that you're not trying to do a RTS game. :)-me [edited by - Palidine on December 17, 2003 9:35:52 PM];  I can tell you based on a lot of martial arts experience, including kenjutsu, kendo, aikido and jiu-jitsu, that there is a hell of a lot more to the weapon arts of the samurai than ''jumping'',''attacking'' and other high level descriptions of armed combat. Sure, you could take this very high approach to combat, but you could then swap the Samurai for a Norman Knight and there would be no difference in the style or outcomes of the battle. What makes kenjutsu different from swinging a broadsword is the manner in which the combatant stands, moves, holds the weapon, weilds the weapon and chooses their targets, etc., etc.Since this is a game for a hand-held device, then you should obviously simplify this... but you still want to look at combat further than a simple state machine. A heirarchical state machine might be a minimalist starting point. A fuzzy classifier would also be useful for identifying opponent strategies based on their actions.Of course, you could just have your AI cheat, but what fun would that be? Cheers,Timkin ;  Go with state machines.  Give the characters a set of attributes that govern how aggressive they are, how likely they are to attack, how injured/healthy they are, how afraid they are, etc (I guess you'd want to keep this list small on a mobile platform  ). At any given time a character will have a number of possible moves.  What you want to do is combine the character state with some randomness and the character's perception of the hero's state to determine the action the character will take.  Basically this could just be a sum of products, where each action is given a sum and the highest-valued sum is chosen and performed.  The sum might look like this:Let A = Agressivenes [0,1]    D = Damage [0,1], 0 = dead, 1 = full health    R = Attack ready [0,1]   offbalance, awkward posture, or ready for action?    C = Courage level [0,1]  0 = scared to death, 1 = not scared    M = Anger level [0,1]    0 = not all at angry, 1 = really mad    F = Does this character fight or run?  High = fight, low = run    Qi = Half-width of random variation range in each of the levels.  [0,0.5]    Wi = How much influence this factor has on the overall decision.    U(a,b) = Uniform random number on the interval [a,b]F = W1*U(A-Q1,A+Q1) + W2*U(D-Q1,D+Q1) + W3*U(R-Q1,R+Q1) + W4*U(C-Q1,C+Q1) + W5*U(M-Q1,M+Q1)   Then we consider the overall score and if the value is the highest among the others, we initiate the "stand and fight" action.  To include the character's perceptions of his enemies, subtract the above sum; for friends that are fighting with you, add the sum.  You might have things swing faster than linear if for example your side is really losing or really winning.  Note that it's not necessary to use the uniform distribution ( U(a,b) ).  You could also use a Normal distribution or Exponential distribution (or others) to provide the random variability.  Or you could vary the levels outside of the function altogether.  They're just there to provide some capriciousness to decisions so the characters don't seem like robots.  Just thought of something.  By varying the weights, you can then come up with a variety of different character stereotypes.  We can start by relabeling the weights with meaningful names:  W2 = Honor [0,1]; 0 = high honor, fights to the death; 1 = no honor, saves skin  W3 = well...got to go to bed.  Enough for now.    But you get the idea.   [edited by - bob_the_third on December 25, 2003 12:57:02 AM];  Thanks guys, you have been a great help!A free game for you all when it comes out 