10 Replies - 2238 Views - Last Post: 11 January 2014 - 10:17 AM Rate Topic: -----

#1 1_dylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-January 14

How to create a game engine in C++

Posted 11 January 2014 - 04:04 AM

Hi,
I would like to create a 3D game engine for my upcoming project (a 3D first person shooter), I know C++ thoroughly and completely. I know game engines aren't all X Y and Z like what people say, it is all about graphic rendering, physics, shaders, textures, sounds, etc... I don't want to use Unity because I would rather something I know I made. I have a small team of developers with me. The bottom line: can you recommend me any tutorials/webpages and books which will help us get started on the engine.

Is This A Good Question/Topic? 0
  • +

Replies To: How to create a game engine in C++

#2 tarmizi_adam2005  Icon User is offline

  • جوروترا

Reputation: 245
  • View blog
  • Posts: 892
  • Joined: 18-April 09

Re: How to create a game engine in C++

Posted 11 January 2014 - 04:35 AM

View Post1_dylan, on 11 January 2014 - 07:04 PM, said:

Hi,
I would like to create a 3D game engine for my upcoming project (a 3D first person shooter), I know C++ thoroughly and completely.


Then you should already know how to research and find the ones that suites you.
Was This Post Helpful? 2
  • +
  • -

#3 1_dylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 11-January 14

Re: How to create a game engine in C++

Posted 11 January 2014 - 04:44 AM

View Posttarmizi_adam2005, on 11 January 2014 - 04:35 AM, said:

View Post1_dylan, on 11 January 2014 - 07:04 PM, said:

Hi,
I would like to create a 3D game engine for my upcoming project (a 3D first person shooter), I know C++ thoroughly and completely.


Then you should already know how to research and find the ones that suites you.


Did you even read the full post?
Was This Post Helpful? 0
  • +
  • -

#4 Nathan2222  Icon User is offline

  • D.I.C Head

Reputation: -11
  • View blog
  • Posts: 100
  • Joined: 01-January 14

Re: How to create a game engine in C++

Posted 11 January 2014 - 04:52 AM

View Post1_dylan, on 11 January 2014 - 04:04 AM, said:

Hi,
I would like to create a 3D game engine for my upcoming project (a 3D first person shooter), I know C++ thoroughly and completely. I know game engines aren't all X Y and Z like what people say, it is all about graphic rendering, physics, shaders, textures, sounds, etc... I don't want to use Unity because I would rather something I know I made. I have a small team of developers with me. The bottom line: can you recommend me any tutorials/webpages and books which will help us get started on the engine.

Can't wait to know c++ thoroughly and completely.
Buy/download the game engine architecture book. It doesn't show you how to code engines but explains what and engine is and how the parts should be.

I think making a game using separate libraries is like making an engine because you have to make the parts work together to make the game.

If you are making everything from scratchhhh (your own rendering engine, physics engine etc.), someone in your team needs to know maths, physics, directx/opengl etc.

Good Luck.
Was This Post Helpful? 1
  • +
  • -

#5 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 362
  • View blog
  • Posts: 1,539
  • Joined: 08-April 09

Re: How to create a game engine in C++

Posted 11 January 2014 - 06:05 AM

There is already topic about this here on DIC.
Where To Start With Game Programming?
Was This Post Helpful? 1
  • +
  • -

#6 Java Student  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 483
  • Joined: 05-February 10

Re: How to create a game engine in C++

Posted 11 January 2014 - 06:50 AM

This question is a little broad because you can just google "opengl/directx/xna 3d tutorials"

I've made an FPS(First Person Shooter) from scratch using OpenGL and my own .obj model importer, you can check it out on my website It was pure hell and i will not be doing another FPS.

You should strongly reconsider whether an FPS should be your first game since you didnt tell us that you are familiar with any type of API(opengl,directx,xna). An FPS is perhaps the most technically challenging type of genre.

Everything i learned was off of google searching tutorials so i would start there.
Was This Post Helpful? 3
  • +
  • -

#7 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 591
  • View blog
  • Posts: 1,317
  • Joined: 24-April 12

Re: How to create a game engine in C++

Posted 11 January 2014 - 07:50 AM

*
POPULAR

As Michael26 pointed out, this topic has been discussed extensively.

But, there are a couple of books that I will recommend to you. The first is Frank Luna's book on DirectX. I haven't read it. I read part of an earlier edition of it many many years ago and it was way over my head at the time. But, it is regarded to be the best of the three books published on DX11. However, you may want to master DX9 before tackling DX11 unless you have programmed quite a few shaders in HLSL.

There is also Andre LaMothe's book. It is the only book that I have ever in my life seen come anywhere remotely close to discussing what you need to know to write a game engine in C++. Notice it was written in 2003 and you can expect the graphics quality it discusses to be at about the level graphics were at in 2003. Again, that book was way over my head when I bought it and I still don't consider it a book that I would recommend. I think you'll already know how to do what's in that book before you get much out of that book. Still, it's basically the only book I believe that has ever been published that comes close to what you are asking for.

