Is there an algorithm to make ships take semi-circular patterns? I need something like the below image:

hypothetical fighters zipping around the (equally hypothetical) mother ship

Big Blue- Command Ship Small blues - fighters Red lines - path of movement

I want the fighters to zip around the command ship while avoiding obsticles such as space debris and eachother. I need at most a dozen fighters zipping around each ship and there would be up to a dozen command ships zipping around at a slower pace. All the fighters should return to the ship every once in a while for repair and rearming.

I chiefly need the circular path and I need to keep the path centered constantly on the command ship despite any movements. Are there any circular path finding algorithms? (and a better question; is there an official term for this kind of algorithm/path?)? Also note that I am developing this as an RTS for mobile, so the least expensive the operation the better.

  • \$\begingroup\$ You'll have an easier time thinking about this in terms of implementing simple orbital behavior for the drone ships (a "circular path finding algorithm" is just the equation of a circle), and adding basic steering avoidance (as with flocking behaviors) to that, probably. \$\endgroup\$ – user1430 Apr 19 '16 at 19:27
  • \$\begingroup\$ @JoshPetrie what I meant by "circular path finding algorithm" was essentially the orbital algorithm you speak of. I obviously never thought of it that way (and I am making a space game, so yeah) or I probably wouldn't have needed to ask here. The orbital paths would not necessarily be circles, and would be anything from ovals to triangles depending on the speed of the "mothership" and how fast they would have to move to keep up. \$\endgroup\$ – JDSweetBeat Apr 20 '16 at 12:37
  • \$\begingroup\$ They should naturally end up looking that way if they follow a moving object (the main ship) and have to correct for that plus avoiding other ships. \$\endgroup\$ – user1430 Apr 20 '16 at 13:53

Here is something that just popped into my mind: Have you seen the simulation of 3-body system? The two fighting ships can be two of the bodies, and a 3rd (invisible) body is there to create the chaos. Take a look at this video to get a feeling what it's going to look like in practice:


Also since you are not actually simulation a 3-body system, you should be able to change the parameters and customize the final look quit easily.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.