• Advertisement
Sign in to follow this  

New to game developing

This topic is 4256 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone. I have just started getting into game developing and hopefully I'll feel like I actually know what Im doing after I get through the basics. =P Right now Im reading "Beginning C++ game programming" and "C++ for dummies". Its pretty confusing for me right now but hopefully I'm going in the right direction. If you guys know any good books for starters Im more then happy to take your suggestions.

Share this post


Link to post
Share on other sites
Advertisement
Do you mean more C++ books? Books on graphics? What are you looking to learn more about?

Share this post


Link to post
Share on other sites
You should definitely check out the C++ Workshop thread

Share this post


Link to post
Share on other sites
One of the best tips I can give you is to NOT skip over the basic material. It might seem like a good idea to learn an API right away like directx or opengl but just wait. You need to know the basics of the language before you start into any type of graphics. Grab a few more C++ books and go through them until you can mostly every practice question.

Share this post


Link to post
Share on other sites
Hopefully these books will eventually get my attention. I've done alot of reading and a barely understand how to make a "guess my number" game. XP

I want good books on ANYTHING that I'm going to need to learn about 3D game developing.

Share this post


Link to post
Share on other sites
That "Guess My Number" idea is a good one. When I was learning C++, I created a small text-based RPG where I read the map and descriptions from a text file and typed in commands to move around. I recommend starting off with a small project like that. It should be:

1. Within your bounds of ability.
2. Challenging.
3. Interesting to you.

I had a lot of classmates who didn't like what they programmed for class but never thought to program for themselves outside of what they were assigned. I would hazard a guess and say that they didn't learn as much as myself and others who found interesting program ideas to create.

Share this post


Link to post
Share on other sites
I read C++ for Dummies (I read the fourth edition, I don't know if they have made any "better" editions since then) and while it made the basics of C++ easy to understand, there were several important aspects of the laguage it didn't cover, and some of the things it said were just plain incorrect (it didn't seem like the writers even knew the C++ standards exisited). Luckily, I had just borrowed it from the library, so I just returned it after I read it and bought a better C++ book (The C++ Programming Language by Bjarne Stroustrap (the creator of C++)). Having read C++ For Dummies, (and Sam's Teach Yourself C++ in 21 Days, which is the book they are using in the C++ Workshp thread) helped me grasp the concepts in this book much easier.
I'd say after you finish reading the books you are reading now (and maybe another C++ book too if you want), you should definitley give The C++ Programming Language a read, it covers almost all (if not all) aspects of the language, and it is correct.

Share this post


Link to post
Share on other sites
Quote:
Original post by An0maly
Hopefully these books will eventually get my attention. I've done alot of reading and a barely understand how to make a "guess my number" game. XP

I want good books on ANYTHING that I'm going to need to learn about 3D game developing.


Then you need to stop and slow down. I'm reading your exact book (Beginning Game Programming in C++, and have also read around 100 pages of C++ for Dummies 5th Edition). If you have done a lot of reading then a guess my number game should be easy. Work on that before continuing on. I'll help you, one beginner to another. Now, who will be the one guessing the number :).

Share this post


Link to post
Share on other sites
What problems are you having with "Guess the Number"?

If my code doesn't help then just tell me your problem.

Here's my code:


#include <iostream>
#include <ctime>
using namespace std;
int main(void)
{
int guess, num;
bool guessed = false;
srand(time(NULL));
num = (rand() % 100) + 1;

while (guessed==false)
{
cout << "Try to guess the secret number between 1 and 100: " << endl;
cin >> guess;
if ( guess == num )
{
cout << "You have guessed the number!!!!" << endl;
break;
}
else if ( guess < num )
{
cout << "Your guess was too low." << endl;
cout << "Guess again." << endl;
}
else
{
cout << "You guessed too high." << endl;
cout << "Guess again." << endl;
}
}
return 0;
}

Share this post


Link to post
Share on other sites
Hi, If you are new and want to become more effecient in C++ then come to CPP workshop. WHere we can clear our doubts and understand the concept more clearly.: here

@bxela1, I haven't tried your program so far but I can program "guess a number" by giving some conditions. But can you tell me about

#include <ctime>, srand(time(NULL));, num = (rand() % 100) + 1; these are new to me.

Share this post


Link to post
Share on other sites
kimi,

#include <ctime> includes the ctime library header file. This file is part of the Standard C++ Library and, among other things, lets you get what the current time is in milliseconds with the time() function.

rand() and srand() are functions in the standard c++ library that handle generating random numbers.

rand() returns a random number between 0 and 32767. Before you use rand(), you have to "seed" the random number generator (this is due to the way the computer generates random numbers).

srand() is used to seed the random number generator. This is typically done by passing in the current time in milliseconds.

So the code srand(time(NULL)); basically sets up the random number generator.

Writing num = (rand() % 100) basically means get a random number between 0 and 99. You then add one to this to get a number between 1 and 100.

% is the modulus operator. It returns the remainder of a division. The result of an expression x % y will always be between 0 and y-1, so you can use it to limit the random number generated.

Wow, thats longer than I thought it would be! Hope it helped!

Share this post


Link to post
Share on other sites
Quote:
Original post by mike223
rand() returns a random number between 0 and 32767.


I'm pretty sure that the max that rand() returns depends upon the implementation of the standard library (this means that whoever writes the compiler gets to choose and you are not guarranteed to get the same results with different compilers or different operating systems). But, that is what many compilers use.

Oh, and if you haven't used random number generators before, what 'seeding' does is it gives the generator a 'starting point'. This isn't used as the first random number, but it is used in some complex math formulas to create a psuedo random number. If it is seeded with the exact same value twice, it will produce the same results both time. Like so:

srand(5);
std::cout << rand();
std::cout << rand():

Running this program would get the same results every time that it is run. To make sure that your random number guesser doesn't always give you the same number to guess, you seed the generator with a seed that will be unique per run. The number of milliseconds that the computer has been turned on will be close enough to unique, so that is an excellent (and common) seed.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ezbez
Quote:
Original post by mike223
rand() returns a random number between 0 and 32767.


I'm pretty sure that the max that rand() returns depends upon the implementation of the standard library (this means that whoever writes the compiler gets to choose and you are not guarranteed to get the same results with different compilers or different operating systems). But, that is what many compilers use.


To extend, just to be sure, you can use RAND_MAX.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement