Team Game Unity C# Scripting Design AI Shaders
OddestSea
Official website: https://www.oddestsea.com
OddestSea is a game about sailing in a dark, eerie sea, evading monsters, and restoring light to the mysterious waters. I worked to develop and publish OddestSea with a small team.
Contents
Overview
I've always wanted to make a game about sailing. I started this project in summer of 2018 for my Game Design BS capstone course at Indiana University. With the help of many talented artists and others, it release on Steam and itch.io in March 2020.
This venture into game development has been my most involved yet, and also ridden with mistakes.
I've worked on a variety of tasks in the making of this game:
- Programming
- Gameplay mechanics
- AI system and design
- UI system
- Physics implementations
- Art
- Visual effects (in-engine)
- Shaders (GLSL, Cg, HLSL)
- Scene lighting
- 3D modeling, rigging, and animation assistance
- Project Management
- Repository management
- Defining technical constraints
- Project architecture and organization
- Technical review and assistance for team
Buoyancy Physics
Simulating buoyancy has a range of routes to take. One method is to simply displace your "buoyant" object by the current height of the water, but this isn't very interesting, or dynamic at all. With OddestSea, I spent a lot of time researching, developing, and experimenting to find a method of simulating buoyancy to be realistic, but also still controllable. Ultimately, the balance between control and realism was the hardest thing to develop.
The basis of most of my work was from the excellent articles by Jacques Kerner: https://gamasutra.com/view/news/237528
I modified some systems and wrote my own code, but most of the theory is the same.
Overview
The basic concept of the buoyancy is as follows: On a simplified hull mesh, like the one shown below, apply forces on the triangles of the mesh which are submerged in water.
There are many details to do with how the hull mesh is processed, finding submerged triangles, calculating volumes, and applying forces. However, I will attempt to summarize the process. Here is a diagram that shows an overview of the process to apply buoyancy forces on the boat hull:
Forces
Here I will list the forces, and the parameters available to configure that can adjust the forces.
Buoyancy Archimedes' principle
This is the most fundamental force involved with the boat's physics. This force is applied to every submerged triangle; that is this force is applied to the boat on each triangle's normal vector to the surface .
where is the density of the medium (water), is the 'downwards' force of gravity, and is the volume of water above the triangle, defined as
where is the distance from the triangle's center to the water's surface, is the area of the triangle, and is the normal of the triangle.
Currently, there is not much here to configure outside of the internal physics calculations; its a fairly self-contained formula. The primary thing that is a variable in this formula is , the density of the water. Density being determined by . At standard real-world conditions of temperature and pressure, the density of water is approximately , which is what this parameter is set as in the game.
Resistance Coefficient
While the Resistance Coefficient is not a force, it's a important factor in the viscous water resistance force. This coefficient uses an very important quantity from fluid dynamics called Reynolds number, or , defined as the following:
where is the velocity of the submerged body (in this case the velocity of the boat), is the length of the submerged body (the length of the boat's submerged volume), and is the viscosity of the fluid. Viscosity, defined as is currently set to , the average value for real-world water. The liquid viscosity is exposed to the editor and can be configured.
Now for the definition of the Resistance Coefficient:
There are a couple constants here that could be allowed to configure, but they are pretty essential to the definition of the coefficient.
Viscous Water Resistance (Frictional drag)
Viscous water resistance is the frictional drag that occurs when a body (the boat) passes through the water, and the body drags the water along with itself.
where is the density of the water, is the speed of the submerged triangle, is the area of the submerged triangle, and is the resistance coefficient.
Nothing here can directly be configured, other than the liquid viscosity used in the resistance coefficient.
Pressure Drag
This is a very important force, primarily affecting turning and drift of the boat in the water. This force is split into two variants, which apply force on a triangle depending on a property , the angle between the triangle's normal vector and its velocity , which is negative if pointing in the opposite direction, and positive if pointing in the same direction.
The definition for the drag that is a 'pressure' (positive ) is as follows:
where is the falloff power of the facing dot product (pressure), and are linear and quadratic pressure drag coefficients, and is a reference speed. The reference speed is to make it easier to tune the drag coefficients. The falloff power is very important. It controls how fast or slow the drag 'falls off' when the triangle's normal transition between parallel (peak drag force) and point velocity (no drag force). All of these are configurable in the editor.
The definition for the drag that is a 'suction' (negative ) is as follows:
where is the falloff power for suction, and are linear and quadratic suction drag coefficients, and is the same reference speed. Again, all of these are configurable in the editor.
Slamming Force
Slamming Force is the response of the water to sudden accelerations or penetrations from the boat's triangles.
where is the acceleration of a triangle, is the maximum acceleration of a triangle, is the power to ramp up the slamming force, and is the same as seen before in the pressure drag force. Both and a special ``cheat" parameter called used to multiply the slamming force result, are configurable. Additionally, is defined as:
where is the mass of the boat, is the velocity of the triangle, is the triangle's area, and is the total area of the boat.
WORK IN PROGRESS...