Fast and smooth maps

Many of you may remember how the map would sometimes take a while to load or leave a white area while you were zooming and panning around. This was due to a series of downloads, data handling and image processing in a large number of simultaneous worker threads. One of the extra complexities was the enhancement of the contrast between deep and shallow water when the map was moved around.

The entire process has recently been redesigned. And here’s how it works:
The maps of Sailaway are not stored as 2D maps but as tiles with 900 by 900 height samples of the surface of the earth. Each tile is 0.25 by 0.25 degrees. These tiles are used to generate the terrain in the game and to deduct the map image.

The earth is 360 x 180 degrees, which means 360 / 0.25 x 180 / 0.25 = 1,036,800 tiles. If someone would zoom out to view the entire earth, roughly 1 million tiles would have to be downloaded and converted into a giant map image. To prevent such madness the data is also stored in copies with a lower resolution where 1 tile measures 0.5, 1, 2.5, 7.5, 22.5, 45, 90 and 180 degrees. When slowly zooming in from world size down to a detail of a specific port, all those levels are loaded and processed one by one, starting at the highest level of 180 degrees per tile down to the deepest level of 0.25 degrees per tile.

You can imagine this is a lot of data to download at run time and to increase the speed a bit we packed the top 6 levels of 2.5 – 180 degrees with the game, which is why the initial download when installing the game is somewhat big.

When you view a section of the map, it could be that you are looking at 1 tile, but as you pan the map, you will encounter a corner of that tile. Instead of 1 tile you are now looking at the 4 tiles that are located around that corner. In the old map window, we’d move 4 textures around behind the viewing rectangle when you were panning the map. In the new map window there are 4 static images layered on top of each other. Each will have the height map data of a single tile. If a pixel is outside the scope of the tile, it becomes transparent, allowing the image beneath it to show through. To the viewer, the 4 layered images appear as a single image that covers the viewed area entirely. This means that the conversion from height map data to a visual image (4 images) is now entirely done inside a shader and no longer processed in advance by the CPU.

Internal image layers to assemble the map
Map layers in Sailaway

Loading map tiles from the server is a slow process. Loading it from a local cached file is faster, but still not instantly. This means that the visible map will be loading at times when the user zooms in or pans around because the loader threads can’t keep up. Previously this would sometimes give white areas. In the new maps, there are 3 levels (of 4 tiles) and 1 base level (of 2 tiles) displayed all the time.
Basically this is a stack of layers with increasing resolution that each can transfer height map data into an image and may or may not be transparent to show the lower resolution beneath it. This way, the map may be blurry while a high resolution layer is loading, but it will never be white.

Bay of Biscay nautical map
Bay of Biscay zoomed out

Finally the contrast between deep and shallow water needs to be optimized. When you are viewing deep ocean together with a shallow coastline, the dark blue of the deep ocean may represent a depth of 4800 meters and the light blue of shallow water may represent a depth of 150 meters.

Nautical map zoomed in on Brittany
Brittany zoomed in

But when you zoom in on the coastline, the colors change. The deepest water is now 170 meters and the shallow water 0 meters. Previously the whole map image had to be recomputed in a background thread on the CPU. With the new map window all that happens is that new values for the deepest and shallowest point are passed to the shader. These 2 parameters are set every frame, which allows for the nice gradual contrast enrichment effect that can be seen now.

The cool thing about all this is that it took only a week to code, test and optimize this all, but it took a few months before the idea to use a special shader instead of CPU image processing to appear and evolve in my head. That’s game development: You are pushing to get something done in time, which then sort of works but is not optimal. And then later on when you take some distance and look at the same problem from a different perspective you see how you should have build it in the first place. Usually there is no time or budget for a full rewrite, but Sailaway is my passion and it fully deserves a little extra effort every now and then.


Sailaway Update V1.0.06 – Some more fixes and improvements

Hello Pioneers!

There has been a few small hot fixes silently deployed since we released v.1.0 of Sailaway and we have just released another one to tidy up some issues that have been reported since.

This update includes the following fixes/improvements:

  • When loading a boat that had the auto navigation set to “follow the laid out track” or was sailing in a challenge, the position was not updated correctly as the last auto-sail update by the server or the last saved position when you left the boat was only minutes ago. This should no longer happen.
  • A slider has been added to the video settings to adjust the field of view of the camera (default is 70 degrees).
  • The fog density at which stars are becoming blurry has been increased slightly.
  • The playback of the audio clip for flapping sails was restarted multiple times per second instead of playing it to the end and then looping to the beginning again.
  • Updated to the latest stable Unity release. This should fix a bug that occurs when using Airplay.

If you have a bug you’d like to report, please follow the guide for ‘How to report a bug’ and post a new thread in the Bug Reporting Forum.

Happy Sailing,

The Sailaway Team

Weekly Races – Landmarks!

Hello Pioneers,

To celebrate the end of early access and addition of some iconic landmarks, we’ve designed three races to make the most of them!

Note: All race descriptions start with this in game: “We’re celebrating leaving Early Access by revisiting our most popular long races with limited edition badges.

 

Sydney Harbour Short Race

Sunday 4th March – 04:00 UTC / 05:00 CET / (Saturday 3rd) 21:00 PDT / 13:00 JST
Est Distance: 5 NM
Est Time: 1 hours
Weather report:🌥 More detail[on.windy.com]

A tight race around Sydney Harbour finishing under the famous bridge. Keep an eye on where your next waypoint is as it is a twisty course.

 

New York Medium Race

Sunday 4th March – 20:00 UTC / 21:00 CET / 13:00 PDT / (Monday 5th) 05:00 JST
Est Distance: 20 NM
Est Time: 4 hours
Weather report: ☀ More detail[on.windy.com]

A race through Lower Bay and onto the Hudson in the most famous city in the World.

 

The Bosphorus Long Race

Saturday 3rd March – 10:00 UTC / 11:00 CET / 03:00 PDT / 19:00 JST
Est Distance: 60 NM
Est Time: 20 hours
Weather report: ☀ More detail[on.windy.com]

This is a race up and down the Bosphorus strait that runs between Europe and Asia.

Remember, if you don’t want to sail alone, you can look for a crew in the Multiplayer Forum, there are plenty of sailors looking for crew members or boats to sail with. Perhaps some of you more experienced sailors could team up with newbies and spread the knowledge?

Share your progress on Twitter and Facebook, and the Steam Forums – we’d love to hear what you think and how you got on!

Enjoy!

The Sailaway Team


Keep updated with Sailaway news
Direct via your inbox!

Subscribe to our mailing list and keep informed about all things Sailaway related!

Thank you for subscribing.

Something went wrong.