Megafuzz Dev Blog

Nerdy rants on programming and game design

Unplanned Features Part 3: Swimming

Diving Into Another Unplanned Feature


While Ronn For Your Life will primarily be level based with a fairly linear path throughout, there will also be elements of freeroam exploration. There will be optional paths that can be taken - which may result in additional quests, rewards, or maybe just a goofy easter egg. Thinking of how to add more verticality to said level design, it occurred to me that, even in a platformer, verticality doesn't always have to mean higher... And with that, underwater exploration was added.

The player can now go for a dip in the water. He can opt to remain around the surface level and just swim around to get across the pond, but he can also dive into that pond to see what mysteries lies beneath. Oxygen will be a factor in how much and how deep sea territories can be explored, and this is directly tied to an upgradeable swim skill, which will not only affect the speed with which you can swim and dive, but also for how long you can hold your breath. Higher swim skill will make you overall more efficient in water, and thus able to explore deeper reaches of the dark blue below. Maybe even find sunken treasure...

 

Feeling Floaty


I wrote an entirely separate movement and physics system for the player utilized for in and under water. While on land, his movements are extremely responsive and instant, then while in the water, he's much more "floaty". He's got acceleration and deceleration, and if he breaks the surface with high velocity, he'll be thrown deeper into the water before automatically slowing to a stop, as opposed to if he just carefully dipped in. This really makes a huge difference in making it feel much more like its own little area of the game, and it feels as if you're swimming - which obviously does (and should) feel rapidly different from moving around on land.



Getting That Ocean View


Getting the visuals of the water right is also quite a challenge. The waves of the surface are dynamically responsive to where you hit the water, making a splash not just where you land, but also having the size and rapidness of the waves generated be based on your current velocity.
The water is textured and gradiented, so the deeper you get, the darker everything gets and visibility becomes more of an issue. There's also a refraction shader going on, which is using the waves as application mask, meaning that it'll only make something appear wobbly if it's actually covered by water.
While the base for the water was initially based off an asset I bought, it has since been modified very heavily. The biggest challenge here was combining a standard refraction shader that was initially based on a static rectangular area with the very dynamic waves. A challenge indeed, but the effect is really worth it.

The visuals of the water itself still needs work. Here are some of the things I plan on doing to further improve the look and feel of water in Ronn:

  • Tweak the rigidness to find a balance between responsive and "wavy", but without looking too much like jelly, and preferably more like water
  • Add a small bit of "surface" line look to clearly distinguish the surface area from the "underwater" area.
  • Particle drop splashes on impact - lots of drops splashing up around the player
  • Totally different texture work and smoother, more subtle gradient

 

But these are all aesthetics and will come later - for now I've focused on getting the actual swim and diving mechanics to feel right.

What Do We Do With A Drunken Sailor?


All of this gives me a lot more options in terms of level design and content creation. I can do whole underwater sections, I can reward the player who opts to take the optional (or maybe more difficult) path - I can make alternate paths as a whole. One example early on in the game lets you confront an enemy head on, or alternatively, you can actually dive underneath the enemy, crawl back up onto land and sneak up behind the enemy for a massive surprise attack. It will take a bit longer because you will have to do a bit of swimming and diving, but in return it will give you the upper hand in combat. It opens up so many options, and I can't wait to utilize it.

Just think about it...

Sunken ships... Sunken treasures... And fish... Very, deadly fish.