First Experience With C++

Learning C++ After Studying Java and Python

Hello, my name is Saarim. I have a college diploma in computer programming and have worked with object-oriented programming before with Java and Python. This blog post will be detailing my experience and initial impressions of the C++ programming language.

I have been told before that C++ and Java are similar languages, but I still wasn’t prepared for how similar they are. Experienced programmers tell me that once you understand the logic of coding and design concepts (like OOP), learning new languages isn’t really that hard because you just have to learn the syntax. The logic is the same, for most purposes, a for loop still functions the same between different languages, an object is still an object whether it’s in Java or Python. While the syntax between Java and Python are different, the syntax between Java and C++ are similar. You specify the return type for methods, declaring variables is almost the same, the only biggest difference so far is how to print out to the terminal. I’ll dive into that after I explain what I am using to learn C++. This won’t be a beefy post as I just haven’t dove into the project that deeply, but it will cover what I have learned.

I am learning C++ from a Udemy course that is teaching the language in the context of Unreal Engine 4. The course is “Unreal Engine C++ Developer: Learn C++ and Make Video Games” Unreal Engine 4 or UE4 is a real time 3d creation tool. It is most commonly known as a video game engine but is also used for other purposes like Film production and Architecture. Unreal Engine 4 is free, anyone can download it and develop in it. Many popular and critically acclaimed blockbuster games are developed on this engine like Final Fantasy 7 Remake, It Takes Two and Batman Arkham Knight (Arkham Knight used Unreal Engine 3 as opposed to 4). I am not very far in the course but I am just starting to write C++ code that is effecting the Unreal Engine project.

The following pictures are to show the project a little bit.

The C++ code that contains the functions for the introduction and to clear the screen once the user has entered their input

Keep in mind, most of this code has been written from the course instructor and I am just starting the course. Most of the work I have done so far has been setting up the project, and making sure that UE4 is working with Visual Studio Code. All of the landscape, art and actors you see have already been made. I have only modified the welcome message on the wooden sign, and added the method to clear the terminal (wooden sign) when ever the user enters their input.

A view of what the game is looking like so far. You can see the lines of code coming into play here from the other screenshot

I said previously that the biggest difference I’ve noticed between C++ and Java so far is how to print strings out to the terminal. In theory it’s basically the same, you have to import whatever library allows for this function. In the case for C++ it’s “#include <iostream>”, and you are still calling a method from this library and inputting your text into the parameters, but the syntax is different and not as clean looking as Java in my opinion.

How to print a string in C++

I also don’t like how you have to use the colons. I am used to java where you have to write “system.out.println(“my string”);” and I don’t have to use the colons. This is a small issue but it still feels very weird for someone who has worked with java for 2 years.

I had run into as issue where UE4 couldn’t detect my installation of Visual studio Code. I was following the instructions from the course I am following but I kept running into the issue of UE4 telling me I didn’t have Visual Studio Code installed. I didn’t understand this, and when troubleshooting the issue online, I couldn’t find much that helped. I had followed the installation for VScode properly for the context of using it in UE4 and furthermore, not many people even ran into the issue I was running into. Most people has other issues where UE4 would detect VScode, but for some reason couldn’t compile or something else. The bottom line is, my specific issue didn’t even seem to be that common. I did stumble upon someone saying to right click my uproject file and hit “Generate Visual Studio File Projects”. The course I’m following said to do this as well, but within the UE4 engine editor itself and not by right clicking the project file in the file explorer. I thought I had already done this step in the UE4 editor but when I checked again, the option wasn’t even showing up for me to generate the files within the editor, although I did think that it’s not showing up because I have previously hit the option, and it takes the option away after you initially execute it. I still decided to generate the files by right clickling the project file and then UE4 was able to recognize I have Visual Studio Code installed.

I think the issue came down to my version of UE4 being a slightly updated version than the one in the course. One of the differences in the engine is how/where the generate VScode project files button is.

Thank you for reading my post and my first experience with C++. I will be sure to keep posting updates about my C++ journey.

Saarim

3 thoughts on “First Experience With C++

Comments are closed.