Sign in to follow this  

A game programmer to be ( C )

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

[Introduction] Hi, before i start asking questions i would like to introduce myself. The names Reegan and ever since i can remember ive loved playing games, and have always wondered how they were made. Almost two years ago i downloaded a program called Gamemaker 6.0 i got quite good at it and was a regular on the forums. About a week ago i decided i wanted more so i decided to program in C. Game programming is my most favorite hobby, i cant think of anything better than seeing a program i wrote from scratch, working. When i first started programming games i never thought about getting into the games industry, just as a hobby really. Im starting a course on game design next year in South East Essex college(the guy who made tombraider series studied there :D ). [Question (sort of)] So basicly what i want to know is where should i start? i want to get started on a simple program really like moving a ball left to right or something i already know alot about functions, variables, arrays ect.. (the basics) what i want to know is how you implement graphics and retrieve keyboard input (arrow keys) from a user ive searched through alot of tutorials over the net but its to much information for me to handle all at once. I need it bit-by-bit and perhaps some working source code would be nice. anything you feel i should know would be nice also. Thanks to for those who reply ~Reegan~ OS: Win XP home IDE: Dev - C++ Lang: C

Share this post


Link to post
Share on other sites
C isn't a good beginners language. I would recommend you start with Python or C#. The Python website has all you'll need for Python -- tools, documentation, et cetera. For C# you can download Visual C# Express from MSDN and use the learning resources on MSDN or on the C# Workshop here on the forums.

Share this post


Link to post
Share on other sites
I also don't see much in the way of a specific reason to start learning with C. Python is an excellent beginners' environment and you sacrifice little to no performance that you wouldn't already be losing from newbiehood.

What's more important than performance is that it gets the concepts across easier.

Share this post


Link to post
Share on other sites
The simplest solution would be to use an external library to handle graphics and input. I recommend SDL since you are using C. SDL can handle input, graphics and sound abstractly without having to worry about any low level platform code. Tutorials can be found here from Lazyfoo.

Share this post


Link to post
Share on other sites
Quote:

So basicly what i want to know is where should i start? i want to get started on a simple program really like moving a ball left to right or something

i already know alot about functions, variables, arrays ect.. (the basics)
what i want to know is how you implement graphics and retrieve keyboard input (arrow keys) from a user ive searched through alot of tutorials over the net but its to much information for me to handle all at once. I need it bit-by-bit and perhaps some working source code would be nice.


For handling stuff like graphics,audio,input,physics and such you have to use libraries. Libraries are nothing more than a collection of functions and classes that you can use from inside your program. Google names like OpenGL,DirectX,SDL,Ogre3D,Torque,Irrlicht,Newton Game Dynamics,ODE,PyGame,XNA,OpenAL,FMod. Those are just some of them.


Just my opinion now: It's all your choise, but I would advise against using C. It's a primitive language, and you will get involved with a lot of unnecessary low-level stuff. Higher-level languages like C#(using XNA) or Python(using PyGame) would be better. If you insist for a C-like language, at least use C++ that comes with the C++ Standard Library, which will help you a lot.

Now, for a sample, this is how a "bouncing ball" demo looks like in Python+PyGame. It's about the simplest you can get, in other languages you will probably need more code to do something like this:

PyGame Tutorial

Share this post


Link to post
Share on other sites
I'm quite new to this game programming too.
My advice would be that you chose C++ instead of C. It's quite nice, and it can do what C can + more :) I started using some SDL and have just moved on to OpenGL doing some basic-stuff. I have just made a snake game in OpenGL.

C++ was my first real language - though I have been playing around with Delphi before. I can recommend the book called "C++ Primer Plus 5th Ed.". It's a bit dry in the start, but it's VERY NICE!

God speed and welcome :)

Share this post


Link to post
Share on other sites
This is great! Thanks for your replies.

Let me explain why i chose C.
I chose C because it looks more familiar to me from my first newbie programming language the way its layed out if you know what i mean.

I didnt just decide that i was going to code in C at first i spent a whole day reading different languages and looking at source code for different languages.
Since C seemed more familiar and i got a hold of the basics quickly
it felt like the right choice to make for my "real programming language."

