Games that are of the same mold pretty much all work the same way. For example, all first-person shooters like Doom need code that does in essence the same set of tasks. All side-scrolling games, such as the old Super Mario Brothers or Sonic the Hedgehog, also use code that does essentially the same things.
To make game programmers’ lives less stressful, other programmers often cultivate game engines. A game engine performs the most routine tasks that a particular type of game does. For instance, a game engine for first-person shooters handles all of the tasks associated with displaying scenery, drawing bad guys, and so forth. You have to insert your own scenery, code for your weapons, and any other code that is definitive to your game. The game engine handles displaying buildings, trees, and things like that.
Game use game engines to get their work fulfilled. Game engines, in turn, use graphics libraries to do all of their drawing. If you have a game engine and a graphics library, it saves you from writing a great amount of code. All you have to do is add your game code on top of the game engine. That’s the only part of the game that you have to write. Take my word for it; that’s all you want to worry about. You’ll find writing your game code daring enough.
Different types of games each need their own game engine. So you may run across game engines that are for first-person shooters, others that are for flight simulators, and so on. The best game engines are specific enough to be used for more than one type of game. Many excellent game engines are available commercially. The people who write them usually instruct you to buy the engine or pay a royalty when you sell your game. Some request both.