Jump to content
  • Advertisement
Sign in to follow this  
Abdallah

How do i start learning more into gaming programing in C( i know the basics)

This topic is 2860 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

To everyone,
i am posting this thread to know what kind of information do i need to learn about games programming in C ( i know all of the basic codes but i need to know how to apply them to a game program of any kind) but i don't know where to get this kind of info..if someone can tell me where to get the games programming started would be appreciated.Thank you!

[Edited by - Abdallah on August 22, 2010 4:29:26 AM]

Share this post


Link to post
Share on other sites
Advertisement
1) You'll want to edit your post to use [source] tags.

Quote:
1. line 40, 56 and 91 error(s): expected ')' before '!' token!


Line 40: while( (k >=0 && Field[k]) !-2)
Line 56: while(k < 30 && Field[k++] !-2);
Line 91: while(i< 15 && Field[i++][k] !-2)
You probably mean !=
Did you even check for typos? Your parenthesis are in the wrong order too, from the looks of it.

Quote:
2. line 154, 158, 172, 182, 184, 267 and 269 error(s): 'for' loop initial declaration used outside C99 mode!

You have code like:
for( int i = 0; i < 15; i++)
{
...
}
for( i = 0; i <15; i++)



This is not legal -- i only exists for the duration of the for loop. This was allowed in Visual Studio 6, which predates the C++ standard and is over 10 years old. If you're using it, you may want to upgrade to download Visual Studio 2010 Express for free, which isn't a decade old.

It also sounds like you may be compiling as pure C, which may require all these variable definitions to be at the very start of the function, which inside the for loop is not.

Quote:
3. line 365, 413 and 544 error(s): expected '=', ',', ';', 'asm' or '_attribute_' before '{' token!


Missing semicolon:
362 LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP);
363
364 void MyCW(HINSTANCE HI, int ncs)
365 {





At this point I gave up because there were too many errors to count before line 413. Certainly, the compiler is probably well and confused at this point, and there's no super-obvious error for once, so it could be a false positive.

If this is your code, you need to start fixing compiler errors before they get this bad.
If you're typing up somebody else's source code, please doublecheck for basic typos around the lines you're getting errors on.
If you copy+pasted somebody else's source code, or their code includes these typos, please blacklist their website or book and never return to it, you'll be much better off not trying to decipher this horribly broken and unreadable mess.

Share this post


Link to post
Share on other sites
Hmmm. Seems soooooo familiar [grin]

Well, I say copy my code again, I don't get it how to managed to make those typos in my code.

But I suggest one thing. Don't learn by copying someone else's code and just rename the functions and variables. It's totally worthless. You can't even solve those errors (hint: they are typos), so i guess you are a total beginner.

This learning method of yours if totally useless.

EDIT: the code is horrible, but I made it clear in the thread where I posted the thing. I just threw together the thing. There's even an unused stuff (keyboard buffer) in the thing.
And it wasn't that horrible (it compiles for example), the ripper changed all the meaningful variable/function names to some horrible abbreviations.

It seems it was a very poor attempt to disguise the copy/paste.
I recognised the code at first glance.

Share this post


Link to post
Share on other sites
mm if there is another way on learning how to program C games let me know then :/ for as i don't know what other ways could be dealt with. Thank you for those who replied on the errors

Share this post


Link to post
Share on other sites
I would suggest you pick up a book and go step by step through it, so you'll learn how to correct your own code (this seems to be simply copied from somewhere), instead of posting all (562 lines) of it and say help me. That way you'll eventualy learn to read & work with the compiler errors, like the 1st one. It tells you that ')' is expected before '!', so what do you do? You go to that line and see where '!' is located, then you check if you had forgotten a ')' before it. Seeing everything is ok with the brackets, you go back to '!' and read that line. It shouldn't take you long to see that your not comparing, but negatating, so '=' is missing.
Now I didn't go and compile your code and certainly I woun't go check through all of it, else you'll never know how to correct it yourself, so I only posted a fev lines where the errors might be:

line 40, 56, 91:

"!-2" (wrong)
"!= -2" (right)

line 365, 413:

problem on line 362 (WTF?)
-------------------------------------------------------------

As for the other errors, I suggest that you go to that line and check if there is anything wrong within that line. If not check if you have a function called in that line and go to it. If it isn't even that, than go on line up (or one line back to simplify it) and check for errors there.

Share this post


Link to post
Share on other sites
i see....1 question tho...what kind of book does it show me how to pragram Games not the actual C itself because i do know the basics of C language soo far and i need to start a game program from scratch..THAT is where i don't know where to get these kind of info..if anyone knows what kind of book do i need to read so that i can know more about games programming would be appreciated.Thank you.

Share this post


Link to post
Share on other sites
Quote:
Original post by Rastur
I would suggest you pick up a book and go step by step through it, so you'll learn how to correct your own code (this seems to be simply copied from somewhere), instead of posting all (562 lines) of it and say help me. That way you'll eventualy learn to read & work with the compiler errors, like the 1st one.

Seconded. I'm sure some people can link some of the good, free, C++ 'books' available online, that will start from the beginning. I believe Thinking in C++ is considered one of them?

Share this post


Link to post
Share on other sites
I didn't have books for game programming.

And I think you have problems with the language too, you should be able to correct those typos. So go back and learn a bit more of C, then start to make small, very small programs. Not games. Just little programs that asks the user to enter two numbers, then it adds/multiplies/whatever them, and prints the result. It's just an example.

Then, make a bit more complicated programs. Then make little console games: tic tac toe for example.

You wanted to jump into a relatively complex game (tetris) in win32, GDI, messaging system, game loop. I bet you have no ideas what these are.

Start small.

Share this post


Link to post
Share on other sites
This book comes in handy but....i need to program games in ACTUAL C language not C language of any kind because the unit im studying at uni applies to the C language for now and what im trying to do is...making a game program for my assignment. Later on, ill get to know more about C++ because i want to know more about game programming

Share this post


Link to post
Share on other sites
Quote:
Original post by Abdallah
i see....1 question tho...what kind of book does it show me how to pragram Games not the actual C itself because i do know the basics of C language soo far

Not to be mean, but, you sure fooled us! These were extremely basic errors, with problems that should be self evident to someone who does indeed know the basics of C.

Quote:
and i need to start a game program from scratch..

I'd recommend starting with a simpler, text based game, such as hangman or guess the number. Unfortunately, starting from other code won't give you much insight as to how to start from scratch. This isn't to say never look at the source code of games, but learning to program something from scratch is mostly about figuring out how to solve the problem yourself -- there's no easy answer, no set pattern of how you must go about it.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!