Best method to implement scrolling "infinite" landscape in top-down game

So I’m working on a top down ship shooter game (think galaga) that’s implementing 3d models for the landscape.

I currently have it where a piece of land scrolls beneath the player ship to give the illusion of moving forward, then when that piece gets to a specific point, create another piece right behind it, creating a seamless environment that infinitely loops. Then once a generated landscape leaves the viewport, destroy it so memory doesnt become full.

The problem is I want to be able to switch the landscape, for example, start off flying over a grassland model landscape then after defeating a certain number of enemies move to a city model landscape.

I’m not really sure what would be the best way to Implement the this. I have a blueprint for each landscape I want to scroll seamless on its own, but getting it to transition from one to another in the same fashion seems more problematic.

Any suggestions would be greatly appreciated. If any more info is need please let me know

1 Like

(Four-year-old thread, but I’m posting here for anyone that might find this in a search-engine)

You’re absolutely on the right track!

Since you’ve already succeeded in getting the land to spawn correctly, the easiest way to change land-types mid-game is to set an integer variable to track how many of your desired enemy actors have been defeated (let’s aribitrarily call it ‘BadGuysDead’.

Next, you’ll want to sort your environment elements by type, and put each type of land into its own array. Choose one land type to be the ‘base’ environment, that will always appear if no other conditions apply.

Increment BadGuysDead once for each enemy defeated, and when the integer reaches the target number, stop iterating over the current array and switch to that which contains your desired land type.

From here, you can set another integer to track how many of a particular land type have been created. Once the desired number of that land type have been placed, switch to another array (or back to your ‘base’ land type) and continue to place new elements as described above.

For further information, check out the Blueprint Endless Runner Tutorial at Endless Runner: Overview & Player Control | 01 | v4.7 Tutorial Series | Unreal Engine - YouTube, which does exactly what you’re requesting, and a bit more!

1 Like

I would suggest to create a struct with level information in it, it should contain the landscape to spawn and after how many enemy deaths it should be spawned.

Then setup an array with this struced in it and use this array + a kill counter to decide what landscape to spawn next. Additionally i would suggest to subtract the amount of kills needed from the counter after switching the tile to spawn so that it always starts to count from the beginning and you can just wrap around the array when you have spawned all your defined landscapes and the player keeps going.

Should look something like that
100 kills City
120 kills Desert
80 kills Ocean

Game starts with kill count 0 and landscape index 0 which leads to city landscape being spawned
when player kills 100 enemies increase landscape index to 1 which leads to desert index being spawned, reduce current kill count by 100
when player kill count reaches 120 increase landscape index by 1 to 2 which leads to ocean being spawned reduce kill count by 120
when player kill count reaches 80 increase landscape index byt 1 to 3 which is bigger then the number of elements in your landscape array so wrap around and set the index to 0 reduce kill count by 80

keep going :stuck_out_tongue: