Possibilities of Coding with Microsoft Visual Studio Code?

So, I’ve been looking around and was unsure regarding how far you can go with Microsoft Visual Studio Code.

I’ve been planning to make a personal game that used an extensive amount of RPG mechanics within a mix of Third Person Shooter, and First Person Shooter type gameplay and other mechanics like fighting mechanics as well.

Is it possible to utilize Visual Studio Code to accomplish this, as it’s intended to get complex. If this is possible, where would I begin as far as tutors for it as I have no real applicable knowledge or experience with C++/Coding in Microsoft Visual Studio Code for Unreal Engine at all.

So I’m not sure where to begin regarding this at all as far as coding goes in other words.

It is totally possible to do this with VS Code, as I’m currently doing a similar thing with my project! Here’s a quick guide on how to get it set up.

Note: this is assuming you already have VS Code installed and set up to compile C++. If I recall correctly, you’ll just need the C/C++ extension offered by Microsoft. I’ll look into this to double check I’m not missing something, and I’ll edit this paragraph if I find anything.

I think Code is only supported in 4.18 and onward, but I may be wrong. I don’t have 4.17 installed right now to check if Code support was added in 4.17 or 4.18… Inside the editor, you want to open the Editor Preferences tab. Then, under the Source Code section, set the Source Code Editor option to Visual Studio Code. If Visual Studio Code isn’t in this list, you may need to either install it first (I don’t remember if that matters or not), or you may have to upgrade to 4.18.

231717-selecting-vscode.png

Afterward, browse to your project folder, right click YourProject.uproject, and click “Generate Visual Studio project files”. It should be near the top of the context menu, like so:

231718-generate-project-files.png

Once this finishes, you should have a folder named “.vscode”. It might not show up since Windows hides any folder or file whose name starts with a period. If you would like to show hidden files, you can tell the Windows file explorer to do so by clicking View and checking the Hidden Items box.

Now all you have to do is open your main project folder inside VS Code. Code should automatically detect your .vscode folder, allowing you to build your project. The default build command is Control + Shift + B, which pulls up a list of build commands you can run. For normal Hot Reloading with the editor open, you’ll want one of the YourProjectEditor options (most likely the Win64 one, assuming you run the 64-bit editor and are on Windows). It should look something like this (mine says ROTN since that’s my project name, but for you this should be whatever you named your project):

231716-vscode-build-commands.png

Running the editor build command will recompile your game code and have Hot Reload do its thing while the editor is open. Now you should have Code set up to build your project!

For your second question about actually learning C++ and applying it to UE4, I highly recommend looking into YouTube tutorials. Also, the [UE4 programming guide][4] is a great place to start with UE4-specific coding, and the [UE4 C++ API][5] will be immensely helpful.

I hope this helps you, and let me know if you have any more questions!

Could you elaborate some more on why you are considering VS Code? I think Chromarict has provided a very good explanation and the right answer when reading your question literally. But that something is possible does not mean that it is the best option. So my recommendation would be to have a look at Visual Studio 2017 Community Edition as it is IMHO the much better tool for full blown C++ development than VS code with its short-cuts only interface, especially when things “get complex”.

Because I was not entirely sure which program I should have been using originally. I have a total of two programs regarding this. I’ve heard of Visual Studio 2017 Community Edition being something useful, but due to uncertainty about what to use, It seemed like a better idea to use VS Code because of its simplistic setup, and had what I thought I needed to start coding with. As I looked through my files as of just now, I found out I already had VS 2017 Community Edition, but it’s out of date and currently being updated. So, there’s a lot of uncertainty as to where to go to and begin with the coding, and where to get the specific help regarding this.

I see. When in doubt, I really would recommend to use VS CE as it builds a product family with VS Pro and Enterpire Edition, which is the de-facto industry standard for C++ development on Windows, while VS Code is an entirely different product sharing a similar name for the sake of marketing. So there will be more folks around that will be able to give you advice if you should run into any difficulties.

You are right, VS CEs interface is absolutely not reduced or simplistic, but this does not only mean that there are more and more powerfull tools included but also that you have the possibility to look around through the menus to discover what options and configurations you can make use of.

Thank you, I’m looking into it, and have updated it. Then I remembered why I originally stopped using it before. I needed an account on microsoft as the evaluation period I had was expired and I didn’t do anything with it in the first place. I’ve currently made an account there, and I’m unable to sign into the account as I now get a blank window when trying to sign in. Hopefully I can get this situated and begin using it.

Alright, I see now. Thank you for letting me know all of this information in exquisite detail, and showing me what can be done, as well as linking me to places to look around. I’ll be looking around these links and see what the offer and what I can apply for myself. Thank you very much, Chromarict.

Hello, thanks for the great in-depth explanation! I’ve finally managed to launch the engine using VS Code for the first time. There’s still a few problems unfortunately. Lots of the #include declarations don’t work (green squiggly lines underneath), and most code that was created by default errors. For example, taking a look at the staple Actor class (header file) results in 591 errors, even though the file was never modified and works fine in the engine.

Is there a solution to these problems?

Not the one who asked the question, but here’s my answer to your question:

  1. VSCode is free and open-source. VS CE is neither.
  2. VSCode is much more lightweight (runtime and especially on disk) than VS CE, and is multi-platform (I’m a linux user).
  3. I’m used to VSCode
  4. After getting VSCode to work with UE4, I personally think it works just as well if not better. It feels more responsive to me.

The intention of my question was in fact to understand Human Smokes reasoning, not to have a general discussion on taste or to restart the editor wars. Of course anyone may and should use whatever tools and editor that fit their personal needs and taste best. Also my recommendation of VS CE was coined to a person that has “no real applicable knowledge or experience with C++/Coding” and no in-deepth knowledge of the avialable options not to someone who already knows e.g. ed is the best tool for the particular job.

I’ve been trying to get VS Code to work with UE4 for a while now, mainly because of your 2nd point. My computer can handle UE4 or VS just fine, but it struggles running both. It can, however, run UE4 and VSC just fine. Plus I much prefer the look & feel of VSC :stuck_out_tongue:

My VSC doesn’t know what to do with the headers, most errors probably stem from those incomplete searches or something. Were you able to fix this problem?

Hello, if anyone had the build command fail because of this error

"EngineBuildBatchFilesBuild.bat: command not found"

It’s because you probably changed your default VSCode terminal from Powershell or cmd.exe to something else like Git Bash (like I did). Change your default terminal back to cmd.exe for example and the batch file should execute correctly.

I got this bug while i was triying to compile it:
‘C:\Program’ is not recognized as an internal or external command,
operable program or batch file.