How do I know whether or not to use a game engine? I want to make a relatively complex 2D game for Android. What factors should I weigh to decide whether to find, install and learn a game engine or just do everything manually?
Most if not all of the coding is done for you, so all you have to worry about is content, level layout, etc.
Along those lines, memory management, asset loading, lighting (in complex engines), etc has all been designed and tested thoroughly (hopefully).
As mentioned below, if the engine is cross platform you will have to do little to no work to port your game.
- If you are modifying anything, you now need to become familiar with a new codebase.
- If there is a bug in the engine, unless it is open source you can't fix it.
- The engine was not designed specifically for your game, so it may be less efficient than code you write specifically for your game.
- Game engines generally are not free.
- If a game is small, the overhead of using an engine may not be worth the time invested to write code yourself.
- If your game engine also has any editors or tools, you will have to build and test those as well before turning them over to artists or relying on them yourself.
Don't let the fact that the list of disadvantages is longer: when the time spent coding and testing all the systems you need is too long for your production cycle, or if you have more skill with art than code, using a game engine is definitely a good idea.
A comparison of game engines is in the works in this question: Pro's and Con's of Various 3D Game Engines
In my case, I spent a lot of time (months) floundering around getting nothing done because of game engines. I now typically avoid them like the plague, though I understand they should be used wisely and in moderation.
For me, I'd get obsessed over all the possibilities! Looking at a long list of features in engine X, it's like "Wow I could do all this! My game could be great!" So I'd download it, run the demos and be dazzled by those features in action, etc. Then I'd create a new project in my IDE and wouldn't know where to start. I'd write some code, I might learn from and base it off of the demo projects, but those were just demos.
I didn't know how to start from nothing and make something. I didn't know the first step. I loved the idea of an engine, it impressed me and got me motivated to make something, but my knowledge of actual development was so limited that even after knowing how to add the engine to the build path, and maybe writing a few lines to start the engine and then shut it down again, beyond that I never made anything worthwhile.
I'm much more of a baby step kind of person. I'd rather make my own game one step at a time, refactoring out useful functions and collecting those functions into a library which one day I might consider an "engine". So for now, I avoid the engine hype and just stick with the low-level stuff.
And engines do have their place. If you find an engine and think to yourself, "This is exactly what I would write! They've already done the work for me, I don't have to reinvent the wheel, and I know exactly how to hook it into the game that I've already started [or at least fully planned and am ready to start]" then it's probably a good fit. You'll know exactly how to use it, and how to write your own code to use the engine to create something useful. But if you get an engine just cause it has everything but the kitchen sink and you think you're standing on the shoulders of giants, you're very mistaken. You have a giant standing in front of you, and you need to climb up to its shoulders.
So the huge disadvantage for me: don't get caught up in all the things you could do. Whatever engine you might choose, it will have tons of potential. But if you don't know how to actually harness the potential, if it doesn't make your live easier or help you get your work done, then why are you using it?
The biggest disadvantage of a game engine is that you have to learn it. If you're new to programming in general, that may still be faster than learning to write code to do all the stuff that an engine handles for you out of the box, but if you're experienced then it costs you no time to sit down and start coding, but a fair amount of up-front time to learn your way around an unfamiliar engine.
Biggest thing to look for is support, because game engines are not perfect and they do not read your mind, and you WILL get stuck on SOMETHING at some point. So:
- Is there documentation?
- Is the documentation actually any good?
- Is there technical support (generally not, unless you're paying for it)? What's the turnaround time?
- Are there community forums where you can post questions and get real answers?
- Are there tutorials that show you how to start using the engine? Is sample source code included? How useful do you find these in getting up to speed?
As somebody who has a lot of software development experience and who only really tried to develop a game from scratch recently, here is my 2 cents.
The answers so far have provided long lists of pros and cons. I will provide what for me is the most important reason NOT to use a game engine. As I took on the task of learning to write a game purely for challenge and reward I decided to do it from scratch with no engine, just OpenGL and SDL, because I wanted to learn everything above that level of abstraction. At no stage have I regretted that decision. My game is a nice scrolling version of 2D Asteroids, basic but smooth. I am not trying to compete with vastly superior games, but I do distribute my game and people have enjoyed playing it. I will take the same approach in making the game multi player. This is a huge challenge and using libraries might make it easier, but I my goal is not to make it easy. My goal is to learn, and for me it is a part time activity, so I do not have a lot of time and progress is slow. But I have my reasons for this approach. Call it "higher learning".
So, answer your own question, do you want to learn how to do the things that the game engine instead does for you for the benefits that this learning might bring? If so, do not use a game engine.
You need to detail what you mean by "complex". A good game engine takes care of all the following:
- Rendering on a stable framerate
- Input handling
- User interface
- Resource management (images, sound, data files)
- Saving/loading your game
- Physics (2d or 3d)
Think to yourself, do I know how to code each of these? How long will I take to program each, and how long will I take to learn how to make an engine do each of these?
The biggest advantage: a lot of things are done for you. You don't have to keep re-inventing the wheel.
Another advantage: The game engine might also be cross-platform (Unity).
Disadvantages? Control? The engine is taking care of some things for you (such as rendering) so if it has bugs or performance issues, then you can't simply fix it yourself.