C++, please

Started by
6 comments, last by Zolockdevelopment 17 years ago
Okay, I have a few questions as to how exactly to get started in game programming with C++. For example: Where is a good *FREE* tutorial for beginning game programming with C++? Or is there one? How do I get image files to load and display in C++? Is using the WinMain() function better than the Main() function? What is the best method for simulating collision in C++? (Should I use an existing one, if there is one, or should I make my own?)
Advertisement
Hello ShotgunNinja,

Well first you need to define 'good'. It is not easy to say if a tutorial is 'good'. Sure there are millions of 'tutorials' (a better word is explained example snippets) out there. But many (or almost safe to say, all) of them are not meant for absolute beginners.

The best way to learn a programming language is to buy a dedicated book for it. Don't forget that C++ is just a programming language, it can do the same as any other language.

What you are looking for are API's (Application Programmers Interface) written for the C++ language.

Loading and displaying images can be done very simple with every language via the use of forms, but if you want to do it without the use of forms, you have a longer way to go if you are still learning the language-syntax.

I don't know the exact difference between WinMain() and Main(), but I always use WinMain() for Window-applications and Main() for console-applications.

Simulation Collisions within a program is just a implementing a mathmatical algorithm. If you want to visualize the output, you need to write code for that too. For the visualisation you can use DirectX, SDL or OpenGL API's.

I recommend to buy a book first, it will help you on the way alot faster.

I hope this helps,

Regards,

Xeile
Quote:Original post by ShotgunNinja
Where is a good *FREE* tutorial for beginning game programming with C++? Or is there one?
A book would be ideal, but if you're after a free tutorial you could try Learning to Program in C++ at cprogramming.com and/or www.cplusplus.com to learn the language itself. Once you've learnt the language you could then attempt some games; again, a book would be ideal, but there are tutorials out there if that's what you're looking for. Given the massive variety of different tutorials you'll either need to be a bit more specific or search yourself for anyone to be able to recommend those however.

Quote:How do I get image files to load and display in C++?
Using a graphics API such as SDL, DirectX or OpenGL. Of the three I recommend SDL to a beginner; however, you should ideally be comfortable with using the language in the console (text-mode) before trying out graphics.

Quote:Is using the WinMain() function better than the Main() function?
Neither is better, they serve different purposes. Winmain is for Win32 applications.

Quote:What is the best method for simulating collision in C++? (Should I use an existing one, if there is one, or should I make my own?)
There are lots of ways to do this, depending on how many objects will likely be colliding, how you're storing the data, how many collisions you expect, 2d/3d, etc. If you're doing it as a learning excercise then doing it yourself should teach you lots about it - if you're more interested in actually getting a game working you're probably better off using an existing library unless you only need nice simple collisions anyway.

- Jason Astle-Adams

Okay, thanks guys, I actually have some previous knowledge of C++, but not a very intensive grasp of the language. I do, however, know quite a bit from my experiences with QBasic programming, Visual Basic programming, and many types of Web languages. I had thought that C++ had a function built into it for images that I just hadn't found yet or something. But I will have to look into graphics APIs, then. Know any good (reliable, easy to use, and offering a large level of control) graphics APIs? (By the way, for now I'm just starting with 2D programming.) I have heard good things about DirectX in the past, but I don't know how to get/use/apply it.

Sorry about the WinMain()/Main() question.

And about the collision, I was just asking if there were any good premade APIs (or whatever) for collision systems.

Also, someone should really write a website article on beginning game programming. There are surprisingly few out there that offer an in-depth understanding of how exactly to go about making games for beginners (a.k.a. the iconic beginner's games, Tetris, Breakout, and Asteroids). There are some for other programming languages, but not that many for C++.
Quote:Original post by ShotgunNinja
And about the collision, I was just asking if there were any good premade APIs (or whatever) for collision systems.


Yes there are many many free & expensive libraries for collision detection and physics in general that range from awesome to crap.

Quote:Original post by ShotgunNinja
Also, someone should really write a website article on beginning game programming. There are surprisingly few out there that offer an in-depth understanding of how exactly to go about making games for beginners (a.k.a. the iconic beginner's games, Tetris, Breakout, and Asteroids). There are some for other programming languages, but not that many for C++.


Did you read the "for beginners" forum FAQ yet?

http://www.gamedev.net/community/forums/showfaq.asp?forum_id=31

-me
If you need a good book here you go.

http://www.steveheller.com/cppad/Output/dialogTOC.html

Online and free, amazing too. If you read through everything (may take about a month) you will be able to definetly move on to programming games. This is the book that really got me started, it explains everything reall nicely, also using the other tutorials that were mentioned help.

The good thing about this book is it doesn't just teach you how to code, it teaches you how to think in code, which will help get your head around very hard subjects such as pointers in the future.
Quote:Original post by ShotgunNinja
Know any good (reliable, easy to use, and offering a large level of control) graphics APIs? (By the way, for now I'm just starting with 2D programming.)
My recommendation would be SDL. There are plenty of tutorials around to get you started with it; Lazy Foo's tutorials seem to be quite popular, you'll undoubtedly find plenty more with a bit of searching.

Quote:And about the collision, I was just asking if there were any good premade APIs (or whatever) for collision systems.
There are literally hundreds out there offering vastly different quality/capabilities/etc. and with a huge range of prices from free to very expensive. ODE would be an example of a high-quality library that's freely available and offers collision-checking functionality, although it's not neccesarily all that well suited to relatively simple 2d projects. Unless you're attempting something particularly complex it's probably just as easy to write your own for relatively simple 2d projects.

- Jason Astle-Adams

There is a book by Thomson that gives you all the info you need to know. It is only $39.99
I am the heart of video games

This topic is closed to new replies.

Advertisement