Jump to content

Interested in programming


Knowledge Novice

Recommended Posts

Knowledge Novice

I'm not sure, but this seems to be the appropriate place to post this.

 

To put it bluntly I'm interested in learning how to program, but have no idea where to start. I'd like to be a world class game programmer of course, but it doesn't matter what I'm learning, my main interest is just understanding how things work, how to manipulate code, etc. Sorry for being so vague but I'm just a beginner looking for the first step to take. Any and all suggestions/ideas will be greatly appreciated.

 

1) What program language(s) would be the best/most beneficial for a beginner to study?

2) Do you know of a tutorial or a forum where I might learn more and get more specific help?

3) Will I need software in order to write code in a specific program language? (If so hopefully it will be freeware)

 

Hopefully some of you guys can help me get started. Thanks in advance.

 

P.S.

It doesn't necessarily have to be game related programming of course. I just want to learn.

Link to comment
Share on other sites

1) I think some sort of scripting language (where you can make changes quickly, no need to compile, etc.). I started with PHP, though you could try out Perl, Python or anything else that looks interesting. tounge.gif

 

2) I'm not really sure with this one, i've never really stuck to tutorials - they're boring. I've just picked something interesting that I wanted to do (for example, I started with C++ by making a vehicle spawner for GTA), and then just researched the methods I needed to use. PHP, for example, has very nice (in my opinion) documentation on the functions and syntax at php.net, which is helpful.

 

3) This really depends on the language you pick. You will, however, always need a good text editor. I like Notepad++, nano and Visual C++.

Link to comment
Share on other sites

TheJkWhoSaysNi

 

1) I think some sort of scripting language (where you can make changes quickly, no need to compile, etc.). I started with PHP, though you could try out Perl, Python or anything else that looks interesting. tounge.gif

 

2) I'm not really sure with this one, i've never really stuck to tutorials - they're boring. I've just picked something interesting that I wanted to do (for example, I started with C++ by making a vehicle spawner for GTA), and then just researched the methods  I needed to use. PHP, for example, has very nice (in my opinion) documentation on the functions and syntax at php.net, which is helpful.

 

3) This really depends on the language you pick. You will, however, always need a good text editor. I like Notepad++, nano and Visual C++.

I agree with everything you said apart from Perl. do not start with Perl it will just confuse you. Perl has possibly the least readable code for beginners (or anyone for that matter) it has random 2 letter function names like qw you inevitably end up using the $_ variable as an array so you end up using $_[0][1] which just makes everything hard to read and follow.

 

Starting with a scripting language is a good idea because they tend to be a little more forgiving and with php and other loosely typed languages you don't have to worry about type conversion or casting.

 

Just to add my own thoughts:

 

1) Scripting languages are a good place to start. But it depends what you want to do. Do you want to make windows applications or do you want to do simple command line tools or do you want to make a backend for a website? You could start with something like C++ but you'll end up spending more time dealing with the intricacies of the language than actually learning how to code something useful and getting a result. If you do want to make programs rather than web pages or simple command line scripts I suggest C#. If you just want to learn the basics of programming PHP is a nice place to start.

 

2) There are forums, newsgroups, chat rooms, books, articles, tutorials, etc for almost every programming language. Obviously if you pick something popular it will be easier to find help. Like Mike, I never bothered with tutorials. I always said "I want to make *** " and figured out how to go about doing that. The only problem with this method is that sometimes you get the result you wanted but haven't gone about the "proper" or best way of achieving it.

 

