Panorama is a new Valve-developed UI framework. It is heavily influenced by and closely resembles modern web authoring (HTML5/CSS/JS). It enables rapid development, high quality, and high performance interfaces as well as seamless integration with game content (3D models, particles, etc.)
Panorama is completely replacing Scaleform for UI development in Dota. For the Workshop Tools Beta, the front-end dashboard UI and new in-game Custom Game UIs are implemented using Panorama. The Dota HUD still uses Scaleform, but will eventually also be converted to Panorama. The Source 2 engine tools have a very different set of requirements and so are still implemented in C++ and Qt - they will not be migrated to Panorama.
- 1 Panorama Concepts
- 2 Scaleform in Custom Games
- 3 Authoring Panorama UI
- 4 Valve-Provided Panorama UI
- 5 Additional Topics
Panels are the building blocks of any Panorama UI. (In web terms, a Panel is basically an HTML element.) Everything you see in a Panorama UI - labels, images, buttons - is a Panel.
.XML (Layout Files)
XML files are the skeleton of your data: they describe what panels are in your UI and their hierarchical layout. They can be found here:
A complex Panorama UI is usually authored as multiple XML files for simplicity and clarity. (This also allows repeated elements in the UI to be authored in a single place.) For example, a scoreboard may consist of a "root" XML file for the main scoreboard layout, a second "team" XML file that describes how each team is represented, and a third "player" XML file that describes how each player on each team is represented.
.CSS (Style Sheets)
CSS files describe how the elements from your XML are presented. They can be found here:
Currently the best documentation for CSS is the panel details page in the Panorama Debugger
Similarity to the Web
If you're not familiar with web development, you can still benefit from the similarity. Most Panorama features are sufficiently similar to their web counterparts that searching online for documentation can be very helpful. If you want to learn more about web development, a good place to start is: http://www.w3schools.com/
Differences from the Web
- Some parts of CSS have been tweaked to make them simpler or easier to use
- Some web features are simply missing, due to lack of need or their complexity/cost
Scaleform in Custom Games
We will be deprecating the use of Scaleform for Dota Custom Games.
Scaleform will initially remain functional during the Beta, but Custom Games that use Scaleform or ActionScript will eventually stop working. We're excited about Panorama and think it will allow more people to author higher quality UI, but it's very different from Scaleform. If you run into missing features while converting your UI features to Panorama, please let us know on the Dev Forums.
Authoring Panorama UI
The root of any custom game Panorama UI is the Custom UI Manifest:
When running the Dota tools, XML, CSS, and JS files in the content/ folder are monitored like any other content files and auto-recompiled and reloaded when you make changes. (This will only happen when the UI is active - an unused XML will only be compiled once it's actually used.)
Panorama generally does a good job updating the UI to take into account these dynamic changes, but some changes are too drastic for it to correctly update the UI. If you are seeing unexpected results, you may need to reload your map (
dota_launch_custom_game ADDON_NAME MAP_NAME) to ensure the UI is fully refreshed.
The Panorama Debugger is an extremely useful tool for debugging your UI and learning how existing UI is put together.
- Inline style is not good practice but good for prototyping:
<Panel style="border: 1px solid red;" />(remember your closing ';' in the style!)
- If you're having a hard time finding your panel, it can be very helpful to add a temporary 'border: 1px solid red;' or explicit width/height.
$.Msg( "In function foo():", some_data );is your friend!
- You can use the 'dota_custom_ui_debug_panel <element_type>' debug command to force a type of UI to be visible when it otherwise wouldn't be. The element_type is a numeric value from DotaCustomUIType (eg. for end screen: 'dota_custom_ui_debug_panel 5')
Multi-language support in Panorama is described here: Dota 2 Workshop Tools/Panorama/Localization
Valve-Provided Panorama UI
As part of our example game mode "Overthrow" we created several new UI components that can be used directly for your custom game, or as a starting point to create your own unique UI. These are primarily designed to handle a wide range of team and player arrangements beyond normal Dota 5v5.
See Valve Provided UI for more information.
Custom Loading Screens
Custom loading screens are separate from the normal UI manifest because they are loaded earlier.
The loading screen is a normal Panorama XML and will be loaded from:
Custom Hud Elements
A simpler but less powerful API to display XMLs on clients directly from server Lua code.
||Create a new custom UI HUD element for the specified player(s). ( int PlayerID /*-1 means everyone*/, string ElementID /* should be unique */, string LayoutFileName, table DialogVariables /* can be nil */ )|
||Destroy a custom hud element ( int PlayerID /*-1 means everyone*/, string ElementID )|
||Add or modify dialog variables for an existing custom hud element ( int PlayerID /*-1 means everyone*/, string ElementID, table DialogVariables )|
||Toggle the visibility of an existing custom hud element ( int PlayerID /*-1 means everyone*/, string ElementID, bool Visible )|