︵‿︵‿୨ Indie dev / College student ୧‿︵‿︵♡ Check out my games! ♡Hook Line & Sniper: s.team/a/3143190Itch page: justin.1l8.itch.io
4 posts
I always love dynamic pixel art effects, so with my game being highly fish-centric, I spent a lot of time making the water look just right.
First, our starting point: just a semi-transparent Polygon2D. It has several points across the top, which I can move around to make interesting shapes. Note that, unlike some more complicated fluid simulations, I won't be simulating tons of water particles throughout the body of water. I only care about the curve that makes up the top of the ocean.
At this point, we already have a bit of the pixel-art look, since the whole game is drawn to a lower resolution texture.
Next step: adding interaction. I essentially model each of the polygon's points as a spring. Each point has a velocity, and based on its distance from the resting height, I pull it back according to Hooke's law. To make it look like one connected body of water, each point gives a bit of its velocity to nearby points.
Now, whenever the player enters or exits the water, I apply an impulse to the nearest point, and that's enough for some fairly convincing water :D
Finally: polishing up the visuals. To greatly improve the look of the water, I put the whole thing through a shader. I gave the water a pixel-perfect outline by checking if the adjacent pixels are also water. I wanted the water to have a shallow color and a deeper color, which I achieved by checking if there's still water several pixels above the current pixel. (To make it look more natural, this depth test is very subtly randomized based on the pixel's position)
This shader gives me a ton of room for other neat effects. For example, in the final product you'll notice there's a nice splash effect. This is just a simple particle system, but since it goes through the same shader, it blends with the water perfectly.
Since the game has 5 worlds, the shader lets me easily swap out the water's color palette to make each one stand out.
I'm super happy with how world 2's sun reflection turned out, which makes very heavy use of procedural dithering.
Thanks for reading my ramble <3 The game is on Steam now if you want to see the water for yourself!
i gave a goldfish a sniper rifle it yearns for violence :)
you can play the demo for free on steam! make sure to wishlist it if you wanna know when the full game is released!
i made a game about a fish with a sniper rifle grappling hook :)
i made a game about a fish with a sniper rifle grappling hook :)