I probably own almost any book you can name that's fairly recent (5 to 10 years) on the subject in my personal library. I have a full sized book case that is nothing but game programming books. I have another full sized book case on computer programming. There is a vast and varied collection of topics there from Blender to collision detection to Linear Algebra and a ton of HLSL and GLSL books just as a start. Most of those books probably average around $35 a book. And to just be blunt, I think you will have to have read most of them to have any hope of making a 3D game engine in C++ or any other language. (Or gone to school to learn the equivalent or otherwise acquired the knowledge within them.) It's easily $1,000 worth of books and 10's of thousands if not 100's of thousands of pages of reading.

There are a lot of tutorials on terrain generation on the Internet. This is probably the first small step into a 3D FPS game engine. I would suggest reading my blog, because it discusses the subject on an "overview" level and may help to make other tutorials on the subject make sense. Eventually, you will need to learn ROAM or some other large terrain algorithm, but you need to learn to just do a basic terrain first. You'll also want to include mapping for the terrain probably including shadow mapping and bump mapping using HLSL. This is just one small step into making a 3D game engine, but it gives you some idea of what lies ahead in the journey. And unless you just set the "ground" to be a flat plane, this is kind of the foundation of what you need to get started.

Honestly, I don't know who you have on your team or their skill level, but if you are a bunch of friends who want to make games largely for fun and maybe for profit, I would suggest that you make something with Unity first. I'm still not sure whether I'm ready to fully endorse Unity; I've only been playing around with it for a month or two. But I've been reasonably impressed with it so far. And one of the reasons I am currently learning about it (rather than making my own stuff in DirectX 11) is that its giving me a lot of ideas about what needs to go into a modern game engine and how they are pulling off some of the "tricks". I've already picked up quite a few ideas such as how one might do animated foliage or shadow map a terrain. Of course, I've spent a tremendous amount of time in XNA learning how to program similar things and so I already kind of have a knowledge of what I'm looking for and what I'm looking at even without looking at the underlying code.

In my mind, you have Unity which shields you from the complexities of a game engine by providing the game engine (several other engines like rendering, animation, and physics as well) and level editor for you. At best, you will learn how someone else made a game engine, or at least what features go into such a thing. But you won't ever learn what goes into a game engine (although if you can write shaders for it, that might be highly educational). Then going up in complexity you have XNA which you could "theoretically" write Unity in. With XNA you're getting into the low level stuff that goes into making an engine. And then you have the "real" thing, which would be OpenGL 4.0 or DX11. I consider XNA to be like a "bicycle" compared to DirectX's "motorcycle". A bicycle is something you can put training wheels on or take the training wheels off when you're ready to take them off. Most all the skills you learn of riding a bicycle will apply to riding a motorcycle; its the same thing, but at much higher speeds. Plus, you can't really put training wheels on a motorcycle. And then Unity is far more simple and straight forward than even XNA. Really, Unity obfuscates away the difficulties of programming a game engine, because it simply hands you the game engine and says "go to work".

If you really want to go the C++ (OpenGL or DX) route, I would suggest starting out with something 1,000 times easier than a 3D FPS game engine, such as 3D Pac-Man or something even more simple than that. Even doing that would be a major accomplishment for a small team. And you don't need physics, complex lighting, complex animation, scripting, complex collision detection, etc. for such a project. In other words, you don't need 90% of what goes into a game engine like Unity for that project.

Really, if you have to ask how to make a 3D game engine like Unity, you are probably about 10 years away from being capable of handling it. I've been working at it that long and I think I'm about half way there. So, I think its safe to say that if one were anywhere near ready to accomplish such a project (just in having the necessary knowledge alone) that person would be teaching all of us how to do it rather than asking how to get started. A game engine like Unity is 100s of times more complex than just simply making a 3D game because it supports a wide array of things that may not even be needed in a lot of games and especially not needed in simple 3D games like 3D Pong for example.

If you want to learn how to do it, I would suggest XNA or maybe something else similar where you can learn to program a 3D engine without going off the deep end into OpenGL 4 or DX11. I suggest learning the skills first before learning to take it to the next level in C++ with OpenGL or DX. After mastering the XNA level (or whatever equivalent you learn), I would then consider DX9 as its considerably easier than DX11. Although, if you've truly mastered XNA, you've probably gotten fairly good at HLSL and might be getting close to being ready to tackle DX11 directly. Then after you've gotten pretty good with DX11, maybe you might want to go to OpenGL (I suggest learning DX to get to OpenGL because I think there are more books written on DX and that may give you a strong headstart in learning OpenGL.) Keep in mind that none of this teaches you "game programming". You'll be learning "game programming" as you go, and you need these tools to do "game programming", but physics and animation are really kind of separate topics. That's one of the reasons I recommend XNA, because you can start tackling these other topics in a fairly easy to master environment, such as XNA. In Unity, you won't even get into this stuff, because the tools are just handed to you ready to use.

