Posted by: Echo
I have been tasked to write a blog post about various programming subjects, I hope new programmers will find this useful! First a little information about myself, I’m Simon, a programmer at Square Root Studios and I’ve been programming for the past ten years. I just finished my Bachelor's degree in Computer Science. I work on various systems in the game as well as integrating gameplay mechanics.
Programming for Beginners
In my opinion, the two most satisfying moments as a programmer are when you first start out and when you understand enough to build complex systems yourself. When you first start out you learn new concepts and keywords at a rapid pace which feels fulfilling! One of my fondest programming memories is when I programmed my first inventory system. After getting comfortable enough with your programming language, everything falls into place. You start realising that you can build whatever you want. This is a very powerful skill to have and feels incredibly freeing!
But how do you get to this stage? Starting out can be an intimidating process, much due to the elitism in the programming community which I despise. The first thing you need to do is to decide which language you want to learn. In my opinion, the best languages to choose from are the biggest object-oriented programming languages (OOP); C#, Java and Python. Love them or hate them, OOP languages are still widely used in the industry but most importantly for beginners, they have some of the best documentation and the biggest communities. A programming language with a big community offers greater help for you as a beginner.
In my experience, the best way to learn a new language is to watch YouTube tutorials or read programming blogs/books for that language. They often start with setting up your development environment making sure you’re ready to program and then introduce concept after concept. It is then important to take time and not take in too much information! Make sure you understand each concept and play with it on your own before continuing. You can start experimenting with different text-based applications like making a rock-paper-scissors game, or hangman!
One of the most important things to remember when learning a new language is to stick with it! It is tempting to swap over to another programming language but if you do this before you’ve gained enough experience you will most likely reset your progress. After you know a language inside-out, learning a second one is a piece of cake! Most of the concepts are the same and the only difference is the syntax.
Main Differences Between Common Languages
There are many different programming languages to choose from and they all have their place. High-level Languages are languages like Java and C# where the details of the computer are separated with a strong abstraction. Meaning things like memory management and garbage collection are handled automatically for you. They are made this way to make it easier for you, the programmer, to use. These languages have some abstraction penalties which is a downside of the standardised high-level abstractions. These could be in performance, memory or both. High-level languages have a focus on usability.
Low-level Languages are languages like C, Assembly or C++ that serve little to no abstraction from the computer. They are often faster if used correctly but are also harder to write in. Some argue that C and C++ are in the middle of a low- and high-level language. OOP Languages are languages that represent data in the form of objects. This object can be for example 'Animal' with data about its species, name and various methods to do work. Other examples of this can be 'Dog', 'Cat' or 'Mouse' which then, due to the power of polymorphism, can inherit all the data of the 'Animal' object.
There are many different programming languages and styles. It is important to remember that there is no 'best programming language', they all have their place (even Java). The best language depends on what you want to achieve!
What Language Does TitanReach Use?
TitanReach is being developed with the Unity Engine. This engine supports both Microsoft’s C# language and visual tools for scripting. It used to have Boo- and UnityScript support but they are both deprecated. Using C# for the client pairs well with using ENet for the backend! No need to switch your brain to work with multiple programming languages at the same time which can be weird at first. Unity Engine is widely used and its community is huge. This means that bugs will be, in theory, fixed fast and that support is easy to get. The internals of Unity are made in C++ but with exposed bindings so that C# can interact with it. This leverages the low-level performance of C++ together with the high-level usability of C#, win-win!
My Creative Process
When I start making new systems in TitanReach or one of my own projects for that matter, I start with writing down what this new system will do. I then think about what this system needs in terms of variables and methods. Lastly, I go through which other systems this new system will interact with. If one system starts to handle too much I often refactor it down into multiple parts. For example, a PlayerController class is bound to get huge as it’s going to control everything the player does from movement, interaction, input, physics, sound effects and so on. An example of a refactor like this would be to break PlayerController into:
PlayerMovement, PlayerInteraction, PlayerMovementSFX and PlayerInventory.
This makes everything more manageable and easy to work with. It is important to plan new systems and features well so that you don’t have to rewrite them in the future as this wastes time. Two minutes spent planning saves 1 hour of rewriting. I have plenty of experience in rewriting old systems so this is really something I’d focus on. Style consistency is also underappreciated when it comes to programming projects. It’s important to keep your styling consistent so it becomes easier to find things because you know in what style they are written. This is especially important when working with a team.
Keep at it! Remember that discipline is better than motivation when it comes to learning new things. Use your new skills while you’re learning so you know that you’ll remember them in the future, but most importantly, have fun!
Posted at: 15 May 2021, 09:48:09 PM (GMT +0)