Which programming language?

Started by Babar, Tue 26/04/2005 13:44:07

Previous topic - Next topic

Babar

The summer holidays are coming up, and I decided to make it my project to learn a programming language as well as I can in the time I will have.
The only programming language I know is Basic, but I think I know that reasonabely well. I've used it to make "games" like pong, tic tac toe, 2 player chess, simon says, a targeting game, and even a 1 screen birds-eye view action game. I've also made stuff like a tile drawing program, a mini banking-system, a personality generator, etc.

The point is, that I think I've got the best I can out of Qbasic. I mean, I've seen programs on the net that have doom-like 3D (raytracing? raycasting?), use of mouse, etc. but either they are too mathematically complicated, or they use assembly.

Can anyone give me advice on what programing language to learn? I am hoping that Basic will give me a nice starting point so that I don't have to relearn the ENTIRE language all over again. I've got a free compiler of C on the PC, and even have a 2nd hand tutorial book, but I could not find anything about graphics in that. Does that require a seperate library? I want to be able to make nice (flashy  ;D ) games, so I want there to be something with graphics, but I am not ONLY going to make games.

Or should I try something completely different, and have a go at object oriented programming? I know next to nothing about this, though. How does it work? Will I be able to make stuff like I was doing before?

Thanks in advance.
The ultimate Professional Amateur

Now, with his very own game: Alien Time Zone

2ma2

I think C++ is the way to go. Not that I have any particular programming experience, but C is the base of every much all other systems out there.

..oh, and Qbasic RULES!

scotch

I'd recommend starting with C, it teaches you the syntax that is used in a lot of the most popular languages and also requires you to think about what you are doing when programming, having to deal with memory management and things by yourself, so you'll end up a less sloppy coder. Ã, Yes, you'd want a library to do graphics, one very popular (2d) graphics library made in C is SDL, it's probably used in most cross platform 2d games and emulators and is quite easy to use. Ã, Once you understand C fairly well you can get into OO by learning C++, which is essentially C with object oriented features. Ã, Worth doing because game engines are almost exlusively made in C++ these days.
At first it'll probably be quite confusing and some things might not make sense or seem useless, but after a month or two everything falls into place. Ã, If you are experienced with basic and AGS scripting you have a head start.

jetxl


stuh505

I recommend C++.  It's really just an extension of C (so I've heard, I've never tried plain old C), with more stuff added.  The basics in C++ are REALLY easy.  After that, you can learn more and more, and things may get more complicated...but it's really a choice how far you push yourself.  The wonderful thing about C++ is that anything that's anything uses C++, it's not only used to program most things, but it's the most common thing you'll use to write your own plugins etc for things, and there are so many other languages inspired by it that it will help you to learn other things as well. 

Annother possibility is C#, which is inspired by C++. but it is in many ways much easier to pick up than C++, and you can do more complicated things generally easier.  C# comes automatically with all Windows XP machines, but you can only use it on XP Machines too.

Object Oriented programming is really the only way to get any substantial amount of work done without killing your brain.

Kweepa

I recommend C++ too.

I started out with games programming learning C and did that for several years - I built up a big internal resistance to C++, which was a bad thing. Writing games code in C gets very ugly and ends up half-faking a lot of C++ features.

As for C#, it's great for tools and I think eventually it will be at a games-writing level, but right now there's no games library support (eg Allegro, OpenGL, etc). Admittedly C++ and C# are callable from each other but sometimes you have to jump through hoops to get it working.

C# is certainly not free with WinXP either. I think it costs about $1000 for Visual Studio .net. macs come with a free C++ and Objective C development environment, XCode - and XCode 2 is shipping with new macs when Tiger is released on Friday. That's meant to be pretty good.

I don't think there are any PC tools that in any way come close to Visual Studio. Bloodshed's is the closest I've seen, and it's a toy by comparison. But I haven't looked into that too much, so I'd love to be corrected...

Err, in conclusion, learn C++.
It's relatively easy if you know some AGS 2.7 scripting.
Good luck!
Still waiting for Purity of the Surf II

[lgm_unplugged]

I too must reccomend C++. Find a book somewhere that comes with a student edition of Visual Studio or sumin.. It's well worth it.

I am taking a class on C++ right now, and it's much easier than I thought it would be. It teaches you great programming habits because you have to account for memory management (like scotch said), well-organized code, and much more. BASIC is nice for making things quick and easy, but anything made in it is a memory hog (compared to a C++ program) and is sloppy.

I don't really know anything about OOP, because I'm still learning the C part of C++

