Hi! Welcome to xnoe.moe!

Why I chose C++ to build a game engine?

I chose C++ to build my game engine for the challenge. The first version of my game engine was written in Java using LWJGL. I had never used C++ pointers before so I decided to use C++ to build the engine. I already knew most of the OpenGL stuff, so it was just a case of learning C++ as I built the game engine.

C++ is a very different language from Java, despite looking sort-of similar. Whilst Java does not force the programmer to work with pointers, C++ does. However, C++ pointers are not that compicated for the basics, and that’s all you’ll need most of the time.

Pointers allow you to decide whether you’re refering to the actual data, on the location in memory of the data. Pointers are a really good way of expressing arrays as well, with each item in the array just being the location in memory of the first, plus the index multiplied by the size in bytes of whatever you are refering to. You can store data or pointers in an array. ASCII strings can also be treated as arrays, so it is a pointer. With one byte per character, you just reference the memory address of each byte.

C++ also doesn’t force you to make everything a class, something that Java does. This is a downside in Java sometimes, as you may just want a function, but you have to make a class for it to be able to use it everywhere. In C++, this isn’t the case and you can have functions wherever you want!

-Update: 2020-06-03-

It is also worth noting that C++ has the easier access to libraries (with there being not much work needed to load either C or C++ specific libraries), and whilst this makes starting a project fast, C++, in my opinion, isn’t the best choice for this. If I were to be doing this again today, I’d likely use a language like Rust

Copyright 2020 © xnoe.moe. All rights reserved.