Ai

Mincemeat

Doomsday's Neighbour
Hi,

Just wondering if Eddie would like to divulge a bit on how the current AI works at the moment, and any roadmaps for its development going forward.

If any future AI state machines can be lua scripted, I think it will be a godsend to the mod makers... :D
 

eddieb

Vice Admiral
Mincemeat said:
Hi,

Just wondering if Eddie would like to divulge a bit on how the current AI works at the moment, and any roadmaps for its development going forward.

If any future AI state machines can be lua scripted, I think it will be a godsend to the mod makers... :D
So the AI now is pretty dumb. Basically, it is attack unless we need to recharge guns or we have very little shields.


Code:
void ship::moveAI()
{
  shouldavoid = World::getWorld().getObjectToAvoid(this, avoidlocation);
  if(shouldavoid)
  {
    avoidCollisionAiState(avoidlocation);
  }
  else if(goal == SHIPGOAL_ATTACK)
  {
	if(shouldRecharge() )
	{
            avoidFighterAIState();
	}
	else
	{
           attackAIState();
	}
  }
  else if(goal == SHIPGOAL_FORMWING)
  {
    formationAIState();
  }
}
There's much work to add on the AI. Right now I have a path followingAI that isn't being used yet. Basically, you draw a series of lines in space, and the AI will follow it. This will be used to implement higher level maneuvers.

For higher level maneuvers, first you have to figure out what state you're in. Once you figure out the state, you choose an appropriate high level maneuver. Here are my notes on this


collision avoidance
CHUNK "ATTK" // I can attack
{
cstring "attack" // just point to them and shoot
cstring "chaseattack" // try to attack from behind
cstring "attackflee" // attack quickly, then afterburn away, repeat
cstring "componentattack" // oval around capship, the afterburn away
cstring "turretattack"
}
CHUNK "MISL" // missiles after me
{
cstring "launchchaff"
}
CHUNK "GUNS" // guns after me
{
cstring "rolloutavoid" // alternate combinations of rolling
cstring "pitchavoid"
}
CHUNK "AVDF" // avoid their fighter, may be in front, but we want to avoid due to low armor/energy
{
cstring "pitchavoid" // alternate combinations of vertical motions
cstring "yawavoid" // alternate combinations of horizontal motions
cstring "flee"
}
CHUNK "AVDC" // avoid capship
{
cstring "capshipflee"
}
CHUNK "CHAS" /// they're definitely behind us
// they're targeting me, distance < mindistance, they're behind
{
cstring "loop" // a circle, pull up
cstring "flee"
cstring "yoyo"
cstring "barrelroll" // do a corkscrew. Roll while pulling up
}

If anyone has any better ideas on what these high level maneuvers look like, or any concrete AI suggestions let me know. I haven't implemented any of these high level ideas yet, except path following.

Once I get them going, probably path construction, goal switch, docking, will be scriptable, but that's only after I've gotten the basic maneuver choices coded up.

The low level AI is based on the work of Craig Reynolds called Steering Behaviors.

I'm relatively happy with collision avoidance now, the formation flying is ok, but I still need to get them the banking aligned a bit more.
 

Mincemeat

Doomsday's Neighbour
Just some scatter-brained notes:

1/ I'm imagining that paths will basically become a series of coordinates in 3d space that the AI ship will try to reach in sequence? If for example the maneuver is a corkscrew, a slow ship and a fast ship will end up doing an identical corkscrew?

Perhaps therefore a combination of path following, "keystroke logging", and special behaviours (eg. face your target) should constitute each high-level maneuver.

2/ I think it would be good if somehow each high-level maneuver can be overridden per shiptype (eg. all Dralthis rarely yaw) and per ship instance (eg. Ace pilot) within a mission.

I hope this is useful...
 

Kyran

Rear Admiral
Mincemeat said:
2/ I think it would be good if somehow each high-level maneuver can be overridden per shiptype (eg. all Dralthis rarely yaw) and per ship instance (eg. Ace pilot) within a mission.
Like a set AI script?
 

Iceblade

Admiral
Eddie, man.

I haven't been too much about the AI's fighting until now when I met the skate. The enemy has this problem with getting too close to your rear. I can't turn around anywhere near fast enough to even see them. All I am asking for is a tweak to the AI so they will not invade my ships' mesh.
 

eddieb

Vice Admiral
Yes yes, I'd love to improve the AI too. Right now the focus is on turrets, although I haven't had much time lately.
 
Top