Did you ever think about developing a game that is taking place in a real-world environment? In an environment that isn’t limited by the borders of a town, nor a county, not even a country, but the whole globe? Are you a Unity developer or willing to consider Unity as the engine for your game? If your answers to these questions are positive, VTS Landscape Streaming Plugin for Unity might be the technology you need. A free and powerful streaming engine that together with vts-backend, an open-source library gives you the power to bring any geospatial datasets, from local to a global level, into your Unity application. The plugin natively supports Windows, Linux, iOS, macOS and UWP. However, the open-source nature of all VTS technologies enables you to build for basically any platform. Want to learn more? Just continue reading.
Disclaimer: This tutorial was done using the latest Unity version: 2020.1.0f1 Personal
HOW TO CREATE A VTS PROJECT IN UNITY
step by step
- Create a new project in Unity Hub, select 3D template.
- Go to Window - Asset store.
- Find ‘VTS Landscape Streaming Plugin’ and click ‘Add to my assets’.
- Go to Window - Package Manager.
- In the top left corner dropdown menu, select ‘Packages: My Assets’, where you should see all your added assets.
- Pick ‘VTS Landscape Streaming Plugin’, click ‘Import’ in the bottom right corner.
- A pop-up window will prompt you to select what components of the plugin you want to install. Leave everything to default values and click ‘Import’ in the bottom right corner of the pop-up window (called Import Unity Package).
- Save the project. All done.
BASIC USAGE OF VTS PLUGIN
The VTS directory can now be found in Project Window. It is composed of:
- Demos: contains sample scenes / applications
- Documentation: contains basic documentation
- Plugins: contains precompiled binaries for supported platforms
- Resources: holds definitions of basic objects such as Materials, Meshes, Shaders, etc.
- Scripts: holds, surprisingly, scripts
The best way to get started with the VTS plugin is to explore some of the sample scenes in the
Demos directory. These demonstrate some of the important concepts that the plugin employs and show the general approach of how the applications are built. Basic VTS Scene Hierarchy is composed of three main Objects -
Map Object is where you specify a map configuration file. The link to this configuration goes to the
Config Url parameter within
Vts Map script, and it has to be URL pointing to a valid VTS ‘map-config’. Map config is a JSON file that defines the map as a whole, including reference frame, all the data layers being used or map view presets. It is generated dynamically by a vts-backend instance. Explanation of how to run vts-backend and create a valid map-config goes way beyond the scope of this article. However, you can refer to these tutorials, that will guide you through the way to set everything up and running.
If you’ve gone through the basic demos and are still engaged and looking for further inspiration, you can look at the sample games for which you can find the source code on Melowntech’s GitHub. Firstly, there is a Fighter Jet simulator that lets the player explore the world from a pilot’s perspective. Secondly, a Driving game where you can drive a race car through the streets of the 3D reconstructed Danish town of Hillerød. The game also supports multiplayer. Finally, a zombie game VTSmaggedon, where you can attempt to save a city from a massive zombie invasion by crushing them under the wheels of your army recon vehicle.
Share with us apps, games, art or anything else you’ll create with us. We will be happy to test it! If you get stuck, reach out to us on GitHub, we’ll be glad to help.
Tomáš's expertise lies in computer graphics. His responsibility is vts-browser-cpp, the C++ client library forming part of the VTS 3D Geospatial Software stack. The library is cross-platform, and cross-form-factor and its applications include the Unity plugin, currently available in the Unity asset store.