Game engine architecture, or how to start your own Engine...
Why didn't I do it? Well...
... I knew I didn't know anything about designing such a complex system. I tried to find some good examples on the Internet. While one wasn't very bad, it didn't make too much sense to me, I always felt like something was missing.
I finally ordered the book "Game Engine Architecture" by . In short, it is great, it contais what the title says. It talks about the problems in modern AAA game engines and how the different engines solved them.
"I don't want to make a AAA game engine, why should this book be good for me?" Because it talks about everything a game engine has to do, about what subsystems it can have.
If you make your own hobbyist game, you face similar problems, only your solutions are simpler. Plus it orders your code nicely and logically.
So basically, if you own this book, this entry is obselete. Almost. Here, I want to write about the groundlaying decisions you have to make not as a professional, but as a hobbyist, as a guy who just wants to start programming fun stuff.
Starting your own Engine
The first and most important question:What is my target, what do I want to get out of it?
Many starters rush to the next questions about the engine, but most importantly, why do you want to do it? Do you want to get money out of it? Do you want to learn? Do you want to implement your dream?
It was simple for me, I came the other way around. I originally wanted to have a C++ learning project. After some time, it dawned to me, instead of programming some boring shit, I could write a game!
To the people who want to realise their dream... unless you are a senior in gamedev, it won't happen. Or the game would not look like the way you dreamed. If you know this (not simply reading this sentence, but KNOW what concequences this can have on your motivation), then move on.
What game do I want to make?
There is no point making an engine without a game in mind. That's how simple it is. If you have a raw idea, it helped me writing it down, solidifying my thoughts. A good Idea is writing a journal about it ;).
What platforms should it be running on?
This can already narrow your choices. For example: "My platform is IPhone", you are pretty much set.
If you say "Well... uhm... on a PC?" You didn't get much further. You also have to ask what for what operating systems. JUST DON'T ASK ME WHICH!
"So for what operating system should I programm?" ARRGH, alright let's not start a crusade here. It should run on your favourite platform you are developing at. You can put more thoughts into it, what kind of person will download and play your game. But that is only secondary, unless you want to make money out of it.
I chose to tackle the Devil, I went for cross-platform. If you use cross-platform libraries, it shouldn't be a big problem, right? NO!
It is easyER when you chose a higher programming language like java, C#, or python.
In a Language like C++, it isn't too difficult either, when you know how. And you DON'T KNOW how when you're not an experienced C++ developer.
Just for the record, I am NOT an experienced C++ developer, I witnessed first hand how painfull it is.
What Language do I use?
For now I tried to avoid talking about religion, but now I can't talk around it any longer.
From a Theoretical Computer Science stand point, it really does't matter. There is nothing you can do with language A that can't be done with language B. The only difference is, some things might be easier to do in a specific language.
"So what should I choose?"
Oh dear. Ok... just... alright, are you a beginner? If you are, choose anything BUT C++. Go with C# or Java, both work very well, both have a good tutorials and beginner forums. Both have a C syntax and you could even get a professional job as a programmer in both languages. Don't just DON'T START with C++.
"Why?" Let me tell it to you this way: Java and C# are like a good wooden bridge over a deep cliff. It supports your weight and even has a wooden safety railing. You can jump off if you want to.
C++ on the other hand is like a bridge of three ropes, one for your feet and 2 for your hands, with a angry gorilla at the other side shaking the ropes wildly. It also has a sign besides it "Health and Safety Advice: Don't fall off, or you're dead!".
If you say "well, I looked at the C++ tutorials and I thought they are pretty simple", then I can't help you here. Do what you have to. You'll see soon enough.
What libraries do I use?
With your favourite language chosen, you can go out and search for useful libraries. I can't advise you how you chose it, I can only urge you to use one.
You don't have to reinvent the wheel all the time.
What Toolchain do I use?
If you are new to programming, you may ask yourself "what do you mean, toolchain? Like a toolbelt of a construction worker?"
No, with toolchain you refer to the tools you are using while developing your program.
Now you are at a point where sometimes, you already have a common toolchain available, I urge you to use it. Don't try to be different, there is a reason why it is common.
Before you start coding, you should set up your toolchain. I know many don't believe me, but you'll save much trouble later on.
You should at least have a:
- Repository, SVN and Git are the most prominent. Git is especially interesting with the free online git repository server github.org. check it out.
- an IDE that is able to compile and debug your program.
If you've chosen to go down the path of doom, using C++ in a cross platform project, then here is where a lot of your time is eaten up. I've written serveral posts about it, and about the frustration.
That's it for this week, I wanted to write more about the actual architecture, but will be in an other entry.