Making a 3D game in C++ without a game engine?

  • C/C++
  • Thread starter Algren
  • Start date
  • Tags
    3d Game
In summary: Dev C++AFAIK, Turbo C++ doesn't support any 3d Graphics library. Other than that, TurboC++ is a 16-bit compiler & it produces 16 bit binaries. 16 bit stuff doesn't run well on Win7-64 bit edition - you will need to use an emulator.Download Visual C++ (I think non-commercial edition is free) or g++ (this is fully free) Then you can use OpenGL or DirectX for programming 3D Graphics. If you want to learn more about Computer Graphics - pick up the book by Hearn & Baker.
  • #1
Algren
74
1
I don't want to use any game engine.

I want to use only C++ to make a 3D Game. How can I do so?

I have made many 2D games, like chess, connect 4, mario, snake, etc.

But how do i do 3D and make things like DOOM?

I use the OLD Turbo C++ Compiler, not Dev C++
 
Last edited:
Technology news on Phys.org
  • #2
Algren said:
I don't want to use any game engine.

I want to use only C++ to make a 3D Game. How can I do so?

I have made many 2D games, like chess, connect 4, mario, snake, etc.

But how do i do 3D and make things like DOOM?

I use the OLD Turbo C++ Compiler, not Dev C++

AFAIK, Turbo C++ doesn't support any 3d Graphics library. Other than that, TurboC++ is a 16-bit compiler & it produces 16 bit binaries. 16 bit stuff doesn't run well on Win7-64 bit edition - you will need to use an emulator.

Download Visual C++ (I think non-commercial edition is free) or g++ (this is fully free) Then you can use OpenGL or DirectX for programming 3D Graphics.

If you want to learn more about Computer Graphics - pick up the book by Hearn & Baker.
 
  • #3
phiby said:
AFAIK, Turbo C++ doesn't support any 3d Graphics library. Other than that, TurboC++ is a 16-bit compiler & it produces 16 bit binaries. 16 bit stuff doesn't run well on Win7-64 bit edition - you will need to use an emulator.

Download Visual C++ (I think non-commercial edition is free) or g++ (this is fully free) Then you can use OpenGL or DirectX for programming 3D Graphics.

If you want to learn more about Computer Graphics - pick up the book by Hearn & Baker.

Well, i will have to make a great deal of syntax change to transfer into another compiler.

Although, then what is the best possible game makeable in TC?
 
  • #4
Algren said:
Well, i will have to make a great deal of syntax change to transfer into another compiler.
Depends. All the standard C++ stuff remains the same. But any compiler specific functions you have used would need to be rewritten. Another thing to remember is that TC is a 20 year old compiler. C++ has changed radically since those times. Most standard code written in TC++ would still work in a modern C++ compiler, but current C++ is far more powerful & offers you really powerful features (templates etc) which will make programming easier for you.

However, since you say that you have only written 2d games till now, wouldn't you have to scratch from scratch anyway to make 3d games?

Algren said:
Although, then what is the best possible game makeable in TC?

You can do 3D - but you would have to write you own 3d library which would be non trivial exercise. If you are serious about programming, take the plunge and move to a modern compiler & library.

By the way, I am not a game programmer.
 
  • #5
First off, you probably do want to use a game engine. Here's a list of game engines suitable for a hobbyist, some free...

Second off, I recommend using Dev-C++ or Microsoft Visual Studio Express.

Third off if you just want to start drawing 3D and do not want to rely on a library, the best thing to do is start learning OpenGL or DirectX. What I like to do is use SDL to create an OpenGL window and draw OpenGL inside of that. I use this approach because it means my code is very portable and can run on all operating systems. (If you are careful to write "OpenGL 3.0" or "OpenGL ES", you can even port to mobile phones easily.) There are many OpenGL tutorials on the internet.

Here is some OpenGL sample code I put on the internet but I am not sure it will help you much if you are a beginner... http://msm.runhello.com/?p=385

If you really, REAAALLLY just want something that looks like "doom", and you have working 2D drawing already, the original "doom" was done using "ray casting" and rendering in CPU. You can easily do the math for ray-casting yourself and then just splat that to screen with your existing 2D drawing tools. I find a tutorial on raycasting here. However this is not what you want, you want to be using a modern 3D API with GPU acceleration. 3D in CPU will be very slow and not look very good.

Well, i will have to make a great deal of syntax change to transfer into another compiler.
If you have actually written code which will break if you change C++ compilers, then it is bad code and you want to replace it anyway.
 
  • #6
Algren said:
I don't want to use any game engine.

I want to use only C++ to make a 3D Game. How can I do so?

