Getting Started with UE4 and Visual Assist

Whether you’re new to Visual Assist and UE4 or a seasoned vet, we thought you might appreciate a little more insight into what you can expect and how to get started. Thanks to our resident UE4 wizards for putting this together.

1. Install Visual Assist

  1. Exit all instances of Visual Studio.
  2. Run the .exe installer you downloaded.
  3. Select the IDE(s) you want to install to.

2. Open your game solution

Visual Assist will come alive after it finishes parsing.

3. Look around

Open the Extensions > VAssistX menu. You will use the menu primarily to open tool windows, review keyboard shortcuts, and access the options dialog.

Appreciate the understated UI to Visual Assist. There are just a few visible changes.

4. Change a few settings

If you like meaningful syntax coloring, open the options dialog for Visual Assist and apply coloring to more of the UI.

If you highlight the current line, choose a thin frame that doesn’t obscure your code.

Visual Assist can add important information to tooltips when hovering over a symbol, such as comments from base classes. This is very helpful in UE4, as base class comments are the documentation.

Visual Assist can analyze your code and suggest improvements. Enable Code Inspections to see blue underlines where code might be improved. Visual Assist can even modernize your code for you! We will show how later.

Then, open the options dialog to Visual Studio and eliminate the redundant navigation bar. The version in Visual Assist includes the functionality of the built-in one.

Disable built-in navigation bar

After making the changes, Visual Studio is ready to use.

5. Navigation in UE4

Search for and open files using Alt + Shift + O. Precede a search filter with a hyphen to exclude symbols (negative filtering).

Understand and navigate the inheritance hierarchies of UE4 by using Alt + Shift + G on a class name. The Alt + Shift + G shortcut works on many types of symbols, try using it on a virtual method.

Source files in UE4 can be thousands of lines long. Use Alt + M to search for and navigate to methods inside the current file.

Find references to a symbol using Alt + Shift + F. Visual Assist’s find references is fast and accurate inside huge solutions like UE4. Try cloning your results to save them by clicking the Clone Results button or using the right-click menu.

Hover over a virtual method to see comments from base classes. Base class comments often contain useful documentation.

6. Refactoring in UE4

Access refactoring tools using the keyboard shortcut Alt + Shift + Q, or by hovering over a symbol and clicking the tomato icon that appears. The contents of the Alt + Shift + Q menu depend on the symbol.

It is common in UE4 to override virtual methods, such as Tick or SetupPlayerInputComponent. Visual Assist can implement these methods for you. Click on your class name and then use Alt + Shift + Q.

The Implement Methods dialog is searchable, and you can implement more than one method at once.

Visual Assist will intelligently add a call to the Super class version of the method for you when appropriate.

You will see blue underlines below code which could be modernized. This is Code Inspection.

Visual Assist can refactor the code for you! Use Alt + Shift + Q on the underlined symbol.

If you need to change the return type, parameters, or the name of a method you can use Change Signature. Edit the method definition in the window. References and call-sites to the method will be updated, so you won’t miss anything.

7. Tips

There is a lot of special functionality built into Visual Assist for UE4, such as suggestions for U* macros. The more you can use Visual Assist, the more opportunities to make your life a little easier in UE4.

You may find the built in IntelliSense to be unusably slow, or that it often adds red underlines to correct code in UE4. IntelliSense can be disabled. Visual Assist provides all the intelligent tooling expected in a modern C++ development environment.

You can throttle the initial parse in the Performance tab of the Visual Assist options dialog. By default, the one-time parse uses all available resources to finish as fast as possible.

For more information or support check out our forum and documentation.

Some features mentioned above require the latest build, check here for updates.

Developer Showcase: Visual Assist in Action

If you follow our blog, you’ve seen the features that our team is putting in place and likely felt their impact in your development. Instead of hearing more of the same, we thought we would share thoughts from one of our users. Meet Distalsoft, two brothers, one who can’t stop gaming and one with ideas. We’re not sure which one wrote this post, but either way check them out when you want to hunt for treasure or lose it all attempting Brexit.

C++ with Visual Assist, Visual Studio and Unreal Engine

