Ocean Game

Simulation

Ocean Game is a small project I developed in the Unity engine using C# as a way of experimenting with Perlin Noise in a 3D environment as well as to learn about meshes and creating meshes through code. It generates infinitely as you travel through the world using the free flying camera.

The realistic buoyancy system which depends on the density of objects.

The world is procedurally generated and infinite in both its water and land.

Skills Used

Unity Engine

C#

Fusion 360

Development

I developed Ocean Game over the course of a few weeks using the Unity game engine. I also utilized Fusion 360 for models such as the rock, boat, and dock. All of the code was written in C# and some of the visual effects were achieved using Unity's Shader Graph tool. I also utilized Unity features such as its base physics system and its Mathf library for the Perlin Noise function.

Dynamic Buoyancy

Ocean Game features a complex but dynamic buoyancy system. Utilizing objects called "Floaters", force is appled to the parent object's Rigidbody according to each individual Floater's current depth under the water upwards similar to real water. As many Floaters as are needed (more for objects with a larger surface area) can be added to any object to give it this realistic effect.

Realistic Water Mesh

Ocean Game also features a runtime-generated water surface mesh. This is a mesh whos verticies and faces are being recalculated and rerendered each frame, simply adjusting the vertex's y position based on a formula involving cosine and sine using the vertex's x & z position as the inputs to create a smooth and continious ocean wave.

Procedural Terrain

Terrain in Ocean Game uses Perlin Noise passing in the x and z coordinates at each vertex of the terrain mesh to set the appropriate height of the terrain at each point. Through variables the amount of verticies in the mesh is adjustable for higher or lower resolution terrain.