Good luck, though. You should have fun with this.

Abisso

You could also try Java. It's not so different from C, but easier, from what I know. (I know Java basics, but I've got just some infos on C).
Welcome back to the age of the great guilds.

Snarky

C++ is really a bit of a mess as far as languages goes. A bastardization of C which violates the object oriented paradigm it supposedly belongs to by throwing in incredibly low-level concepts.

Java is a very nice language, and you can get everything you need for free (including an excellent editor, Eclipse). The latest version adds long-requested features like enums and "templates" (generics), which means it now has pretty much everything C++ and C# have, and more. The only drawback is that it's not ideal for "flashy games", though it's quite possible to use it to make them (with Java 3D and JOGL). (Apparently the Law & Order games were written in Java.)

C# is pretty much interchangeable with Java, except it's made by Microsoft. It is NOT true that it only runs on XP. You only need the .NET framework to run C# programs, which is included with XP but which you can also get for other versions of Windows, for free. In order to make C# programs, you do however need Visual Studio .NET, which can be expensive. I'd say there's no real benefit to using C# over Java.

C is also a pretty nice language, and the one used to write most commercial games. However, it's low-level compared to Java, which means you'll have to handle a lot of "irrelevant details" yourself. It also doesn't include many powerful modern features which are well worth learning. If you decide to use C, you should also get a toolkit like for instance Qt, which will make your life a lot easier (a powerful string data type instead of char arrays, just for starters).

So I would recommend C or Java. Both are relatively well-designed, elegant languages that should be easy to get into. Java is more extensive than C, and might seem daunting at first. On the other hand, C is lower-level and more closely tied to the hardware, so you will need a deeper understanding of what's going on in order to use it well. Also, to take full advantage of C you will need a bunch of libraries and toolkits that can be just as overwhelming as Java. C is oldskool, Java is more modern. Java is arguably better for general purpose programming, C is still preferred for games programming. You can get better speed with C, but only if you know how to use it well.

In the end, both C and Java would be a good choice. C++, however, I'm not so sure about.

scotch