It’s inspiring that software like Microsoft’s Visual Studio IDE and Epic’s Unreal Engine have been “free” for so long now. It pains me to think about where indie developers would be without the forward thinking force of these larger companies and their seemingly never-ending generosity. Helping start-ups and the like to get their feet on the ground is something I will forever be grateful for.

Although the tools come close to it, it would be naive to think that they can fulfil the job of every requirement. I want to point out a few problems we were facing at Distalsoft when it came to developing in Visual Studio using Unreal Engine and the solution we ended up going with.

Unreal Engine at its core uses the C++ language. Visual Studio – being a Microsoft product – makes development in C# very enjoyable. On the other hand, development in C++ has been a point of frustration for many years. From VS 2010 to VS 2017, improvements have been made to the overall speed of compilation, Intellisense, file searching and the like, but it has taken until 2019 for them to really make a dent in the problem. I must say that VS 2019 has done an excellent job of addressing the aforementioned issues but the question still stands – could it be better?

A few years ago when I was using VS 2015, I’d had enough. I’d sometimes be waiting several minutes for Intellisense to bring back a list of methods or properties that belonged to an object. I’m pretty sure we’ve all done it – smashing the heck out of the ctrl+shift+space keys and cursing at the screen while waiting for the Intellisense to pop up. Or simple searches in the solution explorer that end up taking longer to resolve than simply finding the file yourself. Perhaps even trying to navigate to the definition of a method only to be waiting minutes for the document to load up. Something had to change. I went searching on the internet for a solution. It didn’t take long to stumble across a piece of software called Visual Assist by Whole Tomato. It had been recommended many times on various parts of the AnswerHub forum for Unreal Engine and StackOverflow. Due to it having a trial version, I downloaded a copy to give it a try.

The expression “night and day”, really doesn’t do the software justice but it’ll have to do for now. I was extremely relieved. Searching for files, definitions, even just including header files were now as you would expect from an IDE. The additional dialog menu that is available when right clicking on bits of code you want to perform actions against, has a variety of options that make you realise what was/is missing from the ootb VS. To be honest, I don’t use half of them, but it’s the baseline mechanics that just work so much better. And, to address my biggest issue – the speed of Intellisense – type-ahead now loaded within seconds and sometimes even instantly. What a relief!

Unreal Engine have improved their documentation, but unfortunately it’s still not quite there. I would always see people answer questions in AnswerHub with “Look through the Unreal Engine code, it’s open source”. I always assumed they were joking. Pressing F12 to go to method definitions without Visual Assist would take forever. Thanks to my new found friend Visual Assist, I finally had the ability to go find the answers to some of the most annoying questions. It’s hard to really communicate just how irritating it used to be. Seriously, Visual Assist has made me a happy C++ coder again.

I suppose the last thing to make note of is that Visual Assist is not currently free, but the trial is sufficient to make you realise just how much happier you can be when using it. I would be interested to see Visual Assist introduce a subscription based payment plan, but you can’t complain. They have done a stellar job at creating a brilliant tool.

So in conclusion, go check it out. See for yourself. You won’t be disappointed.

This blog was brought to you by Distalsoft. If you’d like for us to showcase what you’re building (better and faster) with Visual Assist contact us.

Visual Studio 2019 moves VAssistX to Extensions menu

Microsoft Visual Studio 2019 moved all extension menus, including the VAssistX menu of Visual Assist, to a new, top-level Extensions menu. According to Mads Kristensen, a Senior Program Manager at Microsoft, the menus were moved to “give the ecosystem more prominence and declutter the top-level menu when you have a lot of extensions installed“. That reasoning might be solid, but it does require an extra keystroke or click to reach extension commands.

In prior versions of Visual Studio, the VAssistX menu is opened via a single Alt+X. That shortcut, fortuitously, now opens the Extensions menu. In Visual Studio 2019, a subsequent X opens the VAssistX menu within the Extensions menu.

If you are a keyboard user of Visual Studio 2019, use Alt+X, X to reach any VAssistX command previously reached with Alt+X. And when you in the documentation for Visual Assist, know that you must use Alt+X, X every time you read Alt+X.

