• Register
Post news RSS Replicated Wave Interaction and more - DevBlog #8 - Sails of War

Tobias here - Programmer for Sails of War! It’s been a while! In December we shared footage of basic multiplayer online gameplay and explained the designs and goals of Sails of War. In this blog, as mentioned in the last, we’ll be primarily displaying and explaining buoyancy mechanics but also delve into what’s happened since that last blog post. A lot has changed!

Posted by on

Sails of War Blog Header 8

Tobias here - Programmer for Sails of War! It’s been a while! In December we shared footage of basic multiplayer online gameplay and explained the designs and goals of Sails of War. We’ve both been rather busy, with Lukas moving, and other personal reasons impacting our work and timeline quite a bit.

However, we have been working on Sails of War with what time is available. In this blog, as mentioned in the last, we’ll be primarily displaying and explaining buoyancy mechanics but also delve into what’s happened since that last blog post. A lot has changed!

Buoyancy is one of the cornerstones of Sails of War, affecting the player’s ship on more than just a visual level. This system affects a number of aspects of the gameplay in Sails of War. It both adjusts the ship’s position & rotation, affecting not only aiming cannons but also altering the ship’s movement and speed. Buoyancy has now been implemented into Sails of War. More than a month of brainstorming, research, design testing, and prototyping was done before a completed system was fully laid out. We’ve looked at various examples of buoyancy that been demonstrated and discussed by the phenomenal Unreal Engine 4 Community. Unfortunately, none of these projects could be adapted or used effectively in an online capacity or integrated into existing systems. Thus we decided to design our system for buoyancy and wave interaction internally with some inspiration from some of these projects. Since December we’ve come from a static ocean with no effect on ships to a dynamic, customizable, scalable, and modular ocean whose settings are used to calculate both buoyancy and rotation.

A mathematical formula is used to obtain the height of a wave at a specific point in location and time. We’ve rewritten the Gerstner Wave Ocean Material from scratch to match the same formula in code allowing the calculations and visual aspect to be identical and function independently of, but synchronously with each other.

After obtaining the wave point it is used (and many others around the ship’s hull) to calculate the upward velocity of the ship. Currently, the formula and calculations are simplistic and are not actual buoyancy calculations. Rather as of right now we look at the current frame of the game compare the difference of the wave heights from that and the previous frame. Then add the difference to the velocity of the ship while factoring in immersion at that point. Once several other systems have been fleshed out this will be revisited and expanded upon to incorporate a more realistic calculation for buoyancy while ensuring that the result is fun but believable. Below is the debug visualization of the ship’s buoyancy. What is shown is the buoyancy points surrounding the ships hull forming an outline, the interior triangles, and the surface normals of the triangles. As well as the origin point of the ship itself.

Sails of War Buoyancy Blog Visualization

We adjust the ship’s roll and pitch after reading the wave height by utilizing a mathematical formula. This formula is used to calculate immersion, basic forces, and the surface normals of triangles that make up an outline of the ships hull at the waterline. These angles are then adjusted based on immersion of the triangle, combined together and averaged. Once this is done it is compared to the current rotation. From that comparison, we obtain the new rotation rate for the next frame by using values unique to each ship that create different results and behaviors. The result of all of this is a believable, smooth and adjustable system for rotation:

Most Importantly we’ve worked with Epic’s built-in replication system, adjusting parts of it slightly to get this system working in multiplayer without any issues with 8 players! Down the road optimizations will be made to the movement replication system for performance and bandwidth optimizations. One of the most important optimizations will be making pitch entirely client side, as it is only dependent on time and location.

In the future, we will incorporate more advanced mechanics and depth, pun intended, that the effects of Buoyancy, Waves, & Ship Design have on the movement of the ship. The speed of the ship being affected by whether the ship is going up or down over a swell, wave impacts, ship righting, and actual buoyancy formula calculations are several of the mechanics under consideration and design right now.

Other adjustments have been made. We have added an elliptical orbit for the camera as shown in this diagram:

Sails of War ShipCameraOrbit Diagram

When rotating the camera around the ship the player now follows a similar path to the elliptical shape of the ship itself, rather than being far away from the ship when looking at the left or right broadside.

Elsewhere we’ve been rather busy with under the hood overhauls of several systems. Weapon firing, reloading, changing and tracking ammunition has been entirely redone. This will allow for better performance, management, and expansion of the system if needed. The movement has also been redone entirely from the ground up to support buoyancy and rotation. We’ve also been rather busy quashing bugs and issues within the game itself. This has led to various other systems being redesigned, adjusted or replaced. From here on existing systems will not need to be completely overhauled or redesigned, everything from here on out will be new or expanded content or systems!

Stay tuned for images of the Frigate! Next up is the Ship Combat Milestone! We’ll explain and demonstrate not only aiming but also the various systems centered around combat including the effects of certain projectiles hitting specific areas of the ship, the causes, and types of sinking, damage resulting in flooding, flooding resulting in listing, the potential for fires to start, repairing and minimizing damage, and much, much more!

If you wish to read more about Gerstner Wave Calculations there’s a great article written by NVIDIA, which you can find here.

Special thanks to Unreal 4’s Ocean Community Project for its open discussion of ideas and implementations for buoyancy. You can find the forums for this project here.

Another amazingly detailed and in-depth set of articles are written by Jacques Kerner about his work on Just Cause 3’s Buoyancy and Water Interaction System. You can find them here and here.

Don’t forget to join the discussions on the offical Sails of War Discord. You can also follow us on Twitter and YouTube.

Thanks for reading, until next time
- Tobias


It's very interesting

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Post news
Related Games
Sails of War
Sails of War Arcade
Related Engines
Unreal Engine 4
Unreal Engine 4 Commercial
Related Groups
PC Gamers
PC Gamers Hardware & Tech with 749 members
Unreal Engine Devs, Modders and Players
Unreal Engine Devs, Modders and Players Fans & Clans with 699 members