Skip to main content
GameDev.net gamedev.net
🔒 Locked

C++ game from scratch in 3d with models

Started by kks21199 Feb 14, 2013 at 1:58 PM 11 replies 4.5k views
Original Post
kks21199
kks21199

Hello, guys, i just wonder how could i make a game from scratch in c++. I know it is easy to make tic-tac-toe and such thin, but how do you make a 3d game. Can anyone show me how ? Or i will give some models and can anyone help me by showing how to do it or is there anothher tutorial out there already ??

Ya, i know, we can use game engines, like unity ce3 or ue3, but still I just want to learn...

frob
frob
It is generally best to start with the basics.

Obviously you will need a good understanding of the c++ language and libraries. It is much better to learn how to use the language effectively by working on many small projects rather than jumping in to the fire with a huge project and no inkling of what you are doing.

Your knowledge of the language and system libraries will need to cover a wide range of algorithms, data structures, containers, serialization, scheduling, and so on. You will probably also want to pick up some audio libraries, user interface libraries, and so on. Just like with learning the language, it is often best to learn these on smaller projects rather than jumping in to a huge project without any prior understanding.

Next, for a 3D game you will need a solid understanding of linear algebra. That is the mathematics of 3D rendering. Usually it is taught at the college level, but some programmers are able to pick it up from web tutorials and such. Again, it is easier to understand matrix and vector manipulations, transformations, topologies, eigenvalue/vector uses, and so on, by learning them on a smaller scale before jumping in to a large scale.

Once you understand the mathematics behind it, you'll need to learn how to implement the math. Usually this takes place by writing your own 3D skinning code, animation code, motion controllers, etc., accompanied by assorted questions about why your 3D model sometimes looks like a pile of exploded triangles rather than the intended shape. It also includes learning to write shaders and particle systems and much more. Just like above, smaller projects are easier for learning.


It is NOT just a matter of a beginner opening a text editor, throwing together a bit of code, and pointing it at a collection of 3D models.
YucelKaramanli
YucelKaramanli

As Frob mentioned, aside from C++ you definitely need strong understanding of some linear algebraic terms. However there are more things to cover as well. otherwise it will be just a rendering engine not a game. A game has to be interactive in order to be called a game. for that reason you need some collision detection engine. if you are brave enough to implement that yourself, then you need to learn math behind collision detection as well.

start with something simple such as AABB vs ray, AABB vs AABB, OBB vs OBB Sphere vs Sphere and so on. You must understand the basics of matrix and vector manipulation before you dive in to collision detection though, otherwise you won't make sense of things.

I would recommend following books.

3D math primer for Game development(by Fletcher Dunn & Ian Perberry)

and

3D game engine Programming(by Stefan Zerbst & Oliver Duvel)

BCullis
BCullis

Just to highlight a point that I think gets smoothed over in Frob's coverage (no knock to the otherwise great primer on the size of the step you're taking), the word libraries is a huge component. DirectX (specifically Direct3D) or OpenGL will likely be necessary, as almost no one just straight-codes all the 3d functions and graphics-card interfaces necessary to do 3d graphics rendering. All the current engines you're referencing use these for their 3d graphics. Both libraries are still low-level enough that you'll get PLENTY of practice implementing your game-specific 3D tasks.

OpenGL and Direct3D have plenty of tutorial series across the web, just google them. They all rely to some degree on the reader being comfortable in C++ already (syntax and general programming concepts for sure).

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)
kks21199
kks21199

ya, i just want to see a sample project now, so i can see how they are doing it.

papulko
papulko

ya, i just want to see a sample project now, so i can see how they are doing it.

Like Frob said, trying to grasp the whole concept at once will only result in frustration.

frob
frob

ya, i just want to see a sample project now, so i can see how they are doing it.


Finding source code isn't hard. Just seaarch github for "3d game".
Stroppy Katamari
Stroppy Katamari
If you make a 2D game that just uses 3D graphics, the only thing that needs to be different about the engine is the rendering component.
So what you actually need is tutorials to use a graphics interface, not an entire game engine.

These tutorials read very nicely and use modern-style OpenGL. As you can see, model loading comes up at tutorial 7.
http://www.opengl-tutorial.org/
kks21199
kks21199

thanks guys

kks21199
kks21199
and also atleast give me a source for a begineers to start off
BCullis
BCullis

ya, i just want to see a sample project now, so i can see how they are doing it.

Try any of the first tutorials in a series at RasterTek.

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)
Datamancer
Datamancer

Seeing as everyone above me has already given great answers, I will just reiterate. You need a solid grasp of your language of choice, the libraries you choose (if you choose any), paradigms, algorithms, etc.



and also atleast give me a source for a begineers to start off

You really need to use Google and do the research for yourself. Regardless, this should get you started:

https://github.com/id-Software/DOOM-3-BFG

This is the complete source code to Id Software's Doom 3 BFG edition. This contains the entire engine and game code, but no assets. If you are going to take a look at the Doom 3 BFG codebase, you might also find this code review helpful.

http://fabiensanglard.net/doom3/index.php

~Byte.

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is ob
kks21199
kks21199

Seeing as everyone above me has already given great answers, I will just reiterate. You need a solid grasp of your language of choice, the libraries you choose (if you choose any), paradigms, algorithms, etc.


and also atleast give me a source for a begineers to start off

You really need to use Google and do the research for yourself. Regardless, this should get you started:

https://github.com/id-Software/DOOM-3-BFG

This is the complete source code to Id Software's Doom 3 BFG edition. This contains the entire engine and game code, but no assets. If you are going to take a look at the Doom 3 BFG codebase, you might also find this code review helpful.

http://fabiensanglard.net/doom3/index.php

~Byte.


thanks, i had the doom thing before, but i didn't know how to use it, now i just got to know what was the use of it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.