Hello,

I really have no clue how to start creating a game engine, what skills I need in C++, I want the engine to be for 2d RPG games and relatively simple, mostly for experience. Could someone give me a step by step guide or something, I'm just really baffled by this project. I've looked on the net and haven't exactly come accross anything useful. Any help would be very much appreciated.

Recommended Answers

All 3 Replies

I am currently doing the same in Python.
The key is to plan it out first, then start text-based, then move on to graphics. Much easier that way

But what and how should an engine help in the development, I mean how on earth are you supposed to code something like that?

The purpose of a game engine is to facilitate development of one game, then another, then another, etc. (typically a real game is made of 80-90% game-engine code and the rest is the actual game logic, then you have the artistic part, all the 3D models and animations and everything). So really what it does is give "services" that are useful to develop a game, "any" game ("any" is a relative word, of course). So the first thing to do, is sit down, take a piece of paper and pencil, and make a list of services or features you want your game engine to provide. Start from simple tasks to more rendering-related and user-interface-related tasks. For example:
Basic stuff:
- Save and load a game.
- Load and Use texture files.
- Load and Play sound files.
- Load and Use 2D model files (if any, since an image usually is good enough in 2D).
- Communicate on network for multi-player.
- etc.
Game-related features:
- Display 2D objects (background, characters, etc.)
- Do some AI and control non-human characters.
- Take key-stroke inputs and mouse-clicks
- Display some user-interface (and what do you want on it?)
- etc.

I'm not saying you should take all of the above or any of the above and it's certainly not a complete list either, but do this for yourself. Then, you need to think hard about how they need to be put together, that's the architecture of your engine. You can have a very flat hierarchy (one supervising object that holds everything else), a multi-layer hierarchy (a root object or main function holding a few supervising objects that hold other supervising objects of their own), or a distributed system (no root object, each "service" is an independent entity, I recommend that! it's more flexible, but could be a bit challenging at first).

One way to ease this process is to think of interdependencies. A theoretical book on programming will tell you that interdependencies are bad and should be avoided, but reality will show you that they are all-too-often unavoidable. So list for each feature what feature it needs and just by making sure the hierarchy allows for the various interdependent parts to interact easily, you guarantee a reasonably practical engine (example: you know rendering a character will probably require loading a texture, or keyboard and mouse capture, just like AI, will need access to some way to influence the character movements). You can do basically an object hierarchy from that, by figuring out what should own what, who needs who. But don't underestimate how not-obvious this can become, but don't stress out either, don't expect to be able to figure all this out on your first try at programming a game engine, just do it, as you encounter problems you will find solutions or at least get ideas on how to do it better the next time around.

After that, I recommend you develop your game and your game engine in parallel. You add a "service" or "feature" to the engine and add it to your game. This way to compile and run the engine often, program incrementally, and can sniff-out a lot of problems before you have a game engine that is too big and hard to change.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.