games

games

seafarer

Unity, C#, HLSL

Unity, C#, HLSL

overview

Seafarer is an endless boating game produced by me and one other partner. We were inspired by the aesthetics of the video game Dredge and the calm nature of the game slowroads.io. We used Unity for this project and overcame many obstacles to get the main gameplay function to work. I was responsible for the infinite procedural terrain and biome generation, biome coloring, player movement, and distance fog.

details

The terrain and biome generation uses a tile (or chunk)-based system, with each tile generating a single subdivided plane for terrain. The heights of the terrain are determined using a compute shader (using CPU was causing too much lag) that contains noise functions for both sandy and cliff biome heights, as well as a noise function to determine biome. Tiles are generated and unloaded as players move around, for efficiency.

Distance fog is accomplished with a highly customizable post-process shader (requiring an extra URP rendering pass), utilizing Unity's sampled scene depth data and an exponential distance function inspired by this video.

Other implementation details:​

  • The player never actually strays far from the world origin, as it would cause too much lag; instead, the entire world moves around the player, who is kept around (0, 0).

  • This also meant writing the fragment shaders for the biome materials was a pain, as biome determination was accomplished with an inaccessible compute shader. Since world coordinates of terrain are kept around (0, 0), they can't be used in the fragment shader to obtain the right biome information, and backwards noise calculations were required to get the right biome.

  • We were originally going to use wave function collapse (WFC) to generate islands, but we were more familiar with infinite terrain generation through previously working on a mini Minecraft project in C++. We think the final result looks better than we could've achieved with WFC. For another project I've worked on directly implementing WFC, check out my Earth-ifier.