Then on top of all of that is the actual "making a game". That's where Unity really shines. It's ready for you to make your art assets and design your level and get to the work of making the game, as opposed to programming the "engine".

But for a group of friends who want to just work on a game project largely for fun and maybe for profit, I would just go with Unity. And then if you decide to make your own "game engine" for the next project, then maybe you can go through the long arduous process of learning 3D game programming (a topic you need to master before you think about programming your own "engine").
Was This Post Helpful? 5
  • +
  • -

#8 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,499
  • Joined: 12-December 12

Re: How to create a game engine in C++

Posted 11 January 2014 - 08:25 AM

You always get full value from BBeck :smartass:
Was This Post Helpful? 2
  • +
  • -

#9 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 591
  • View blog
  • Posts: 1,317
  • Joined: 24-April 12

Re: How to create a game engine in C++

Posted 11 January 2014 - 08:42 AM

Oh. I might also point out that there is no single book or tutorial that I am aware of that really teaches you half of what you need to know to make a game engine like Unity. If there is, I want to buy it. I've been looking for such a book for a long time and still keep my eye open for it. The truth of the matter is that the knowledge seems to be scattered across 100+ books and even then is probably not complete. It's kind of like "mining for gold". You just dig and dig and dig into the books hoping to recover some nuggets that you can take home.

Just as an example, I'm flipping through Jason Gregory's book here in my hand. I haven't read it. I bought it a few months ago just to have it on my shelf when I'm ready for it. But thumbing through it, I would say this is no "beginner's" book. The math in it is brutal if you are not fairly math literate (very comfortable with vectors and matrices). And its just simply not an "all inclusive" coverage of programming a game engine. It's 825 pages long not including the index and references. And it gives one page to the subject of terrains. Yes. That's right. One page. Terrains are a subject that could easily fill a 1,000 page book. And in my mind, they are the very first thing you need to have a 3D first person type game. And this book basically doesn't cover them other than a paragraph or two. At my current level of skill, I'm not sure I'm really ready for this book. It looks like it might have some valuable stuff in it, such as how to code skinned animation, but I suspect I'll be able to write the book before I get much out of it. It's not a very "approachable" book just thumbing through it. I think there are probably easier ways to learn the knowledge it contains. But I'll probably read a chapter or two out of it when I'm researching a particular topic.

I would say its written for someone who has quite a bit of experience programming 3D games and just needs more study on some of the specific issues related to game programming. Or more likely, it was written as a text book for a class where an expert professor assigns you a chapter to read to get a brief overview of the topic before he lectures for 3 hours on the subject, and then you do a 3 hour lab coding what was covered in the chapter. Such a course would have Calculus (a couple of years worth) and Linear Algebra as pre-requisites for the course. And this course might still be more of an overview of the subject rather than an indepth course on the specifics of programming a game engine of the complexity of Unity.

But I find this to be "par for the course". None of these books really give you the knowledge that you need in one book. You're lucky if you read 1,000 pages and come away having learned 1% of what you need to learn. Usually, I find that you need to read about 3 books on the subject to have any hope of understanding that one subject. To learn terrain generation I went through many many books and still couldn't figure it out. I finally had my biggest break through when I put the books aside and just started coding based on my own educated guess theories. Once I did that, the books started making more sense and I started "getting it". But, even after all that there's some significant gaps in my knowledge of terrain rendering. For example, I'm aware of some of the large area Level of Detail terrain algorithms, but have yet to learn any of them. I've spent maybe 10 hours or so learning these algorithms, but still haven't succeeded at it. It's on my "to-do" list to learn square diamond and ROAM and such, but currently I'm busy with understanding animation (sculpting, skinning, and rigging) in Blender and how to bring all of that into Unity and eventually (hopefully) how to bring that all into DX11. (Incidentally, this book may offer some help since it discusses animation in a game engine.)

But anyway, I suppose my point is that you can expect to read 100's of books on the subject, go through many tutorials, code and fail and work through the problems over and over, and just generally spend a huge amount of time on this stuff. That's just kind of "par for the course".

And of course, I'll help you where I can if I can answer a question. :-)
Was This Post Helpful? 3
  • +
  • -

#10 BBeck  Icon User is offline

  • Here to help.
  • member icon


Reputation: 591
  • View blog
  • Posts: 1,317
  • Joined: 24-April 12

Re: How to create a game engine in C++

Posted 11 January 2014 - 08:48 AM

View Postandrewsw, on 11 January 2014 - 09:25 AM, said:

You always get full value from BBeck :smartass:


What an incredibly nice way to say "He's long winded, drones on and on, and doesn't know how to say anything succinctly!" :D

This post has been edited by BBeck: 11 January 2014 - 08:49 AM

Was This Post Helpful? 4
  • +
  • -

#11 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 362
  • View blog
  • Posts: 1,539
  • Joined: 08-April 09

Re: How to create a game engine in C++

Posted 11 January 2014 - 10:17 AM

View Postandrewsw, on 11 January 2014 - 04:25 PM, said:

You always get full value from BBeck :smartass:/>


Indeed he does :smartass:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1