3) As Mike said, it will depend on which language you pick. If you want to do PHP all you need is a text editor (I recommend Crimson Editor and php, you'll probably want apache too). For other languages there are free IDEs, compilers, etc out there. For C# you can download Visual C# Express Edition for free.

Edited by TheJkWhoSaysNi
Link to comment
Share on other sites

If you actually want to be a game programmer I DO NOT recomend starting with a scripting language. Game programming requires you to understand how the machine really works. By far the best path to becomming a game programmer is starting learning machine language and Assembly from the start. Of course, even x386 assembly would be much too overwhelming for an absolute beginner, but there are processors that are really easy to code for.

 

My suggestion, learn to write games for Atari 2600. All you need is an Atari 2600 emulator and a hex editor. You migth want to find an assembler for Atari to simplify your work, but since it is an 8bit CPU, it is easy enough to code even in straight machine code. You can find instruction sets and even guides to writing your own games on-line. And, of course, start simple. Try writing your own version of Pong.

 

Learning machine language is going to be a bit more difficult and frusturating than learning a script language. However, you will be learning how to program and not just how to script. You will know what is happening in branching, looping, and function calls on the machine level. This will teach you how to write clean efficient code. Once you feel comfortable with Attari, go directly to C. When working with C, you'd be able to tell what kind of machine code each line in C represents, which, again, is very important if you want to write good code. From C you go to C++ and start learning how to use inline Assembly in your C/C++ code. Once you have that covered, you are set as far as what you need to know of languages. If at that point you still want to pursue game development, you will be learning about various parts of the game engine, including 3D graphics, physics, AI, user interfaces, networking, etc.

 

P.S. Until you learned how to code in C++, avoid C#. Making mistakes in C++ will teach you a lot of proper programming practices that you will not learn if you start with C#. Personally, I wouldn't recomend working with C# at all, but you might end up working for a development company that chooses to use it. If you end up in that situation, you can learn it then. If you can program in C++, all other languages are accessible to you with minimal training.

Edited by K^2

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

TheJkWhoSaysNi

Wow, K^2. If he does the exact opposite of what you just said he'll be much better off.

 

The only thing you said that made sense is that if he wants to get into game programming (although he never mentioned this in the first post) a scripting language is not the way to go.

 

Everything else you said would be correct... if it was 1987. Lucky for us, it's 2007.

 

 

Machine code? Are you serious? It is good to know, but it's not necessary and will be very difficult for a beginner and progress will be unnecessarily slow.

 

C makes a bit more sense but it's still not very helpful for beginners and more often than not the wrong tool for the job. Moreso with C++. C# is much better. C# is faster to write, the syntax is cleaner, the .NET Framework is extremely feature-rich and the language has a number of features built in which you will almost always have to implement yourself, in some form or another, for any non-trivial C++ application. There are very few real world applications where C++ is the correct tool for the job, even where it has been the historical choice.

 

Beyond that, if you're doing a project where you absolutely need C++, then that project probably isn't the right one for a beginner to do. C++ is a hybrid bastardization and I don't suggest learning it at all unless you're writing for an environment that doesn't support managed code. Even then, you might be better off learning D because it's is a much better programming language than C++. It's more like C# with C++ performance, but it's not entirely available yet.

Link to comment
Share on other sites

No one mentioned Java? Java was the first language i learned in 1st year uni. It's easier to learn that C++ yet it has the same basic structure so you can easily move to C++ once you're ready. You can download the free compiler and libraries from http://java.sun.com/.

Besides, Microsoft copied of Java for J# and C#

 

As for games, a lot of web games are either Flash or Java applets and while the graphics may not be as fast as OpenGL i have seen a few good 3D games that run just fine in a web browser. btw, you actually can use OpenGL in Java anyway

 

 

Wow, K^2. If he does the exact opposite of what you just said he'll be much better off.

lol. I might give that a try, programming on Atari might be fun. But like TheJkWhoSaysNi said, it's not for beginners

Edited by Haro
Link to comment
Share on other sites

Knowledge Novice
You guys are great. I've been searching the web from time to time but wasn't sure what I was looking for. Now, thanks to you guys, I've got a pretty good idea where to start. Being a total novice it's going to take me a while to find my way around but I think I'll make it (or be back with more noobish questions tounge.gif ). This is something I've been wanting to try for a long time and I appreciate everyones time. Later guys. icon14.gif
Link to comment
Share on other sites

Wow, K^2. If he does the exact opposite of what you just said he'll be much better off.

 

The only thing you said that made sense is that if he wants to get into game programming (although he never mentioned this in the first post) a scripting language is not the way to go.

 

Everything else you said would be correct... if it was 1987. Lucky for us, it's 2007.

 

 

Machine code? Are you serious? It is good to know, but it's not necessary and will be very difficult for a beginner and progress will be unnecessarily slow.

 

C makes a bit more sense but it's still not very helpful for beginners and more often than not the wrong tool for the job. Moreso with C++. C# is much better. C# is faster to write, the syntax is cleaner, the .NET Framework is extremely feature-rich and the language has a number of features built in which you will almost always have to implement yourself, in some form or another, for any non-trivial C++ application. There are very few real world applications where C++ is the correct tool for the job, even where it has been the historical choice.

 

Beyond that, if you're doing a project where you absolutely need C++, then that project probably isn't the right one for a beginner to do. C++ is a hybrid bastardization and I don't suggest learning it at all unless you're writing for an environment that doesn't support managed code. Even then, you might be better off learning D because it's is a much better programming language than C++. It's more like C# with C++ performance, but it's not entirely available yet.

First of all, he did say that he wants to be a game programmer. So all arguments towards efficiency of code are topical.

 

Second, it doesn't matter what year it is. If you don't know how to code on the machine language of the processor you are writing for, you are not going to write good code. That's far from being the only or even the main requirement, but it is one of the requirements for writing clean, efficient, and stable code.

 

And no, learning machine code isn't going to be super difficult. Have you ever coded for 8bit CPUs? If you can't code for one of these, you shouldn't be coding at all. I'm not suggesting that he dives right away into modern CPUs with paging and segment protection. In fact, unless he wants to write Operating Systems, he might not need it at all. But he must understand how the stack pointers are used for passing parameters, returning to parent functions, etc. He must know exactly what while(a<b){a++;} looks like to a CPU. You can't be a good programmer if you can't take that and convert it to ASM, or vice versa. And starting from that is the only proper way, because otherwise, how are you explaining functions in C? If you can't say right away that a function name is a pointer to an address in memory where the executable code ending in a return statement is stored, then you are not explaining it properly, and it will come back to bite you in the ass.

 

One more point on importance of assembly is in debugging. You can't use a debugger if you don't know ASM. Sure, there are other ways to hunt for bugs, but they tend to relly on putting in a lot of error checking code into your program, which will come at a cost of performance.

 

C++ is a rather shaky hybrid in places, but you do not need to utilize all of it. All of the critical code you are writing should be in straight C, with C++ OO features used to put everything together. In that sense, you cannot do better than C++. It is the only language that allows me to most efficiently select between writing inner-loop code in Assembly/Machine code, the critical control structures in C (which you will know exactly what it translates to in machine codes) and the more abstract layers by implementing OO models.

 

C# is a good language when you need security and short development cycle. It is, in other words, ideal for business applications, where rules can change in an instant, and your employers want updated code three days ago. In game development, as well as within any scientific application, your main guide lines are for speed and stability. C# does a lot of checking and double checking that eats up your CPU clocks. Granted, it will save your ass if you computed pointers incorrectly somehwere, but that's exactly why it shouldn't be your first language. A programmer needs to learn not to make such mistakes in the first place, and to know how to debug them with minimum runtime software assistance. For that, you want to code in C. C, therefore, should be the first language to be learned after the person has some intro to machine language.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

TheJkWhoSaysNi

 

First of all, he did say that he wants to be a game programmer. So all arguments towards efficiency of code are topical.

 

C++ may not hold the speed crown for very much longer. Depending on the situation, manual memory deallocation can be very slow compared to the kind of batching you can do with good garbage collection. Not to mention the fact that C++ is an awful language for multi-threading, (even with non-standard extensions such as OpenMP). C# is a lot better because event and marshalling primitives are incorporated into the language and the possibility of adding automatic multi-threading into the CLR.

 

 

Second, it doesn't matter what year it is. If you don't know how to code on the machine language of the processor you are writing for, you are not going to write good code. That's far from being the only or even the main requirement, but it is one of the requirements for writing clean, efficient, and stable code.

...

 

He must know exactly what while(a<b){a++;} looks like to a CPU.

 

If it's C/C++ you're coding, yes. For high level languages only the complier needs to know what that looks like to a CPU. You don't need to know any ASM to understand what the code does, and for a beginner knowing what happens after the program is compiled is not necessary.

 

 

One more point on importance of assembly is in debugging. You can't use a debugger if you don't know ASM. Sure, there are other ways to hunt for bugs, but they tend to relly on putting in a lot of error checking code into your program, which will come at a cost of performance.

 

I disagree, modern languages have assertions (the best of which is, imo, Eiffel's "Design By Contract") where pre/postcondiction checks are not included in the finalised, distributable program.

 

 

 

Granted, it will save your ass if you computed pointers incorrectly somehwere,

 

Which is exactly the kind of reason why low level languages are not suitable for beginners. Mistakes will be made, and tracking them down in C++ can be difficult.

 

I just found this: http://www.cs.rice.edu/~ian/Manifestoes/c++isBad.shtml which offers a good explanation of why C and C++ are not good languages for beginners.

Edited by TheJkWhoSaysNi
Link to comment
Share on other sites

Knowledge Novice

 

First of all, he did say that he wants to be a game programmer.

 

To put it bluntly I'm interested in learning how to program, but have no idea where to start. I'd like to be a world class game programmer of course, but it doesn't matter what I'm learning,

K^2 was right. I am most interested in being able to create/help create games. The reason that I said it doesn't really matter what I'm learning is because I figure that there's gonna be a lot of stuff I have to become familiar with before I start cranking out award winning games. On the other hand, once I start becoming familiar with different languages I may decide to take a completely different route. Who knows?

 

My suggestion, learn to write games for Atari 2600. All you need is an Atari 2600 emulator and a hex editor. You migth want to find an assembler for Atari to simplify your work, but since it is an 8bit CPU, it is easy enough to code even in straight machine code. You can find instruction sets and even guides to writing your own games on-line. And, of course, start simple. Try writing your own version of Pong.

 

Learning machine language is going to be a bit more difficult and frusturating than learning a script language. However, you will be learning how to program and not just how to script. You will know what is happening in branching, looping, and function calls on the machine level. This will teach you how to write clean efficient code. Once you feel comfortable with Attari, go directly to C. When working with C, you'd be able to tell what kind of machine code each line in C represents, which, again, is very important if you want to write good code. From C you go to C++ and start learning how to use inline Assembly in your C/C++ code. Once you have that covered, you are set as far as what you need to know of languages. If at that point you still want to pursue game development, you will be learning about various parts of the game engine, including 3D graphics, physics, AI, user interfaces, networking, etc.

For starters I think that I'll give this a try. I like the idea of knowing how things work at the most basic level and how to manipulate them.

 

So, let's say when I do a main.scm mod for VC, is that considered programming, scripting or is it either one? For instance, when I use opcodes to manipulate the game, is the opcode kind of like a label that points to code written by the original programmers? I've seen the opcode numbers and I've heard (unless I'm mistaken) that it doesn't really matter how an opcode is worded, so does that mean that the opcode number directs the game to the corresponding memory address and then the game carries out that function taking into account any variables in the opcode line? I'm not trying to get ahead of myself, I'm just trying to understand how things work. Later guys.

Link to comment
Share on other sites

This topic is a perfect example of why I ensured this forum's existence - an interesting debate between two intelligent people who clearly know more than me about some stuff. Grand.

"Face Your Fears, Live Your Dreams" - No Fear


"God was a dream of good government." - Deus Ex Machina


"I contend that we are both atheists. I just believe in one fewer god than you do.


When you understand why you dismiss all the other possible gods,


you will understand why I dismiss yours." - Stephen Roberts

sig.jpg
Link to comment
Share on other sites

 

C++ may not hold the speed crown for very much longer. Depending on the situation, manual memory deallocation can be very slow compared to the kind of batching you can do with good garbage collection. Not to mention the fact that C++ is an awful language for multi-threading, (even with non-standard extensions such as OpenMP). C# is a lot better because event and marshalling primitives are incorporated into the language and the possibility of adding automatic multi-threading into the CLR.

You are making it sound like anyone is going to simply malloc/free all their memory as it becomes needed. Everybody who builds a highly dynamic C/C++ program simply creates their own garbage collectors. Best example is when working with dynamic trees. You will never just malloc/free nodes. You'll malloc entire blocks of them, and then move the nodes between your main tree and the collector tree which holds "delted" nodes. This is performed in 3 pointer re-assignment operations, and I'm betting it is much faster than anything C# might throw at it.

 

As for multi-threading, I am not convinced that it is even necessary for a game app if it isn't utilizing multiple CPUs. The only process you some times want in a separate thread is networking. Personally, I don't have much of experience in running networking thread, but people I've worked with have never complained about the way the C++ does it.

 

If it's C/C++ you're coding, yes. For high level languages only the complier needs to know what that looks like to a CPU. You don't need to know any ASM to understand what the code does, and for a beginner knowing what happens after the program is compiled is not necessary.

That is exactly the problem with most modern languages. If you are working with an imperative procedural language, you want to know what kind of ASM code you are getting. I've seen the kind of crap some compilers do with your code. In a small function, if you just leave it to optimizers, half of the clocks are wasted. This can easily be avoided if you know how your compiler works.

 

More importantly, there just isn't any need for anything more fancy in procedural languages. And so far, I have only came accross one language that has good reason not to be such. That is Prolog. Anything else that tries to add features just to be a 4th generation language is crap that is wasting your CPU time rather than do anything useful.

 

I disagree, modern languages have assertions (the best of which is, imo, Eiffel's "Design By Contract") where pre/postcondiction checks are not included in the finalised, distributable program.

That kind of stuff is present even in VC++. If you compile in debug mode, you get code that checks itself for being out of bounds in arrays, and such. C#, however, contains checks that are part of its OO model. It may be useful in programming on high level, but it is also a waste of clocks on low level. You might be able to reach a compromise by using C# with C libraries, but then you might as well use Python as your high level language.

 

Which is exactly the kind of reason why low level languages are not suitable for beginners. Mistakes will be made, and tracking them down in C++ can be difficult.

Beginners absolutely must deal with errors in pointer chasing. That's how you learn to write clean code that is easy to work with. And while debugging code like that, you also learn to optimize, because you are forced to try different approaches and algorithms.

 

As for your link, that is a very poor argument. It only makes sense for people who took C/C++ as the first language. As I said, one should start with ASM to understand what C/C++ compiler does. Then you might as well use negative array indecies, as long as you know where your arrays are. For example, knowing how malloc works, you can use negative array indecies to check the size of an array you got with new[] in C++.

 

So, let's say when I do a main.scm mod for VC, is that considered programming, scripting or is it either one?

That would be scripting. Though, scripting with GTA's opcodes is a bit like programming a virtual CPU.

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.