Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What is the main concept behind scripting endless runners?

Asked by
alibix123 175
8 years ago

I want to make a game that is kind of like an endless runner (actually more of a procedurally generated race), except, you won't be running, you'll be flying through pipes/tubes and stuff. So my question is: How? The way I'm thinking is that I:

  • Make tube sections like: "Straight", "Right", "Up","Down" etc.
  • Have a part in the section that detects when a player leaves the section using Touched
  • Spawn the sections randomly using a table
  • Remove a section when all players are out of it somehow (maybe using a part)
  • Have a certain number of sections in a race that the code can't spawn anymore after the number has been reached

So does this look good? Is using the Touched event the best way to detect when players are not in a section? Because I hear things like RayCasting and Region3 thrown around so I'm not sure.

tl;dr The main concept or game loop behind endless runners/procedurally generated tracks

1 answer

Log in to vote
2
Answered by 8 years ago

You can do something like this

local sections = 0
local maxsection = 8 --Amount of sections until end

while sections < maxsection do
    --Randomly spawned tube code here
    sections = sections + 1
    if sections == maxsection then
        break
    end
end

That can start it off, then just use math.random() to either pick a random position to spawn a tube, or to spawn a random cloned tube from your game.

(This probably might not help, you might already know this :( )

Ad

Answer this question