Gameplay/Systems Programmer
In Paddle Panic, I took on a lot of responsibility, but I worked mainly on everything pertaining to the water, from the visuals to the functionality. I also made the music for the game.
As a result, we were nominated for Mobile Game of the Year at The Rookies.
This project was created as part of the school curriculum.
The water in Paddle Panic used one of the simpler methods for a large body of water: The Sum of Sines approach. In this approach, a number of sine waves (often in the range 8-15), of different amplitudes, frequencies, phases, and speeds, are summed up. The result is a water-like surface. Unfortunately, we were targeting mobile with this game, so a lot of my hard work goes unnoticed.
*Note: The resolution here is way higher than in the actual game to properly show the surface.
The shader was written in Unity HLSL.
One of the main problems was buoyancy. Firstly, I had to approximate the volume of the vessel — this was done before play occurred. Then, I simply checked which of these points were below the surface of the water, and applied a force based on the volume that was displaced by that voxel.
To check if a point was above or below the water, I ran the same simulation on the CPU as well. This is perfectly fine since the (relatively inexpensive) code only has to be ran a few times per frame.
However, it was not that simple. In addition to this, the levels had winding paths and verticality. This presents a huge issue as you need to figure out how high the river is where you are.
Long story short, without any more advanced solutions, the vertices will have to be looped over to find the closest.
This project was highly flawed, but it got me very curious about more advanced implementations!
And my team got nominated for The Rookies Game of the Year for Mobile!
From my very flawed implementation, I was curious about how to make a true, proper ocean simulation.
For that, I used Tessendorf 2001, that uses the Fast Fourier Transform to generate waves — and fast. From Unreal's Insights feature, I can ascertain that the ocean takes a total of 1.1ms on my 3060. With a budget of 16ms, that hardly makes a dent at all.
This implementation uses Unreal's Niagara to run a compute shader to generate the ocean. The huge benefit is that the simulation time is constant for any size ocean. 4 detailed cascades are generated and then applied at different scales so that it more or less never repeats. This is the huge advantage of this system. In addition, one could use these generated cascade maps for a highly optimized buoyancy simulation, something I have not yet made for the project, but would love to in the future.