Those looking to restore old behavior in Visual Studio 2019 might find Extensions in Main menu useful. If you try the extension and want a single Alt+X to open VAssistX, use ‘Tools | Customize |Commands’ to change the accelerator key for Extensions, e.g. from &x to &i.

Speed up opening of editors when using Visual Assist in Windows 10 (Fall Creators Update)

Microsoft tightened security in the Windows 10 Version 1709 Fall Creators Update (FCU), but unfortunately, the tightening adversely affects the performance of applications that use the Win32 GetPixel API. Visual Assist is one such application so initial opening of editor windows in Visual Studio, when Visual Assist is active, can be extremely slow.

You can speed up the opening of edtor windows when using Visual Assist to pre-FCU levels by disabling Control Flow Guard for Visual Studio. Navigate to:

Windows Defender Security Center | App & browser control | Exploit protection settings | Program settings | Add program to customize | Add by program name

Be cautious and choose the exact file path(s) for Visual Studio, or disable protection for any application named “devenv.exe”.

Scroll to disable Control Flow Guard (CFG).

You might improve the performance other aspects of Visual Assist in Visual Studio, at least with respect to the effects of tighter security in the FCU, by disabling all 21 program security settings specific to the application.

Apply, and restart your PC.

You can improve performance of all affected applications in the FCU by disabling CFG at the system level:

App & browser control | Exploit protection settings | System Settings

Obviously, disabling a security feature has its own cost, i.e. less security. You can learn more about the slowness of the API at TenForums and in the Visual Studio Developer Community.

Filter using logical “or”

Many of the dialogs and drop-downs of Visual Assist allow efficient lookups via filtering. For example, filtering within Open File in Solution—a dialog with all files in a solution—lets one find a file quickly if only portions of a name are known. This means one can find veryLongFilenameInProjectTomato.cpp if he knows only “long” and “toma”.

Filtering takes many shapes. Aside from substrings, one can filter using simple expressions. Our expression syntax isn’t full regex but it is tailored to the content being searched.

In this blog post, I introduce searching using logical “or”.

Filtering using logical “or” is often applicable when searching VA Hashtags, where tags are created on-the-fly and often without standards. For example, developers might annotate code with VA Hashtags of the format “todo” followed by the name of the teammate who needs to review or fix the code, but names are entered as first names, last names, or misspelled variants thereof.

For tasks related to developer John Smith, we might find VA Hashtags in either of the following forms.

// #todoJohnSmith
// #todoJSmith

Filtering for “smith” in the VA Hashtags tool window easily finds both.

logicalOrSmithDialog

But a teammate might annotate code with only John’s first name.

// #todoJohn

In this case, filtering for “smith” won’t find the new hashtag. We need to search for “smith or john”, and we use a comma in our expression to do that.

logicalOrSmithJohnDialog

Then, our code might also include unrelated hashtags for John, e.g., a comment directed only at him.

// #John, I fixed this for you.

The previous filtering for “smith or john” will include the unwanted entry.

logicalOrSmithJohnDialog2

To omit the unwanted entry, we need to search for “todo and smith” or “todo and John”. We do that with multiple substrings and a comma.

logicalOrSmithJohnDialog3

This final expression using logical “or” gives us exactly what we want.

You can use expressions in all dialogs and drop-downs that support filtering, including the several that support logical “or”:

If you want to know more about expressions, study one of the features that supports logical “or”, then experiment in all the dialogs and drop-downs you encounter.

Logical “or” requires Visual Assist build 2062 or newer.

Quick Refactoring Menu of Visual Assist offers more than refactoring

If you use Visual Assist, you are probably familiar with its Quick Refactoring Menu—available via a hovering icon or the default shortcut (Shift+Alt+Q). But, you might not appreciate how frequently the menu is available. Quick Action Menu is a more apt name.

Availability aside, the Quick Refactoring Menu is an efficient method of tapping into the features of Visual Assist because the menu contains only pertinent actions; it’s always concise. (If you examine the “Refactor (VA)” submenu of the editor’s context menu, you will find all possible actions. The entries enabled in any one scenario are the ones in the Quick Refactoring Menu.)

