A little project/demo replicating the movement from the Tribes games.
Includes:
- Jetpacking.
- Skiing.
- Propelling yourself by shooting explosive projectiles at the ground behind you (to be implemented).
- Terrain generation.
You just sorta fly and ski around at high velocities!
The terrain generation is a modified version of what Sebastian Lague implements in his "Landmass Generation" tutorial series - modified in ways I think makes for slightly cleaner designs and implementations!
It works via generating multiple layers (aka "octaves") of Perlin Noise and sampling a map of those noise values to determine the heights for a terrain. You can see such a noise map below in black and white - black gets interpreted as lower altitude, while white gets interpreted as high altitude.
We then apply colors based on this height map, making lowest altitude areas be oceans or lakes, and highest altitude areas be the peaks of mountains.
Lastly, we generate a mesh from the height map, where the height of each vertex corresponds to the value sampled at its location from the height map, in addition so some additional height mapping to make natural-looking terrain.
The terrain generates infinitely in chunks. This has been multithreaded for increased performance, and we also have implemented automatic level of detail models for the meshes based on the chunks' distance from the player.
We manually calculate mesh normals in orders to ensure smooth lighting between chunks.
Since the terrain generates a mesh, Unity makes it quite easy to generate a collision mesh at the same time. This allows us to implement a Rigidbody character controller for the player to fly around like they would in Tribes! The skiing has also been implemented and works by raycasting downwards from the player. If we hit the terrain, we take the terrain normal we're given and derive a vector downwards parallel to the slope of the terrain, scaling correctly with gravity in accordance with the laws of physics.
Raw noise:
Colored in:
Gif Demo:
GIF from the 2021-10-20 build: