Ideally the Sailaway world would be an exact copy of the real world, with the same water depths, the same landscape and the same buildings and vegetation. Of course this is impossible. The world is simply too big, the Sailaway Team is simply too small, and the available information is simply too scarce. We’ve decided to make more use of the enormous expertise that is present among the Sailaway sailors and intend to create a World Editor. This is what I am working on right now. I’d like to share my ideas with you and appreciate your input in case I forgot something or if you think a different approach would be better.
The World Editor will be a separate program in WebGL so it will run in your browser. Embedding it in the Sailaway executable would make the program and the user interface overly complex. The downside is that it will be an extra program to maintain and support.
There will be 3 different types of edits:
– terrain heights and water depths
– terrain texturing
– placing objects
World Edit Object
All edits are encapsulated by a world edit object. This world edit object will contain the id of the user, the longitudes and latitudes of the edited world section, whether the edit is published or not and a publication timestamp. If there are multiple world edit objects for the same area, they will be applied in the order of publication.
To allow 2 people working in the same area on different world edit objects at the same time, new height values are only stored when they have actually been changed with respect to the original height. This means you can work in the same region as long as you don’t edit the exact same location, because then the one published last will determine the terrain height for that position.
Of course there is the danger of someone pushing out weird shaped islands, drawing their name in the terrain, or making unintended errors. If this happens, you can disable those edits in the stack. If it was done intentionally, notify us and we’ll address the user to prevent future incidents.
The terrain heights are stored in a grid format that uses 2 bytes per sample. Since the range is -10000 to +10000 meters, the accuracy would be insufficient for detailed editing. For this reason Sailaway uses an algorithm where steps are smaller around 0 and bigger at greater depths/heights.
The current Sailaway terrain heights have a resolution of 30 meters. The world edit object will allow much higher resolutions, but the download size would become immense if even a small region like “The Netherlands” would be stored in a resolution of for instance 1 meter. It would mean a download size of 250 km x 150 km x 2 bytes = 75 GB. To prevent this, you can use multiple edits within the same world edit object with different scales. The best way to edit an area would be to start at a big scale and then create separate height edits for smaller regions where you need a high resolution. Here’s an example for the port of Rotterdam.
First you edit the whole region N51.91, E3.95 to N52.05, E 4.175. This region measures 0.095 degrees vertical and 0.225 degrees horizontal. The fixed grid size is 512 x 512 samples, which means 0.0001855 degrees by 0.0004395 degrees per height sample or roughly 22 by 22 meters.
This would show large saw teeth in the landscape at close distance.
To prevent this the next edit within this same world edit object could cover a smaller region.
In this case N51.955, E4.025 – N51.966, E4.055. At 512 x 512 samples, it would provide a resolution of roughly 2.5 meters. And you can go much smaller than that if you want to. The high resolution edits are only downloaded by users, when they are sailing at a close enough distance to see that amount of detail.
In texture mode you can paint the terrain by using a blend of predefined textures that are optimized to repeat without showing any obvious repetition. The edits are again stored in a grid of 512 x 512 tiles. The region that is covered by that grid is determined by you. This way you can quickly paint an entire desert, and create additional detail by adding world edit objects that only cover a specific beach. This works the same way as described under the Terrain Heights section.
The file format uses 1 byte per tile. Each tile can display up to 16 different textures, blended together by alpha in 16 steps. 16 x 16 = 256 = 1 byte. If the total alpha of all 16 textures adds up to less than 1, the original terrain texture that Sailaway uses + earlier entries in the edit stack will shine through.
Right now Sailaway reads the OpenStreetMap database to place buildings in the world. Plus we added some iconic buildings and structures at various locations ourselves (like the Golden Gate Bridge). To extend this and also allow for the creation of docks, jetty’s, dikes, sheet piling, trees, etc. it will be made possible to upload static 3D models. The required format will be .OBJ, which is very simple and straightforward and supported by most 3D editors. Each model will have only 1 material for performance reasons and .MAT files are therefor not supported. Instead, you will be able to upload a texture and/or specify a color in the editor. Transparency will be clipped by a cutout shader.
After uploading an object, you specify if it is a single instance object (like the London Tower Bridge) or if it can have multiple instances (for instance a tree). If it’s a multiple instance object, it will automatically become available for everyone to use after it is published. Once someone else uses it, you can no longer upload a new version of the same object. Placing the objects in the world is done by placing them on the map and adjusting the scale, rotation and color.