im trying to make a subway surfer based game. It is not an infinite runner. but my question was how do i instantiate the objects properly? the distance between the objects should be hard coded, but on which lane the objects should be is random.
and it must be in c#
In Subwaysurfer they actually seem to have predefined sections which they simply put together in a random order. Placing seperate objects distributed in 2 directions is very hard to do since you have to do a lot of checks if there is actually a runable way through your objects. If there’s a dead end you have to replace one element with a ramp or delete it.
I play a lot Subwaysurfer and it’s definitely predefine sections. The predefined sections have to be designed in a way they can be put on every other section. An alternative would be so each section type has a list of possible successors.
Predefined sections also have the advantage that they represent a single drawcall since all geometry is in one mesh. To me it feels like each section has some hardcoded and some additional moving-train spawn points.