Become the all-powerful Gunboat God in this fluid shoot 'em up. Carve the waves as you stylishly fight hordes of monsters in hundreds of quick-fire missions. Transform your Gunboat and upgrade your weapons, skills and abilities to take on giant, challenging, multi-stage bosses!
[h3][b]THE BEGINNING[/b][/h3]
It all started with a simulated line. A jostling, bouncing line of vertices intended to simulate a basic 2D water effect. Once that was complete, I planned to make a fishing mini-game as an exercise to become acquainted with GameMaker, as I was interested in learning a new game engine. But I quickly found that I enjoyed GameMaker’s workflow a lot, so naturally I started pushing the prototype beyond the scope of a mini-game, and added movement, jumping, shooting, enemies and *shudder* a menu system. Gunboat God was born!
[img]{STEAM_CLAN_IMAGE}/45053696/6391bfc63e64160a24077ca9889032591ffea9a8.gif[/img]
[h3][b]STARTING SOMEWHERE[/b][/h3]
Years later, it’s eye-opening to me how much stuff in the game there is to share. I struggle with that quite a lot; when I start thinking of content to post on social media, I get a strange sort of writer’s block where it’s nearly impossible to decide what to post. There are too many options! However, today I’d like to get my feet wet with my first blog post (pun intended) and show you some water physics.
[h3][b]BASIC WATER[/b][/h3]
Basic water simulation is achieved by adding a line of vertices across the screen, then imparting y force on any or all of them. This gets the vertices jiggling, but it looks wild and random, like an electrified scribble.
[img]{STEAM_CLAN_IMAGE}/45053696/d3f2da7abffd1021881564eb04307c4520d8746b.gif[/img]
To smooth things out, the vertices’ y force is constantly reduced by a small amount, and they also tug on their neighbour vertices. Much nicer!
[img]{STEAM_CLAN_IMAGE}/45053696/86c5841a044dd642c1490c7a2aed45d4b7466f53.gif[/img]
[h3][b]OPTIMISATION[/b][/h3]
Eventually I added 3 water layers with environmental detail to fill out the scene, and it was clear that the water instances needed to be optimised. So I set the number of vertices lower for the background layers, and higher for the foreground layer, although it’s very hard to tell. Each water layer only has a single “neighbour” pass. More “neighbour” passes would make the water look smoother, but no one is going to play this game on a NASA server, and again it’s basically impossible to tell, so no big deal.
[h3][b]SEAMLESS[/b][/h3]
Additionally, the water vertices need to be repositioned from one side of the screen to the other as the player moves around the scene, to make the water appear seamless. This repositioning happens off-screen so you never see it, but here’s a clip of shortened water to demonstrate the effect.
[img]{STEAM_CLAN_IMAGE}/45053696/1de15d31e56faf2769c35a254541c86dd8864a9b.gif[/img]
[h3][b]AWW, LOOK AT HIM[/b][/h3]
Now to add the boat.
[img]{STEAM_CLAN_IMAGE}/45053696/25a383f3a7a8ac869d1a23c8214a99da435c30a4.gif[/img]
[h3][b]REFINING[/b][/h3]
I experimented with a few different techniques for boat physics (eg: “sticky” adherence to water surface, or buoyant “slingshot” momentum on water surface), and the end result is a mishmash of all of them. The basic goals for boat physics were:
[list]
[*]Stay on the water surface when at rest; smoothly fall and buoyantly rise to adhere nicely to the water surface
[*]Left or right side of the boat dips down to stay “connected” to the water surface
[*]Leans to the opposite side when moving left or right
[*]Imparts y force on the water when shooting upward
[/list]
This is a short list but it was tricky to tweak everything to get it just right. I wasn’t completely happy with boat physics until about 2 years into development.
[img]{STEAM_CLAN_IMAGE}/45053696/8e0e310ba47dfc06ea09d7105dea5382bb1a7e16.gif[/img]
[img]{STEAM_CLAN_IMAGE}/45053696/88d562bd675b5a3b5ca6ee9d4c15b13bedb32690.gif[/img]
[img]{STEAM_CLAN_IMAGE}/45053696/01c4164d183b3234771c8508ce8029c3632153a8.gif[/img]
[h3][b]FINISHING TOUCH[/b][/h3]
The finishing touch was to have the boat slide left and right when on the side of a wave. It adds a bit of physicality to the game-feel, which is always welcome as long as it doesn’t get in the way of functionality and it “feels” right. I calculate this horizontal sliding by checking the angle difference of a range of vertices near the boat, with nearer vertices having more weight. The final value is imparted on the boat’s x movement.
[img]{STEAM_CLAN_IMAGE}/45053696/01b9a0489fb323b6e32c7cdd2d2dcd032a4c5aa3.gif[/img]
[h3][b]UH OH[/b][/h3]
It wouldn’t be a water-based game if we didn’t have big waves! Here’s the maximum turbulence setting, with a “rogue wave” hazard sweeping through the scene. This is my favourite hazard in the game because it’s fun to dodge, and it’s thematic so it almost designed itself.
[img]{STEAM_CLAN_IMAGE}/45053696/82f24e163cc0820024126ef5307cfe3e199ef199.gif[/img]
Best,
Tom