Dynamic path creation for rail shooter?

I have no idea where to start and was hoping for some direction. Any ideas on what I should research for dynamically generating a path for a rail shooter during runtime? What I would like to do is have the path generate as Im flying. Is this recommended? Unsure if creating the path on the fly takes too much power. Im wanting to push this to tablets in the end. Any recommendations or direction would be awesome. Thanks!

It shouldn’t take too much power, especially if you only have the player moving along the path. I rolled a simple spline-paths (“curved lines”) solution for my game and even with 100 entities calculating spline points every frame there’s no noticeable performance hit. (not from the spline calculations, anyway. x_x)

iTween is a good already-built solution on the Asset Store.

If you want to build your own solution, check out splines (especially QR splines) for smoothed movements. You could also use simple point-to-point movements with e.g. lerp, but it’s a little harder to smooth movements with that (in my experience).

As for how to generate the path, that sounds beautifully tricky. You could raycast in the player’s current movement direction and, if they’re going to hit something, steer their spline away from the object (by nudging its endpoints away from the obstacle). You could attach “safe points” to obstacles, and use the safe points as spline nodes if they’re close to the player’s path. More setup on your part, but less math work on the device’s part.

Thanks Loius! Your answer has given me direction for which I was in need of :slight_smile: Going to go put together some POC’s. Thanks again. In my last game I found that iTween didn’t work so well on mobile device. Well it worked, just was a dog when lookin at performance, so I will prob try just writing it myself. Thanks again for the help.