Available actions in the Quick Refactoring Menu depend on what Visual Assist thinks you might do and where you are: in whitespace, in a symbol, or with a selection.

blogQuickRefactoringMenu

Browse the following list of actions that can appear in the Quick Refactoring Menu. Look for unfamiliar actions and envision scenarios in which they make sense. Try a few and add them to your arsenal. If you can’t fathom when or where an action might be available, click through and find an answer in documentation.

Action Availability
Add Using or #include from a symbol declared externally
Add Member from a class name
Add Similar Member from a member of a class
Change Signature from an existing signature
Create Declaration from an implementation
Create File from whitespace
Create From Usage from an unknown symbol
Create Implementation from a declaration
Create Method Implementations from a class declaration
Document Method from the name of a method
Encapsulate Field from the declaration of a member
Extract Method with a selection
Find Reference from a symbol
Implement Interface / Virtual Methods from a class name
Introduce Variable with a selection or from whitespace
Move Implementation to Source File from a method defined in a header
Move Selection to New File with a selection
Rename from a symbol
Rename File(s) from whitespace

Reset zoom level of Visual Studio to 100%

If you have ever been frustrated by an inadvertent zoom-in or zoom-out in Visual Studio, you probably know there is no convenient way in the IDE to reset the zoom level to 100%. Instead, the IDE requires you to “reset” via increments until you reach 100%.

resetEditorZoomCurrentValue

These inadvertent zooms occurred often enough among the developers of Visual Assist that one of them created a more efficient way to reset. You can have access to the functionality by assigning a shortcut to VAssistX.ResetEditorZoom. Use Ctrl+0 if you want to be consistent with the reset commands in web browsers.

VAssistX.ResetEditorZoom works only within the scope of the text editor, and you assign a shortcut in the usual manner–via the options dialog of the IDE.

Tools to understand new code: Enhanced Syntax Coloring

In my previous posts as guest contributor to this blog, I showed you how to use Go-To tools and different Find commands in Visual Assist. In this post, I describe improvements to syntax coloring available in Visual Assist, then close with a description of a tool window that combines several functions of the IDE and Visual Assist.

As in my previous posts, I will use Irrlicht Engine as my example project.

Enhanced Syntax Coloring

Syntax coloring in the IDE—whatever the version—makes code nice to read, and for me, faster to write. But, it’s the enhancements to coloring in Visual Assist that make code really easy to understand.

Let me compare default coloring of an older IDE, VS2008, with that of Visual Assist. (The comparison is similar for newer IDEs.) To the observant programmer, there are some real differences in what the IDE and Visual Assist provide:

blog_color

If you look carefully, Visual Assist uses separate colors for meaningful separation of symbols:

  • classes/structures/types – these appear blue by default, as if they were keywords. I know they won’t change, and I won’t change them.
  • variables – dark blue, or navy to be precise, so I know the symbols have values and can be modified.
  • preprocessor macros – fuchsia, so I know to be cautious in how I use these.
  • methods – also brown, which lets me find quickly the external references in a block of code.

In addition to more meaningful coloring, I can display so-called stable symbols, like function names from third-party libraries, in italics. (See GetSystemInfo and QueryPerformanceFrequency in my example.) The italics tell me nobody has overridden a well-known symbol, and that I can trust its behavior. When I’m surprised not to see a symbol in italics, sometimes I take time to find out what’s different about it.

VA View

I’m going to jump abruptly to one last feature of Visual Assist that is handy for the new user: the VA View. The learning curve for the VA View is a bit steeper than it is for the other commands I’ve described, but I think the effort is worth it.

The VA View is a handy tool that combines several functions of the IDE and Visual Assist, all in a compact interface. I usually make the VA View a tab in the same docked tool window as the Solution Explorer and Class Browser. The VA View gives me most of what I use in the other two tool windows, and I switch to the Solution Explorer or Class Browser only when absolutely necessary.

Here is an example of the VA View, docked to the left of my source window in VS2008:

