Create spaceship attack logic [and other logic eventually]

I am curious how to implement a spaceship attack logic. I have states set up to do checks for each “command” each ship is given, but am unsure how to code logic for attacks.

Some ships will have to “orbit their targets”, such as giant battle cruisers that have guns and armor on the sides, while others attack head on and then turn away to avoid collisions. The one I want to concentrate on is about fighters.

I want the fighters to do an “attack run”, they will circle the target (clockwise or counterclockwise) and then line up a run to go towards the target and shoot missiles and such, and then once they get close enough to veer off and repeat the action (not necessarily from the same angle of attack however).

I am currently using the “Arongranberg a* pathfinding project” for my game movement ai. I want to essentially create a kind of bezier curve that is centered around the target that the attacking ship follows to perform this movement. I also want to take into account of obstacles to left or right when deciding which way to turn when breaking away from the target after an attack run. How would I do this without too much overhead cost in cpu (as my game will eventually go to mobile).

My ideas are to generate two bezier curve paths (one for turning left out of attack run and one for turning right out of attack run) and then just switching to the appropriate path. I also want to accommodate for the ship moving (but i’m sure i can just use waypoint offsets like its parented to the target).
My other problem is to handle going clockwise or counterclockwise.

How would any forum-goers choose to do this, and can you provide an example code showing how to generate this waypoint path and how to modify it and switch between paths
(i’m assuming it would just be an array of vector3 arrays).

PS: I want to avoid using unity’s physics system as i want to maximize the number of agents i have and be careful in consideration for eventually going mobile so i don’t have to change a ton later).

PPS: [The style of attack i want is similar to aircraft fighters or spaceship fighters from Sins of a Solar Empire or Homeworld 2]

I’m making a starfighter dogfighting game and I’ve put a lot of thought into the flight paths of fighters and starships. I settled on letting the ambition of the “pilot” determine how the craft is steered. I put these on a stack and the various ambitions have successive priorities… So they start with “Patrol”, which has them steer towards a waypoint, and when they get close enough to it, they’ll steer towards the next waypoint in a course that’s set for them. If they detect an enemy, they’ll push “Attack” onto their steering stack, and pursue the enemy, steering to get a good angle of attack. If they get shot, they’ll push an “Evade” onto their stack (it’s high priority, but has a time limit of 10 seconds), then that’ll pop and they’ll go back to pursuing their target, or sometimes they’ll push an “Attack” specific to their attacker before they push the “Evade”.

Anyway, each of these steering actions has it’s own code for where to steer. Like I said, “Attack” is all about steering for a good angle of attack. “Evade” tries to fly wildly. Apart from patrol, there are no set “waypoints” or predetermined paths. The pilot chooses points in space to fly towards and then makes new choices based on the ambitions at the time.

Don’t know if that helps, but I think it makes more sense than the approach you described.

http://bytefluent.com/starfighter ← if you wanna try it.