The idea is to get a starting platform wher you can change the ship color. change to new ships. and changed the options.
This week I focused on making the movement limited around our track, so the player doesn’t wander off. This was quite easily done with a radius, and checking the distance between the player and the spline. Right now, it is a bit jittery at the edge, but I’m hoping I can resolve that in the production phase.
Here’s a gif of the constraints:
I also did some work with the camera. I found out that the camera won’t need a script at all. We just have an object following the middle of the spline, and we make the camera child of that object. The object will always follow the orientation of the spline too. Because of this, if we put that camera tracker in front of the player, the camera will rotate with turns, and the player can see the next potential obstacle.
This is what it looks from the side, with gizmos on:
Finally, I also did the items. This was a bit of a challenge, as I wanted to have orbs in clusters, whilst still following the orientation of the spline. What I ended up doing, is rotating the first orb with the spline, and using that forward vector to place the next orbs. The first orb is placed at a random location within the playable radius. There is also a UI element which keeps track of your score in the top left.
If you want an endless runner game you always want to surprise the player with obstacles to make it interesting and make it so that the player always needs to pay attention to what he is doing.We have 2 types of obstacles (force fields and lasers) that are being spawned with varying spawn rate and always a bit different. Eventually in later updates the difficulty will also change, now it has non varying variables but later it will change depending on how long you survive. The longer you live the harder it will become.
By having the forward vector of the previous controlpoint of the spline affect the position of the next controlpoint, this results in a more modest change of direction which gets even more smooth thanks to the algorithm. This little gif shows the change, I also made the spline regenerate once the player passes a certain progress limit.
So we decided to ditch the track-type generation since having a generation based on a spline and objects along that one would be a lot smoother. After trying to figure out how to make not even generate at the point bezier spline, I found an easier algorithm: the Catmull-Rom curve. which made it possible to just define controlpoints and the curve is calculated in sections along that curve, it’s a bit more performance heavy but it is a lot easier to generate randomly. Right now I have made the base script for the curve, a proof of concept generator (just uses random positions) and a very simple 1-way spline mover script. We plan on having the generation more smooth by value tweaking and maybe a little change in algorithm and make objects spawn along the spline. The player movement will also have the spline as mid-point so we can just work with offset changing for that. Here is a litle gif showing a generated spline and the walker script.
Added a basic UI. Right now, it only tracks score and health. The plan is to eventually have your ship look damaged when the player hits an obstacle, instead of showing it in the top left. The player will gain points over time and by collecting orbs.
I also added a basic main menu. Right now, it just has a play, options and quit button. Right now, there is only an audio option under the options, and you can’t actually change your settings yet.