blog_vaview

From top to bottom, the VA View has:

  • a drop-down for quick opening of any file in my solution. I can type partial matches in the list that opens, letting me find most files faster than I can with the Solution Explorer.
  • a drop-down for quick locating of symbols in my solution. This drop-down also supports filtering. If I know the name of a symbol, or most of it, I can jump to its definition faster than any other method of the IDE.
  • a most-recently-used (MRU) list of files and methods—ones that I’ve recently modified or visited. (Right+click in the MRU to adjust its settings.) Typically, the MRU lets me jump faster than tabbing windows or navigating back with Ctrl+-.
  • a hovering class browser (HCB) that tells me about the symbol I’m hovering over, or class I’m in. (Right+click to adjust this one as well.) In my example, the HCB is showing me SParticle members because my caret is somewhere in SParticle.

Again, the learning curve for the VA View is a little steeper than simpler features of Visual Assist—like syntax coloring. But, the VA View is ready handy and worth the little bit of time it takes to know it. And if you’re a keyboard user, you’ll be happy to know the entire interface to the VA View is available without a mouse.

Summary

In my three-part series, I tried to show new users of Visual Assist how to make use of the tool, especially when you land in front of a completely new code base. The stock IDE has many features to help you, but Visual Assist goes well beyond in functionality and performance.

Learn More

You can learn more about Enhanced Syntax Coloring and the VA View in the documentation for Visual Assist:

This article was contributed by Bartlomiej Filipek, who writes at Code And Graphics — a technical blog about C++ and OpenGL.

Tools to understand new code: Find

In my previous post as a guest contributor, I talked about moving between declaration and implementation of various symbols: methods, classes, variables… and even include files. The functionality helps a lot, but there are other tools in Visual Assist that we definitely need to know. This time, let’s have a look at some find commands in Visual Assist.

As in my last post, I will use Irrlicht Engine as my example project.

Find References

With Go To, we can jump from declaration to implementation smoothly. This is nice, but unfortunately, life is not that easy. Usually when we see an interesting variable or function, we would like to see not only its declaration or implementation, but how and where is it used.

Previously, we were curious about MaxAngleDegrees from CParticleBoxEmitter.cpp. We know than it’s a 32-bit integer variable used to generate rotations. But, where it is actually initialized?

With Visual Assist, press Shift+Alt+F (the default shortcut for its Find References) and you will see a dialog like this:

find_maxang

The window lists places where our variable is used. It seems that the variable is loaded from a settings file.

The basic list is, of course, nothing special—Visual Studio has a similar feature. But with Visual Assist, we have more benefits:

  • You can see a context of each line in a tooltip
  • You can view only Read or Write references
  • As with most Visual Assist tools, it works faster than the equivalent in Visual Studio. (Also, I’ve found that the results with Visual Assist are a bit more narrow.)

We can extend our search and go further:

  • MaxAngleDegrees is deserialized in CParticleBoxEmitter::deserializeAttributes
  • This method is called from CParticleSystemSceneNode::deserializeAttributes
  • It’s also polymorphic and might be called from CSceneLoaderIrr::readSceneNode

We can even track the whole system of loading scene nodes. We can now see the flow of this functionality. Without Find References, it would be very problematic.

Tip: You can also use Find References in File to, as the name suggests, see references to a symbol in the file you are actually in.

Find Symbol

Finding references for a given symbol is very useful, but what if you do not know an exact name? Maybe you just have some basic idea of what you want to find.

For instance, in Irrlicht Engine, we might want to see the implementation and an interface of a scene manager. Find References would not work well this time because we don’t have a reference. You could use the normal search box of Visual Studio, but you will probably end up with too many symbols and lines to check.

In this instance, you can use Find Symbol (Shift+Alt+S by default) in Visual Assist. Find Symbol opens a dialog box with all symbols from the current solution (and even third-party libraries!) I typed “manager scene” in the edit control of my dialog and got the following:

find_mgr

As you can see, “manager scene” is related to several different classes. We can double-click the most interesting object and go to its definition.

