Jump to content

Implementing Range Visualizations

Recommended Posts


I have been working on adding range visualizations, starting with auras (ticket #4349).

The code is currently on Phabricator (D238), but right now the patch needs to be refactored in order to make the range visualization code more generic. This will be done partly by moving some of the new C++ in the patch to a new Javascript component (RangeVisualization).

I wrote up an extensive summary on Phabricator, but basically the patch allows adding a unique line texture, texture mask, and line thickness to the JSON files of range auras, which will be rendered when entities are selected (like the selection overlays). If none of these are specified in the aura's JSON, then defaults will be used (the default line texture being the one used for building selection overlays). The patch also adds a config option to allow disabling the rendering of aura ranges, and also a hotkey to toggle the option in-game.

If an entity has more than one range aura, then all of them will be rendered, which raises some questions on how to handle auras that have the same range (currently, this is only an issue for one hero unit).

Right now, there is a bug in the rendering code for selection overlays (#1368), which use SOverlayQuad, that causes them to clip through terrain, and so this limits the visualization texture to a simple line. "Fancy textures" that use SOverlayQuad (like those demoed in Delenda Est) cannot be used for now, but they can certainly be used for range visualizations once the terrain-clipping bug is fixed. There was some discussion on this bug, and visual ranges in general, here:

Here are some screenshots for auras, though they are rough, as the patch is still in progress.


This next screenshot is an example of a unique line texture for the aura of a hero unit (a spiral).


Eventually, range visualizations can be given to defensive buildings like defense towers to show their ranges - there is another trac ticket for this. Also, it might be nice to show range visualizations in placement previews.

There are still some design decisions that need to be made regarding range visualizations, and I have been discussing this with some of the developers. One in particular is the possibility to give civilizations their own unique textures (this would require a lot of new art). Also, there are a lot of possibilities when it comes to hotkeys, as there could be a hotkey that toggles the persistent rendering of the range of certain units - regardless of the config option (for example).

Edited by Sandarac
  • Like 4

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now