How to make dead rails infinite road generation

Hello. I want to make an infinite road generation game like in dead rails. How would I do that.

Add a rail each time a specific magnitude is met.

1 Like

Make it so once the player passes a certain point on the rail, generate another one. It’s best to tweak it according to how far the player can view to create a smooth transition, giving the illusion that the track is infinite.

1 Like

Similar to how room generation is done, you’ll want to have the default baseplate in ReplicatedStorage, where it can be cloned and positioned using :PivotTo().

For performance reasons, dead rails doesn’t pre-load every baseplate upon joining, I would assume each baseplate has a magnitude detection part, something along these lines:

if (Character.HumanoidRootPart.Position - hitboxDetection.Position).Magnitude < 100 then 
-- Clone & position new baseplate
end

You would have this wrapped in a RunService connection so it constantly checks and updates the magnitude.

2 Likes