In order to make my game infinite, I had to implement randomised spawns to the planets which allows the player to jump from planet to planet without any levels.
To do this I created a collision box on a actor blueprint which allows me to give the boundaries for the spawn location.
I then put the Spawner Box into the level.
Then I got the component bounds which will allow me to get the box bounds for the planet to spawn in.
Here are the vectors for the X axis of the box.
By connecting it to a Random float in range it allows for the coordinates to be randomised.
Then I repeated this step for the Y axis.
By adding a vector is allows me to connect the Z axis to the break vector Z, which makes the planet spawn on the centre level of the box.
I then added a spawn actor and classed it to Planet1. I do need to link other planets however.
I then added a timer which gives me control over how often the planet spawns. I also need to consider randomising this however to make it more difficult.
Here is a gif of the planet spawning –
What I need to do now is experiment with randomising the planets spawn timer in order to increase difficulty. Another thing I could consider is making the planets smaller up to a certain percentage as the player gets further, making it harder as time goes on. Also putting a variation of planets in the spawner is essential.