Royal Run
A medieval endless runner with a procedurally recycled course. I built a chunk-recycling treadmill, difficulty that couples run speed to world gravity and camera FOV, New Input System movement, and a Pickup inheritance tree - all racing a countdown.
Playable Open the WebGL tab to play it in your browser.
-
01
Generation Chunk-Recycling Treadmill
Built an effectively infinite track from a small pool of chunks - spawned ahead, slid toward the camera, and recycled to the far end once they fall behind it - with a checkpoint chunk forced in at a fixed interval to pace the run.
LevelGenerator.cs -
02
Generation Procedural Prop Placement
Programmed each chunk to dress its own three lanes at spawn - a random count of fences, an occasional apple, and coin clusters - drawing from a shrinking list of free lanes so two props never stack on the same lane.
Chunk.cs -
03
Difficulty Speed / Gravity / FOV Coupling
Coupled one speed-change call to world gravity and a Cinemachine FOV widen with a speed-up particle burst, all clamped to a range - so eating an apple to accelerate or clipping an obstacle to slow down is felt, not just measured.
LevelGenerator.cs·CameraController.cs -
04
Input Rigidbody Lane Movement
Built movement on the New Input System, applied in
FixedUpdatewithRigidbody.MovePositionand clamped on both axes, so the runner weaves across the track and edges forward without ever leaving it.PlayerController.cs -
05
Pickups Pickup Inheritance
Wrote a
Pickupbase that owns the trigger and exposes a virtualOnPickup- coins override it to add score, apples to speed the course up - so any new pickup drops in by overriding one method.Pickup.cs·Apple.cs·Coin.cs -
06
Loop Time-Attack & Hit Feedback
Built a countdown that ends the run by slowing time to a crawl and locking the controller, with falling obstacles on an accelerating spawn timer and a cooldown-gated hit that slows the course and fires a hit animation - so a mistake costs momentum, not an instant loss.
GameManager.cs·PlayerCollisionHandler.cs·ObstacleSpawner.cs