When i looked at C++ and others they all seemed like a totally new language's an i figure it would take me a while before i got very far.

Now i regret choosing C because ive spent a week looking over a lot of tutorials and reading books from the college library.
It just seems a shame to me to not finish something i started is all.


If you strongly suggest i try a higher level language then i guess i could try but i would rather not if possible.

Share this post


Link to post
Share on other sites
C is a poor choice for a beginner. You're much better off starting out with Python or C#.

Emphasis on "starting out". You can (and should) always learn more languages at some point, but Python or C# will help you concentrate on programming rather than on fighting the language every step of the way. C is not an easy language to get right, especially for a beginner.

Share this post


Link to post
Share on other sites
Quote:
Original post by trojanman
Quote:
Original post by Reegan
Ok thanks, you've twisted my arm, i'm going to choose C#.

One more question, Which IDE should i use for C#?


Visual C# express.


Cry cry cry - another one joining the C# team :'(

And mikeman, what's not to understand? My first REAL language was C++. But before I read my C++, I did some playing around with Delphi. You know how that works?

Share this post


Link to post
Share on other sites
Dont worry Mad, eventually ill get round to doing some C/C++
Thos are the languages id prefer to work with but for no whilst ima newbie ill have to deal wih this one :)

Embarassing question:
How do i compile and run my program? i tried build then start debuging
but i didnt get anything come up like it said it should in the tutorials.
im trying to get the traditional "Hello world" to be displayed in the window

EDIT: Never mind i fixed it.

But now i have another question...
Why do tutorials never explain how to stop the program from exiting once the computer has finished all the code and how would i go about stoping this in C#

[Edited by - Reegan on September 18, 2007 7:09:21 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Reegan
But now i have another question...
Why do tutorials never explain how to stop the program from exiting once the computer has finished all the code and how would i go about stoping this in C#


Because that's what console programs are supposed to do after they're done: after they've done their job, there's no need for them to hang around. Technically, the window you see isn't your program, it's just a temporary window that your program sends it's output to.

Of course, for beginners, and while testing, it's usefull to have it stick around. An often employed method is to ask for input before the program ends. You can also set a breakpoint - the program will halt once it encounters this breakpoint, after which you can resume your program or step through further code manually (usefull when debugging your code). Also, you can run the program from within a command window: after the program is finished, it stops, but your command window stays open, so you can still view the output.

Share this post


Link to post
Share on other sites
I'll probably get some crap for this, but you should start out with whatever language you want to. I started with C and have no regrets. Well, I actually wish I would have started with assembly language, but other than that no regrets.

C is definitely a low level language and doesn't hold your hand like some other high level languages do. It's definitely not the easiest language to start with, but once you gained a solid grasp on C programming, a bunch of other languages will come easily to you.

If you want to work in the game industry, C++ is still the standard, with C# rapidly gaining ground in the area of tools programming.

However, if you just want to make games by yourself, it doesn't really matter which language you use, provided it does what you want it to. Go with whatever makes the most sense to you.

Coming from a background in Gamemaker (if you've done any scripting with it), you'll feel right at home with C or any C-derived language such as C++, C#, Java, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by madsravn
And mikeman, what's not to understand? My first REAL language was C++. But before I read my C++, I did some playing around with Delphi. You know how that works?


I think he objects to the implication that Delphi is somehow "not a real language".

Share this post


Link to post
Share on other sites
Captain P: Thanks! :)

Morx: Ok thanks, im starting to like C# now especially the Microsoft IDE Visual C# Express by the way all my games where scripted/coded.

Zalhman: ?? huh.. ??

--------------------------------------------------------------------------------

Now that ive picked up and decided to learn C# im gonna need to learn about game programming in it. Programming languages are used for many different things other than game programming. So i would like to know what tutorials i should look up and study, specifficly for game programming.
Ive sent a PM to JWalsh about the C# workshop thing but i dont know if its too late for me to start.

Any help would be much apreciated.
Thanks!

Share this post


Link to post
Share on other sites

This topic is 3742 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this