If C++ violates pure OO I think that is why it is useful, C++ is C++... it's not Java or C# (which I do like to code in, but not for anything that requires great performance, such as games), it's not purely object oriented like those languages, and this is a good thing for games/speed.  For me it is like C but tidier, you can do anything low level that you could do in C, with the same low level access and performance, however with classes and inheritance and namespaces etc you can build much more elegant programs, Steve said "Writing games code in C gets very ugly and ends up half-faking a lot of C++ features.", I think that is largely true, I have much less trouble managing my C++ code, you can hide a lot of low level and confusing C code behind clean OO interfaces.  It isn't true to say that most game engines are written in C these days, C++ has been the game industry's language of choice for years, as far as I can tell, I think the last big game engine I remember being in C was Quake 3 (and I'm not entirely certain that was completely, the modding part was).  In any case the biggest few game engines around at the moment are all C++.

I learned C/C++ last year, and started fiddling with Java after that (working on the #ags IRC bot, Roger), the transition to Java/C# from C++ is very easy, I could start coding right away, and it's been a lot of fun.  C++ has most of the concepts you use in those languages.  I think if I started with a garbage collected and very high level language like java or C#, then was confronted with the pointers, memory allocation and low level stuff of C/C++ would have been tougher.

By the way, if anyone is working in C++ and wants to do 3d graphics (and see an example of some pretty good C++ code), I'd recommend OGRE, I've used it for nearly a year now, it's so nice to work with and supports cutting edge graphics features that not even the commercial games out these days do.  There's also a C# port called Axiom, I think.

Kweepa

Well said sir.
Ogre looks awesome. And with Novodex bindings? Woo! Good stuff.
Still waiting for Purity of the Surf II

Pumaman

I would recommend learning C#, as it's a very clean and nice object-oriented language. The command-line compiler is free (it's part of the .NET Framework).

On the other hand, as others have said, .NET isn't really fast enough for games, so if you're wanting to get into game programming then C or C++ is the better bet -- but be warned, they're much more complicated languages and it's much easier to make mistakes!

stuh505

QuoteC# is certainly not free with WinXP either. I think it costs about $1000 for Visual Studio .net.

QuoteIn order to make C# programs, you do however need Visual Studio .NET, which can be expensive. I'd say there's no real benefit to using C# over Java.

Both of these statements are just plain wrong!

Last summer as part of my internship I learned C# and did a LOT of coding in it, I wrote an application that was used by my local hospital very successfully...and I used Notepad + the free command line compiler that comes with XP.  I have used it on many other XP computers also and there's never a hidden fee.  I found the command line compiler to be really good.

however, for C++, I like to use Microsoft Visual Studio .NET 2003, which is actually more like $2500...luckily I'm a college student so I don't have to pay that.  That said, there are many free C++ compilers, they just aren't as nice in my opinion.

Kweepa

Oops, my apologies. I didn't know the command line compiler was free with the .net distro.

However, I wouldn't recommend starting programming on a command line. It's a huge barrier to productivity. No autocompletion, no visual organisation of projects, no F1 for help, no "go to definition". Really, I wonder how I ever got anything done before all that stuff. Maybe I'm just lazy, but I prefer to put my efforts into creating, not looking information up and managing make files.

Cheers.
Still waiting for Purity of the Surf II

stuh505

Steve, I have to disagree with your general statement about command line compilers there.

The difficulty with command line compilers arises from wanting to do complicated things, for which the command line arguments become necessary, and increasingly complicated.

Some command line compilers also do not give good warning messages.

I think the visual suites are more suited for dealing with complicated projects that might require a lot of linking, and special parameters.

However, his first programs will not involve complicated linking or arguments, and he will really only need to do "csc filename" and that's it.

The csc compiler gives really good error messages and is easy for a total beginner to start using.

Now compare this to some of the large applications...they have lots of settings, and even figuring out how to set up your project could take a beginner a long time or get them so confused that they stop trying.  for instance, in visual studio you need to turn of precompiled headers in the settings or you'll get an error when you first try to compile.  I've learned codeWarrior but after taking a lapse, I spent a few hours and couldnt for the life of me get a simple prog to compile.  Using a command line compiler you dont have to go through any "setting up the project" bullshit...so I'd recommend that for a beginner first.

Traveler

If I were you, I'd go with C# or C++. C++ gives you much more power and control over the computer (although most of them are possible even in C#, but with a lot of extra work.) C# is simpler (mostly because of automatic memory management and the extensive framework library) but performance of the .Net framework is waaay below the performance of C++.

There are several free C++ compilers and the .Net framework comes with a command-line C# compiler. (If you plan to do any serious programming work, command line is your friend, learn to use it.  ;) )

Snarky

The drawbacks of command-line compilers are only partly with the compiler itself. The bigger issue is that a text editor (whether Notepad or something like emacs) is nowhere near as good for writing programs as a proper IDE. Features like syntax highlighting, auto-complete, auto-creation of stubs, bracket matching, pop-up help and options, refactoring, outlines, hiding sections and integrated documentation makes your life so much easier that once you get used to them, you'll never want to work without. And that's not even talking about the debugger, which is a programmer's best friend.

I do think it would be a mistake to go with C#, specifically. It's not a bad language (I've actually beeen working in C# all day today), but to put it bluntly, Java is better. You can run a Java program on a Mac and on a Linux machine (and on a cell phone, with J2ME), while C# only runs on Windows. The only IDE for C# (as far as I know) is Visual Studio, which is expensive, while there are several excellent free IDEs for Java.

As for C++, I personally dislike OO violations. The power of abstractions comes partly from the fact that you can rely on them, and if you start monkeying around beneath the abstraction layer, you can never be confident that your abstractions are sound. And then you're in debugging hell. I also don't think much of the speed argument. On a modern computer, Java runs fast enough that you can do very nice-looking games indeed, especially if you take advantage of some of the special libraries.

edmundito

#17
These should be your priorities:
1) Learn to program
2) Worry about making game after 1 is complete

I used to like C++, but not as much anymore because... well, some people have talked about it in some of the replies.

If you want to learn a real programming language, start out with C. Then, I guess learn Java since that's what they teach at schools now days and it's much better at OOP than C++, IMO. The problem with C++ is that you can skip the OOP, or patially use it which means you can do some weird half-assed attempts that won't teach you anything.

Now, if you want to make games, I recomend Adventure Game Studio. ;)

And about command line compiling... I could do everything that way if I wasn't such a lazy bastard. It's good to learn that stuff, though! Don't ever take cute little programs for granted.

LGM

You. Me. Denny's.

stuh505

By the way people, www.MSDN.com/library is your BEST FRIEND.Ã,  It covers every aspect of C# that exists known to man, as well as J# and VBA, the Windows API...a fair bit of C++ and C...and so much more.Ã,  Seriously, you'll find more examples and specifications than any textbook...and any error code you get from a Microsoft compiler, you can just look it up there for a more detailed explanation and examples of code that will cause that error.

SMF spam blocked by CleanTalk