The Find Symbol dialog supports more advanced options as well, like searching only in classes (this will skip defines and free functions) or extending your search to files outside your solution.

Find Symbol is definitely much more convenient that the common search dialog of Visual Studio.

Summary

Our tool bag now contains two very important items: Go To and Find. We can now easily search for various symbols in solutions, easily go to their implementation/declarations. And with the Find commands, we are able to search for all occurrences of a given symbol and create a story of how it is used in a project.

Learn More

You can learn more about the Find commands in the documentation for Visual Assist:

This article was contributed by Bartlomiej Filipek, who writes at Code And Graphics — a technical blog about C++ and OpenGL.

Tools to understand new code: Go To

You’ve just started a new job and landed in front of a huge code base. Great! What a challenge! It would be nice to quickly get a general understanding of your project and be able to comfortably move around in the code. How do you do it?

In my series of articles as a guest contributor to this blog, you will learn about my favorite Visual Assist tools that help with code understanding. My tools are:

  • Go To
  • Find
  • Move
  • Additional tips

In this post, let’s take a look at Go To functionality.

As an example project, let’s take a look at Irrlicht Engine.

Go To

The feature in Visual Assist that I probably use most often is Go To. In short, it is an improvement for a very well-known tool from Visual Studio — Go to definition/declaration. But, we all know how this works (or actually doesn’t work) in VS. Sometimes you have to wait for a response from VS, or simply you cannot go anywhere.

With Visual Assist, you get a really nice, working version of the tool: just press Alt+G (the default keyboard shortcut), select where you want to go, and Visual Assist will go to it immediately!

Alt+G is especially useful when:

  • You are reading a class interface and you want to go to the implementation of some method. You can take a glance at the internal code, then quickly go back to the interface.
  • You want to check the declaration of a variable. Use Go To to see where the variable is declared (is it a local variable or maybe a member of a class).

Go To Example

I am in IParticleEmitter.h and I see the class IParticleEmitter interface declaration. There is an interesting method called emitt(...) — how is it implemented?

I can use Go To and get the following result:

goto_iparticleemit

Of course, Visual Assist sees that a method can have multiple polymorphic implementations. Go To allows one to select the desired implementation and jump into it. In the list, you can move via arrow keys, mouse, or assigned numbers/letters.

Now, I am in the implementation of this method: CParticleBoxEmitter::emitt. There is some code:

if (MaxAngleDegrees)
{
    core::vector3df tgt = Direction;
    tgt.rotateXYBy(os::Randomizer::frand() * MaxAngleDegrees);
    tgt.rotateYZBy(os::Randomizer::frand() * MaxAngleDegrees);
    tgt.rotateXZBy(os::Randomizer::frand() * MaxAngleDegrees);
    p.vector = tgt;
}

What is this MaxAngleDegrees? Is it a static constant or a class member? I can hover my mouse over it and get some basic information, but via Go To , I can go to the place where it is defined so I can see some more context.

When I want to return (to the interface that I was looking at initially), I can do it in several ways:

  • Ctrl+Tab to go to the previous window
  • Ctrl+- to go to the previous location
  • Navigate Back — a Visual Assist command that I will describe in another article

Tip: Additionally, Alt+G works in other situations; for instance, press Alt+G when the caret is in a line with the #include "#xyz" statement. You will simply move to the header!

Go To Related

Visual Assist goes even further than Go To with the implementation of another commend — Go To Related. If you use Shift+Alt+G instead of Alt+G, you will see a much more advanced version of Go To. For instance:

goto_related_iparticle

With Shift+Alt+G, I can see base classes, derived classes and even go to the definition a particular member!

Summary

Go To  and its related commands, Go To Related and Go To Member, are some of the most important tools in Visual Assist. The Go To commands enable us to move in the code quickly and jump among definition/use/declaration. The implementations in Visual Assist are very advanced and more efficient that the native Visual Studio solution.

Learn More

You can learn more about the Go To commands in the documentation for Visual Assist:

This article was contributed by Bartlomiej Filipek, who writes at Code And Graphics — a technical blog about C++ and OpenGL.