I have made many 2D games, like chess, connect 4, mario, snake, etc.

But how do i do 3D and make things like DOOM?

I use the OLD Turbo C++ Compiler, not Dev C++

Hey Algren and welcome to the forums.

As other posters have pointed out, using a game engine to make games is a good idea. I say its vital because it will take you a very very long time to get things done.

You should note that DOOM is actually a raycaster. It's not a true 3D rendering application like you see in your modern games. Quake was the one that filled this gap. You can get source code for both binaries from the iD website if you want to learn about this.

Also as other people have mentioned you will need to switch compilers. There are a few to choose from: Visual Studio is good for its interface. You could use Dev-C++ but I don't like its interface as much as VS.

Making 3D games is a lot of work. As other posters have pointed out, there are a lot of open-source hobbyist engines out there that allow you to get something up and running fairly quickly, and allow you to integrate game specific code fairly easily.

The biggest headache is learning the internals and how to get the stage of adding content (art assets or code) to where you can get what you want up and running straight away.

It takes a little while before you become able to get stuff up and running the way you want it with an existing engine, but its worth it. I wouldn't code your own from scratch unless you really, really want that learning experience. I did this to a large extent and it was a great learning experience for me, but it took years of my life to do this.
 
  • #7
Really you might be happiest just downloading Unity 3D and using C#. If you already know some C++ it is not a big jump.
 
  • #8
there was no mention of IDEs but both Eclipse and NetBeans supports C++ development and provides the same kind of experience as Turbo C++ does complete with code completion and code debugging. Learning these IDEs are crucial for modern programming development.
 
  • #9
I'll give the cheeky answer.

Algren said:
I want to use only C++ to make a 3D Game. How can I do so?

It's impossible: C++ simply doesn't offer you the features to do so. Of course, the same is true of most programming languages.


However, C++ (and most languages) is flexible enough that third parties can provide you libraries that let you do graphics and other stuff.

For example, absolutely nothing in conio.h is part of C or C++. Instead, that was a bonus feature a lot of old MS-DOS vendors decided to bundle with their product.
 
  • #10
Hurkyl said:
I'll give the cheeky answer.

It's impossible: C++ simply doesn't offer you the features to do so. Of course, the same is true of most programming languages.However, C++ (and most languages) is flexible enough that third parties can provide you libraries that let you do graphics and other stuff.

For example, absolutely nothing in conio.h is part of C or C++. Instead, that was a bonus feature a lot of old MS-DOS vendors decided to bundle with their product.

Lol, you're a bastard Hurkyl :)
 

1. How do I get started making a 3D game in C++?

To get started making a 3D game in C++, you will need to have a basic understanding of C++ programming language and its syntax. You will also need to have a game engine or graphics library that supports 3D rendering. Some popular options include OpenGL, DirectX, and Unreal Engine. You can also find tutorials and resources online to help you get started.

2. What are the key components of a 3D game in C++?

The key components of a 3D game in C++ include graphics rendering, game logic, physics, audio, and user input. Graphics rendering is responsible for creating and displaying the 3D objects and environments in the game. Game logic handles the rules and mechanics of the game, while physics calculates the movement and interactions of objects in the game world. Audio is responsible for playing sound effects and music, and user input allows the player to interact with the game.

3. How do I create 3D models and animations for my game?

There are several ways to create 3D models and animations for your game. You can use 3D modeling software such as Blender, Maya, or 3ds Max to create and animate 3D models. Another option is to use pre-made assets from online marketplaces or game asset stores. Some game engines also have built-in tools for creating and animating 3D models.

4. What are some common challenges when making a 3D game in C++?

Some common challenges when making a 3D game in C++ include optimizing performance, managing memory usage, and debugging complex code. 3D games can be resource-intensive, so it is important to optimize your code and assets to ensure smooth gameplay. Managing memory usage is also crucial to avoid crashes and other technical issues. Additionally, debugging a 3D game can be challenging due to the complexity of the code and the various components involved.

5. Are there any resources or tutorials that can help me make a 3D game in C++?

Yes, there are many resources and tutorials available online to help you make a 3D game in C++. You can find tutorials on specific game engines or graphics libraries, as well as general guides on 3D game development. Some popular resources include Unity Learn, GameDev.net, and YouTube channels such as TheChernoProject and ThinMatrix.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
1
Views
950
  • Programming and Computer Science
Replies
19
Views
2K
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
Replies
13
Views
996
  • Programming and Computer Science
Replies
17
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
3
Views
679
  • Programming and Computer Science
12
Replies
397
Views
13K
Replies
2
Views
793
Back
Top