PDA

View Full Version : Learning C


VengefulPastry
12-27-2004, 10:35 AM
So now my first game is almost done, and it was a great learning experience. I now know Visual Basic/DirectX well enough to make a game....

Now I plan to write another game, and my current plan is to learn C and do the game in Visual C/DirectX.

So, I'm sure this question has been done to death over the years, but being new, I'm not up on the particulars: what are the advantages of programming in C vs Basic? Is Basic actually any faster to code? Is C that much faster at run-time? Does C use less memory? etc..... anything that can be compared, what are the advantages?

The main advantage I can think of is it would be good on a resume if I wanted to work for a gaming company. But, from recent articles on how gaming companies operate, that thought is a bit scary...

Other ideas? Thanks!

GBGames
12-27-2004, 11:02 AM
C is really portable. You write something in C, and most likely you won't have to tweak it much if at all to make it work on any operating system out there.

C is like a portable assembly language. Assembly language is really quick, but it is also very low level. Writing something in C may take 1000 lines of code whereas the same thing can be done in one line of shell script.

Basic has a simple syntax and is fairly easy to program with. Unfortunately you won't find portability to be its strong suit at all. This may be fine for you. Also, BlitzBasic is something people swear by. BlitzMax is supposed to be cross-platform (Windows, Mac, and Linux), but currently only the Mac version is out.

C has tons of libraries already written for it. Depending on the version of Basic you use, you may find libraries you need or you may not.

So basically C is popular (you'll find lots of tutorials, books, libraries, etc for it), portable, and quick to run (although slow to program with).

Basic is easy, somewhat portable (depending on the version you're using), and quick to program with (although possibly slow to run, depending on the version).

Regarding memory usage: C lets you control memory directly. Dangerous, yet powerful. Still, if you don't program well in either language, you'll waste resources anyway. With the resources PCs have these days, saving processor cycles and memory isn't nearly as important as it used to be. It's been said that C and similar low level languages are just not going to be as useful as languages with garbage collection since low level languages make it easier to make errors. Programming for a console or a cell phone, however, requires you to make use of the least resources, so low level languages have their place.

And again, more libraries already exist for C than anything else. What do you want to make? What restrictions do you have on yourself? Which tool (C or Basic) lets you make things without violating those restrictions?

ggambett
12-27-2004, 12:54 PM
Forget C, go for C++.

C_Coder
12-27-2004, 01:27 PM
When I learnt C it was with a book I bought since I got fed up of QBasic and assembly...Since I new Basic and Assembly, it was really fast to learn C especially pointers...I repeat...especially pointers!.

The language is quite easy to learn but make sure that you know your pointers. If you get the hang of pointers you can juggle your code as you please!

C++ comes later since it is actually a C extension. That's how I saw it when I learned it.

I would recommend you to learn C/C++ from VB. Of course with VB everything is done faster and with less code but I don't like those run-time library DLLs that can go up to some ~4 megs. I see them as a waste of space especially for web site downloads.

Again: Learn C, Know your pointers, learn C++.

I hope this helps! :D

AlgolDreamweaver
12-27-2004, 01:53 PM
I do all of my programming in C now and I use OpenGL for my graphics. I started out with Basic on a TRS-80 at first, bought a VIC-20, then learned 6502 assembly language for speed. Nodemaster Chess, Mystic Well and Mystic Mirror (Atari ST) were written using 68000 assembly code. Daymare I and II were written in 8086 assembly. I just started working on Daymare 3 a couple months ago. I tried a bunch of the different C/C++ compilers and I would recommend Dev-C++. As for the choice between DirectX and OpenGL, I have tried both and I would suggest using OpenGL for independants. C gives you most of the speed of assembly and is much so much faster to program. The game I am working on actually only uses about 40% of the cpu. It is mostly waiting for the video card to catch up. C++ forces you to be more organized than C and is best when you have a lot of programmers. If you are a solo programmer though, you can write C code about twice as fast as C++ code.

GBGames
12-27-2004, 02:03 PM
.

Again: Learn C, Know your pointers, learn C++.



Learning C++ first isn't a bad option either, especially since you get all the features it provides. It is no longer a true superset of C, but why limit your ability by learning something that doesn't do as much? If you have the choice, go with C++. Accelerated C++ is an amazing book for doing just that.


Learning in the manner suggested above, however, can help you see how things progressed in the history of languages, which may be useful. You will definitely find C code in C++ code, or you may be reading through C code to learn some concepts to apply to your own projects. In that case, it can't hurt to learn C. There are books out there to help you learn C++ if you already know C, but I haven't found anything that goes in reverse (I was told that you just basically drop things like templates and classes, and there ya go, but I think that is overly simplistic).

C_Coder
12-27-2004, 03:06 PM
Even though you can learn C++ immediately, you cannot avoid C. C++ adds capabilities like Classes and Templates but you still have to use C for the rest.

I still have to emphasize about the importance of getting the hang of pointers. Even DirectX uses pointers extensively.

I still think that you have to learn C and then see how C++ adds onto it. Now, if you just know the language you have to learn how to use it, so you still need to learn object oriented approach. There are a lot of articles on the matter especially at GameDev.net

As a matter of fact the book I have used to learn C was 'Teach Yourself C - Second Edition' ... forgot the author though...

Happy learning! :)

GBGames
12-27-2004, 04:21 PM
Even though you can learn C++ immediately, you cannot avoid C. C++ adds capabilities like Classes and Templates but you still have to use C for the rest.


Well, to print in C, you use printf(). To print in C++, you use cout. They are completely different. I can use all sorts of things in C++ without touching C. So you can in fact avoid C (if you assume that the parts of C++ that are C-like are still C++).

I agree with you about pointers. Getting the hang of memory management is an important skill to have, even if you use a language that handles memory for you. Java might handle garbage collection for you, but it is still possible to write code that is badly optimized. Knowing the proper way to make use of data in a class can mean the difference between a game that fits within a single MB and one that takes up multiples of that.

C_Coder
12-27-2004, 04:25 PM
Well, to print in C, you use printf(). To print in C++, you use cout. They are completely different. I can use all sorts of things in C++ without touching C. So you can in fact avoid C (if you assume that the parts of C++ that are C-like are still C++).

printf and cout are used for console applications and games are not console apps... what would you use for string manipulation instead of sprintf, strcpy, strcat, strrchr, etc? The STL std::string class?

What you are saying is true but underneat you will find the C code hiding under the class or template! :p

HairyTroll
12-27-2004, 05:39 PM
So now my first game is almost done, and it was a great learning experience. I now know Visual Basic/DirectX well enough to make a game....

Now I plan to write another game, and my current plan is to learn C and do the game in Visual C/DirectX.

Try PyGame (http://www.pygame.org/). It is almost as portable as C (runs on any platform for which SDL is compiled and that has a Python compiler). This will allow you to learn all the goodness of Object Oriented programming, without jumping though the firey hoops that is C++.

Teq
12-27-2004, 05:45 PM
Mmmmmm function pointers :) Sorry, going into dream land for a minute, C might take a while to get to grips with and the first game you write may take a little longer to code, but get building up that library and you'll soon be coding almost has quickly as you were with other less portable languages :)

halodrake
12-28-2004, 05:29 AM
Try PyGame. It is almost as portable as C (runs on any platform for which SDL is compiled and that has a Python compiler). This will allow you to learn all the goodness of Object Oriented programming, without jumping though the firey hoops that is C++


And will also be slower than anything else in existance. I was very unimpressed with PyGame.

I would say Learn C++. Unless you are programming in an environment that requires C, C++ has a lot of benefits and advantages over C. Much more than just class and templates, the STL is practically invaluable. Pointers and memory management are very important- and also a lot easier than Java/Python users make it out to be. You just have to be careful, and watch what you do. The only time memory management might become a problem is when you are accessing the same pointer with two different parellel thread and one of them delete's the pointer while the other is trying to access it.

But, really, if you are careful, it's not that hard. Also- I would suggest learning SDL or Allegro over DirectX, it will give your game some portability to other platforms.

Ronkes
12-28-2004, 05:54 AM
There is nothing wrong with learning C instead of C++, but if you want to learn C++, start with C++ right away and not with C (http://www.parashift.com/c++-faq-lite/how-to-learn-cpp.html#faq-28.2). Learning C before C++ will teach you quite a few habits that are very bad practices in C++.

By the way, C++ isn't just C with some extra sugar and the C++ Standard Library doesn't use C underneath. They are two different programming languages and using either one is valid.

C programs usually run faster than their BASIC equivalents. Note though, that I have practically no experience with BASIC-dialects like DarkBASIC (http://www.darkbasic.com/) and Blitz BASIC (http://www.blitzbasic.com/). Also, depending on your game, you might not need C's extra speed.

The advantage that Visual Basic has over Visual C is mainly that you know it already. I think that in the long run you would benefit from learning C. Although, if you take the trouble of learning a new language, I'd prefer C++ or even D (http://www.digitalmars.com/d/).

princec
12-28-2004, 06:04 AM
Or don't bother with all that crap and learn a nice easy language that gets the job done :) Like Java, C#, or Blitz.

Cas :)

halodrake
12-28-2004, 06:17 AM
I don't see what makes Java any easier than C++. In fact, IMHO forcing Java into a strict always OOP might actually make programming in Java somewhat more complicated than it needs to be compared to it's C++ counterparts. Their are benefits to Java (no need for recompiles to go across platforms), but saying it's easier to learn than C++ is a fallacy. I've never used C# so I have no idea on how *easier* it would be, but I say learn C++. Just do it. You can always learn Java or C# later as well. C++ is very full-featured, been around a long ass time, and with the advent of C++0x it should be around for a lot longer.

Besides, the main reason (I see) that other languages are easier (like varients of Basic, Python, Ruby, etc) is that they remove the compile-time bottleneck from the coding cycle. Java does not get rid of this.

the2bears
12-28-2004, 07:48 AM
I don't see what makes Java any easier than C++. In fact, IMHO forcing Java into a strict always OOP might actually make programming in Java somewhat more complicated than it needs to be compared to it's C++ counterparts.

At least from a philosophical point of view if you're not programming OOP with C++ you're really programming C:) But, it's been a few years for me.

That said, you can write very non-OOP Java. From my daytime job to my hobby, the difference is significant in terms of how OOP-like the code is (daytime is OOP).

Bill

Diodor Bitan
12-28-2004, 07:53 AM
Original post by VengefulPastry
Now I plan to write another game, and my current plan is to learn C and do the game in Visual C/DirectX.

What's your main goal for the new game? Learning or finishing your game? If it's the latter I would advise against learning C if you can avoid it.

If it's the former, vanilla C is worth learning, as is the learning of C++. Either way, know that there are plenty of languages worth learning that are not C++, nor do they look anything like it.

VengefulPastry
12-28-2004, 08:04 AM
From everybody's input here, I think what I will do is make my next game in Visual Basic again....

....but I will learn C/C++ on the side, by making "demo" type programs such as graphical physics demonstrations, etc., to both learn the language(s) and show to a potential employer that I can indeed program in C/C++.

What I am most concerned about is time. Learning will take some time, of course. But if developement of a game using C/C++ takes quite a bit longer than with VB, C/C++ actually sounds like a bad plan. It takes long enough as it is with VB (although of course I am faster now than when I first started- naturally).

I don't plan on making any 1st person shooters that require fast graphics engines that would justify C/C++. Learning C/C++ may be more for the benefit of getting a real job in the industry.

I'll think about it some more, but any extra input would be appreciated.

Thanks!

halodrake
12-28-2004, 08:15 AM
I see no reason why a game programmed in VB would take less time than one programmed in C/C++. The only RAD that VB helps with is with Business applications. That, and not having to deal with memory management. You won't need the ease of use of designing forms for making a video game. C++ is not that hard to learn, nor is C for that matter. If you have adaquete experience in VB, it should not take you any time at all to learn C/C++. And, if you use DirectX in VB you already know quite abit about programming it in C++, since the API is almost identical.

Evak
12-28-2004, 08:52 AM
I'd look at blitzmax a few months down the road. It's a bit early yet and still in beta, but it seems to have a lot more in common with C++ than Basic. And provides a lot of shortcuts as far as drawing and handling media.

Once it gets a decent 3D module it should rock. I don't think VB is really well suited to games.

BedroomCoder
12-28-2004, 09:10 AM
C++/C is the way to go for really good looking games. The skys the limit, obviously, but you do need to have a lot of patience, and an untainted lust for programming and learning. I know syntax, pointers, all the varible types, writing, getting input from the keyboard, structs, arrays, exiting, and a few more things, but I obviously still havent touched the tip of the iceberg.

The real hard bit is figuring out when you can start using an API :)

C_Coder
12-28-2004, 09:26 AM
I don't think it is the API the problem here. It is more the way that you put things together without breaking everything. I only use debuggers in very extreme cases where I cannot find the cause of the problem without looking at the code.

When you have learnt to spend a day of programming without compiling and then you compile without errors then you've touched the whole of the iceberg. :D

GBGames
12-28-2004, 09:41 AM
I'd look at blitzmax a few months down the road.

Once it gets a decent 3D module it should rock.

I think once it supports Windows and Linux as opposed to just the Mac it should rock. B-)

oNyx
12-28-2004, 09:56 AM
I don't see what makes Java any easier than C++. In fact, IMHO forcing Java into a strict always OOP might actually make programming in Java somewhat more complicated than it needs to be compared to it's C++ counterparts. Their are benefits to Java (no need for recompiles to go across platforms), but saying it's easier to learn than C++ is a fallacy.[...]

Well, it's about as hard to learn as C++. However, writing programms with Java is faster than C++, because you just can't create most of those hard to track bugs and you can't even crash your machine.

Besides, the main reason (I see) that other languages are easier (like varients of Basic, Python, Ruby, etc) is that they remove the compile-time bottleneck from the coding cycle. Java does not get rid of this.[...]

High turn over rates. Yea, that's really a good thing. However, you can get that by using a scripting language like LUA.

It might sound weird, but I use Java as scripting language for my Java games. It still gets compiled to byte code (into ram), but it's very fast with Janino. It takes about 1 second (on my 5 year old machine) to compile and load the whole logic (there is no need to restart the game). And well, the nice thing is that I can compile it the usual way at the end. So I get all the pros without any cons :)

C++/C is the way to go for really good looking games.[...]

Uhm... yea, and wearing Reebok™ shoes makes you a better cook.

C_Coder
12-28-2004, 11:14 AM
Well, it all depends what kind of game you want to do. If you're doing a fast paced 3D First Person game you have to definately use C.

For slow paced games like puzzle games anything will do.

For my game I had to use C since it needs a lot of processing power. For the slow part I use Lua.

So yes, I don't want to start a language war here but I think that you have to choose the language that best fits the game in production.

Your turn... :D

halodrake
12-28-2004, 11:33 AM
Well, it's about as hard to learn as C++. However, writing programms with Java is faster than C++, because you just can't create most of those hard to track bugs and you can't even crash your machine.


Says who? In the last 3 years I haven't come across a bug yet that I couldn't track. When I first started using C++, that was different. But I doubt a newb in Java would be able to crash it just as fantastically, and that newb would have just about as hard a time to fix it in Java.


High turn over rates. Yea, that's really a good thing. However, you can get that by using a scripting language like LUA.



and I already do. I created a game programming framework in Lua in C++ just for this.


Uhm... yea, and wearing Reebok™ shoes makes you a better cook.


I don't quite grasp that. C++ has never been a brand name, it's not owned by any corperations, it's just a set of standards for someone to implement in a compiler. Java, on the other hand, is a registered trademark and a brandname, owned by Sun. So, really, the analogy is backwards.

elias
12-28-2004, 12:19 PM
Well, it all depends what kind of game you want to do. If you're doing a fast paced 3D First Person game you have to definately use C.

For slow paced games like puzzle games anything will do.

For my game I had to use C since it needs a lot of processing power. For the slow part I use Lua.

So yes, I don't want to start a language war here but I think that you have to choose the language that best fits the game in production.

Your turn... :D

Well, here I go joining the war, but I can't resist: C/C++ is definitely _not_ a requirement for "beautiful" nor "fast paced first person shooter games". Take a look at my java game, Tribal Trouble (http://tribaltrouble.com), which is not a FPS but a 3D RTS game, which is close enough for me. It runs great on 700 MHz machines with a Geforce 1 and up - and did I mention that the exact same binary runs on mac, win32 and linux?

So if you have to choose another language than the one you already know, don't take the speed arguments too seriously. Measure it for yourself if you really like, or simply choose it from more important issues like ease-of-development, portability and the availability of utility libraries for network, graphics acceleration and what else you need.

- elias

halodrake
12-28-2004, 12:37 PM
Well, here I go joining the war, but I can't resist: C/C++ is definitely _not_ a requirement for "beautiful" nor "fast paced first person shooter games". Take a look at my java game, Tribal Trouble, which is not a FPS but a 3D RTS game, which is close enough for me. It runs great on 700 MHz machines with a Geforce 1 and up - and did I mention that the exact same binary runs on mac, win32 and linux?


Never said it was a requirement. Although having the minumum of a 700mhz machine does not sound fast to me. A lot of people still haven't got systems over 300-500mhz range. Although, with the prices of PC's dropping rapidly, this shouldn't be a problem. It's a trade off- you want your binary to run on Mac, Linux, windows. But, you have to limit the users to those that have a 3d card and a machine over 700mhz. This may not sound like much, but it is a limatation. And it's not too complicated to write portable C/C++ code these days.

Add into the fact that Java's syntax is remarkbly similiar to C++, the fact that C++ has a *scary syntax* to some people doesn't make Java any more or less appealing than C++.


So if you have to choose another language than the one you already know, don't take the speed arguments too seriously. Measure it for yourself if you really like, or simply choose it from more important issues like ease-of-development, portability and the availability of utility libraries for network, graphics acceleration and what else you need.


And almost every language out there has game making capibilities these days, usually viua extentions (written in C/C++) to OpenGL or SDL or Allegro or DirectX. And not everyone has the time to research and try a new language before using it and deciding if it's right or not. C/C++ are still very good languages, and they are not as complicated as people like to make them out to be.

oNyx
12-28-2004, 01:43 PM
>In the last 3 years I haven't come across a bug yet that I couldn't track.

I said hard to track not impossible to track.

>But I doubt a newb in Java would be able to crash it just as fantastically, and
>that newb would have just about as hard a time to fix it in Java.

No. You can't crash the machine at all unless you stumble upon a bug in the VM. For example back in 2000 with Java 1.2... whenever I accessed the DB I got a BSoD, but that piece is fixed since ages.

You don't have pointers, down casting must be done explicitly and if you leave the array bounds the program will just cleanly exit, leaving some usable hints in the console. The exception type (IndexArrayOutOfBoundsException), which class, which line and which index. That makes it really much easier.

>I don't quite grasp that.

"C++/C is the way to go for really good looking games."

I meant that you can create a good looking game in any language. Therefore I replayed with equally wrong reasoning, creating a causal connection between two things which aren't even remotely connected.

>Although having the minumum of a 700mhz machine does not sound fast to me.

A 500mhz machine with 128mb and a geforce-ish card is 5 year old hardware. Hardware that old will usually die or be replaced in the not to distant future. (Hardware is build to last 5-6 years).

Well, have you seen the screen shots? A game like that won't magically run 2 times faster if it's written in C++.

The chance to get maybe 10 percent more performance isn't worth to spend 2-5x time more on programming (that's unless you do the next Doom, Quake or Half Life). The gain is even smaller at the end, because it just took longer and the market shifted slightly during that time.

Tribal Trouble isn't done yet. I guess once it's finished it will be able to run on about 95% of the machines out there, which are still used by people who are somewhat interested in games. If you also take the genre - RTS - into account, it should be perfectly fine, because those ultra casual "soccer moms" aren't interested in such stuff anyways.

>Add into the fact that Java's syntax is remarkbly similiar to C++, the fact
>that C++ has a *scary syntax* to some people doesn't make Java any more
>or less appealing than C++.

I like C-ish syntax. Otherwise I might have switched to something like Blitz. I actually disliked Java very much at the beginning, but once I realized that it really helped me to create working programs much faster I continued using it. (It's about the same for people switching from C/C++ to something like C#).

I'm a one man army. Time is the most valuable resource. Therefore the productivity gain is the most important aspect. A tiny speed disadvantage or higher memory usage (~8mb for the vm and somewhat like 40 bytes overhead per object) aren't even worth thinking about. Those things just don't matter for the kind of games I have in mind. They should be fun and not tech demos ;)

Well, everyone has slightly different priorities. Picking the language should depend on those.

C_Coder
12-28-2004, 03:34 PM
Are we talking about time to market or who can make the best games with which language?

I could make a very fast game in Qbasic if I want to but I chose C++ as being 'the best of both worlds'. This being that since I knew assembly and basic I wanted a mid-level language to use that is fast and I can be in control of everything that I want.

Nowadays with the current speed of computers it is always a trade off between the speed of the computer and the requirements of the game.

There are soooo many languages to choose from nowadays and as it was already said, all of them have gaming capabilities. We live in a free world and you have the choice to use any language you want to.

I chose C/C++ especialy since my main work is on systems programming under Windows NT. I do the 'real hard stuff'. Gaming is a hobby for me. :D

I can learn any language I want to in 5 minutes so it is not a case that I only want to use C/C++. The fact remains that C is the language that survived since the early days it was invented and it is always being improved.

Another 2 cents... :p

20thCenturyBoy
12-28-2004, 04:17 PM
As more high quality libraries become available with multi-language bindings, choice of language will become less relevent. Games will be a collection of API calls. And it doesn't really matter what language you use to call an API.

BedroomCoder
12-28-2004, 05:30 PM
I suppose what I meant when I said "C++/C is the way to go for really good looking games", is that its the most famous one.

"C/C++ is definitely _not_ a requirement for "beautiful" nor "fast paced first person shooter games". Take a look at my java game, Tribal Trouble, which is not a FPS but a 3D RTS game, which is close enough for me."

Very sorry, but I think DOOM 3 looks better than your game... :p (still looks good though!)

Also, I wouldnt say its a req, but its probably one of the most widely used.


Problem with me is whenever anybody thinks java I think of website javascript :eek: :p

HairyTroll
12-28-2004, 05:31 PM
I can learn any language I want to in 5 minutes so it is not a case that I only want to use C/C++.

Ok now, I think you are generalizing all languages as being a part of the Algol family. In other words, "I know C/C++/Basic/Pascal/Cobol, therefore I can learn any language in 5 minutes."

Set your stopwatch for 5 minutes and try and learn any one of the functional programming languages such as Prolog, Lisp, Scheme or Haskell.

To paraphrase Douglas Adams and his 'Pan-Galactic Gargle Blaster'; learning a functional language after coming from C/C++ is like "Being hit in the head with a slice of lemon wrapped around a large gold brick"

HairyTroll
12-28-2004, 05:34 PM
As more high quality libraries become available with multi-language bindings, choice of language will become less relevent. Games will be a collection of API calls. And it doesn't really matter what language you use to call an API.

I think this is going the other way in that I see a greater number of newer libraries with C++ only bindings. I consider the only lanuage-neutral binding to be C. Long live C.

princec
12-28-2004, 06:34 PM
Having got and played both, I'd have to say Tribal Trouble is the better game, on all measures.

Cas :)

Diodor Bitan
12-28-2004, 10:32 PM
Original post by HairyTroll
Set your stopwatch for 5 minutes and try and learn any one of the functional programming languages such as Prolog, Lisp, Scheme or Haskell.

Yeah! :)

Of course, now I'll have to correct you on a couple of points.

Prolog is not functional, it is a logic programming language. Prolog is very interesting, and I regret I didn't use it more. I doubt that it could be used as a general purpuse programming language, but it certainly seems fit to overcome AI problems.

Lisp is not _just_ functional. Lisp is what all other languages want to be when they grow up. It's a general-purpose multi-paradigm language, powerful and expressive, yet safe, sane and with a simple syntax.

C_Coder
12-29-2004, 02:25 AM
I know more computer languages than actual spoken languages! :p

Anyway. It is all a matter of choice and how comfortable you feel with a language. I feel very cosy with C/C++ than any other language. :cool:

Diodor Bitan
12-29-2004, 02:40 AM
Original post by C_Coder
It is all a matter of choice and how comfortable you feel with a language.

I think it's more a matter of the quality of the implementations of the language and it's libraries than the quality of the language (bug freedom, download size overhead, portability etc.). Which is why I cannot recommend Lisp (yet) - I just don't know a lot about those issues.

BedroomCoder
12-29-2004, 04:43 AM
Having got and played both, I'd have to say Tribal Trouble is the better game, on all measures.

Cas :)

Doom 3 is my favorite game. Maybe you just don't like shoot em ups or maybe your PC is too pants to run it?


And, same here, C_Coder ;)

princec
12-29-2004, 04:57 AM
Maybe you just don't like shoot em ups or maybe your PC is too pants to run it?LOL! Sif. Doom3 is just not very good. But that's IMHO.

Cas :)

halodrake
12-29-2004, 05:10 AM
As more high quality libraries become available with multi-language bindings, choice of language will become less relevent. Games will be a collection of API calls. And it doesn't really matter what language you use to call an API.


And those bindings will be done in C or C++. Most languages people are suggesting here are written in C or C++. But that shouldn't matter. My main point was this:

C/C++ has lately been getting a bad rap for being "hard to learn", "needless complicated" and "impossible to debug". And it's just simpley not true. There are benefits to other languages, mostly portability, but it will hurt speed. Yes, it may be 5 year old hardware, but try telling that to a wife with three kids that she needs to cough up 400$ or so to buy a new computer because hers is outdated.

Most people (the casual gaming public) do not want to buy a bigger and better computer until they absolutely have to. And then they buy the bare minumum. So, if you are targeting a casual gamer (like most shareware games) then you will want to shoot for the hardware of a casual gamer. Which, 75% of the time will be a lower-end PC without a graphics card.

Back on track here-> C/C++ is not hard to debug. Bounds checking an array is just common sense. If you expect your compiler to do it for you, you really need to brush up on basic programming skills. Pointers are pretty simple. Casting is not as big as a deal as you make it out to be, and most of the time casting is an un-elegant solution to a problem. While these newer languages supposably make programming safer, really they are just allowing for bad programming skills.

And somebody mentioned people "migrating from C/C++" to languages like C# etc. People don't migrate away from C/C++. They learn new languages and learn them like new tools, but nobody I know that programs in C/C++ has ever *left it*.

BedroomCoder
12-29-2004, 05:13 AM
LOL! Sif. Doom3 is just not very good. But that's IMHO.

Cas :)

I don't want to start an argument, but personally I see it as the best game I have ever played. I actually wet my pants playing it.

princec
12-29-2004, 05:22 AM
And those bindings will be done in C or C++. Most languages people are suggesting here are written in C or C++. But that shouldn't matter. My main point was this:

C/C++ has lately been getting a bad rap for being "hard to learn", "needless complicated" and "impossible to debug". And it's just simpley not true. There are benefits to other languages, mostly portability, but it will hurt speed. Yes, it may be 5 year old hardware, but try telling that to a wife with three kids that she needs to cough up 400$ or so to buy a new computer because hers is outdated.Methinks you'll find that all games are perfectly possible with the new generation of managed environments, and barely run any slower at all.

Which, 75% of the time will be a lower-end PC without a graphics card.I'm afraid this is FUD; you've no actual figures to back this up at all. Whereas I have :) And about 99% of all the PCs currently in use appear have a 3D card in them of at least TNT1 capabililty.

Back on track here-> C/C++ is not hard to debug. Bounds checking an array is just common sense. If you expect your compiler to do it for you, you really need to brush up on basic programming skills. Pointers are pretty simple. Casting is not as big as a deal as you make it out to be, and most of the time casting is an un-elegant solution to a problem. While these newer languages supposably make programming safer, really they are just allowing for bad programming skills.Speaking as a manager here I would have discounted you already as a n00b for each one of these statements. Programming skills are not an end in themselves! No-one cares how l33t your skills are. What is important is the bottom line - how long does it take to get something that works to market. While you're being smartass and remembering to do this that and the other to make sure your code doesn't have any inexplicable bugs in it, a team of Java/C# minions will already be on the next project. To claim that relying on compilers to catch pointless errors is a lack of skill is quite misguided indeed.

nobody I know that programs in C/C++ has ever *left it*.You know know at least one programmer!

Cas :)

princec
12-29-2004, 05:24 AM
But then I worship Soldat ;) So I expect our opinions on Doom3 will be quite different!

Cas :)

EpicBoy
12-29-2004, 05:45 AM
I don't want to start an argument, but personally I see it as the best game I have ever played. I actually wet my pants playing it.
The tech was wonderfully impressive but the game design was ridiculously bad. Monster closets? Please.

You can't even begin to compare Doom3 with games like Half-Life2. The difference in quality is so vast, it's insurmountable.

BedroomCoder
12-29-2004, 06:00 AM
Please don't start to argue, I have already had the doom 3 vs half life 2 fight before. All I can say is that if hl2 is like hl1, then I'll hate it. I played Half life 1 and I didn't enjoy it at all. I wouldn't pay a cent for HL1, or even bother downloading it, and if HL2 is anything like it I think I'd rather go play a nice game of Pong.

Also the monster closets are quite well done, they put "duds" in in some places, bits of walls coloured other colours to fool you into "preparing yourself" to shoot at enemys coming out, but then a door opens behind you, one with no texture differance between the door and the wall. Lights go out, enemys run in with machineguns, shoot, walk foward, and suddenly a pinky appears and runs at you from behind. Just beautiful.

halodrake
12-29-2004, 06:18 AM
Methinks you'll find that all games are perfectly possible with the new generation of managed environments, and barely run any slower at all.


My 300mhz machine at home says differently.


I'm afraid this is FUD; you've no actual figures to back this up at all. Whereas I have And about 99% of all the PCs currently in use appear have a 3D card in them of at least TNT1 capabililty.


If that's 99% of the people that buy your games, probably. I'm talking about people I know, personally.


Speaking as a manager here I would have discounted you already as a n00b for each one of these statements.


A manager where? OfficeMax?


Programming skills are not an end in themselves! No-one cares how l33t your skills are. What is important is the bottom line - how long does it take to get something that works to market.

And skills are very important in getting something done. You don't have to be l33t skills to do an array bounds check. Were talking BASIC programming here.


While you're being smartass and remembering to do this that and the other to make sure your code doesn't have any inexplicable bugs in it, a team of Java/C# minions will already be on the next project. To claim that relying on compilers to catch pointless errors is a lack of skill is quite misguided indeed.


And then, when their programs crash later on and they can't figure out why, they'll realize why compilers catch errors that they do. Besides, my compiler doesn't point out errors to me anymore. I've gotten a few warnings as of late due to the new GCC, but meh.

Either way, I've programmed (professionally) in Java, C, VB and VC++ as well as Delphi, Python, ASP and PHP. For hobbyist/game coding I perfer C++ and Lua. For work, I program in whatever makes sense for what I'm trying to do.


You know know at least one programmer!


I know almost 500. And of that number, nobody has left C/C++. They have only learned new languages and used them when needed. But never stopped using C/C++ altogether.

EpicBoy
12-29-2004, 06:36 AM
Please don't start to argue, I have already had the doom 3 vs half life 2 fight before. All I can say is that if hl2 is like hl1, then I'll hate it. I played Half life 1 and I didn't enjoy it at all. I wouldn't pay a cent for HL1, or even bother downloading it, and if HL2 is anything like it I think I'd rather go play a nice game of Pong.
I look forward to not playing your game.

EpicBoy
12-29-2004, 06:36 AM
My 300mhz machine at home says differently.
Do you live in a museum?

halodrake
12-29-2004, 06:43 AM
No. Not all of us can afford to update their computer every few years. I have a wife and a daughter, feeding them and paying the rent right now is more important than getting something newer. And- I can make the games I want on it, and they run fine.

princec
12-29-2004, 07:17 AM
My 300mhz machine at home says differently.http://www.puppygames.net/downloads/SetupAlienFluxDemo.exe - Plays fine @ 300MHz, all pure Java. Provided you've got the 3D card, natch ;)

If that's 99% of the people that buy your games, probably. I'm talking about people I know, personally.Ah now see, that's two very very different things. There's absolutely no point in discussing anecdotal personal details on this forum because it has no relevance to any of the developers in here whatsoever. The data I have are collected from 11,208 successful installs of my games over the last year. I've got lots of interesting stats if you want to ask me about them in another thread (plenty people want to know the answers too so feel free).


A manager where? OfficeMax?
I'm the CTO of a performance management company. It's less exciting than it sounds.


And skills are very important in getting something done. You don't have to be l33t skills to do an array bounds check.
For every programmer who thinks this, there is a buffer overflow vulnerability in some widespread bit of software causing havoc. The wise programmer gets the machine to do as much work for him as possible so he can get on solving the problem.

C++ with Lua is a good choice.

Cas :)

BedroomCoder
12-29-2004, 07:54 AM
I look forward to not playing your game.

I look forward to not playing HL2 :rolleyes:

But then I worship Soldat ;) So I expect our opinions on Doom3 will be quite different!

Cas :)

I know a guy whos mad about both...

halodrake
12-29-2004, 07:56 AM
http://www.puppygames.net/downloads/SetupAlienFluxDemo.exe - Plays fine @ 300MHz, all pure Java. Provided you've got the 3D card, natch


That I do. But the statement wasn't pointed at you- it was pointed at someone saying that the requirements for *their* Java game was 700mhz.


I'm the CTO of a performance management company. It's less exciting than it sounds.


Sounds about as exiting as my job. Sorry about the Office Max jab there- but I don't like being called a newb.


For every programmer who thinks this, there is a buffer overflow vulnerability in some widespread bit of software causing havoc.


That is true- there are a lot of buffer overflow vulnerabilities in stuff out there. But, these projects are also massive scale projects with lots of people working on them.

This, I think, has more to do with larger corperations cutting costs by hiring people with no actual work experience on a temp basis. M$ does this all the time. If you have people involved (even 1 person) without even the basic, rudimentary C knoweldge (on a project using C), errors are bound to happen.

I've had this happen. I've worked in group where only 1 or 2 people had any real knowledge. One project I had a kid who was still in school and didn't know anything about C. He thought he could learn it in 2 weeks before he started work. We were working on turning a Z80 based POS device into an ATM, and memory was very scarce. Proper memory managament (and not of the simple array-bounds checking kind) was necassary.

Needless to say, he made the whole venture into a nightmare it didn't need to be.


The wise programmer gets the machine to do as much work for him as possible so he can get on solving the problem.


I agree whole-heartadly to this. But the wise programmer also does this very carefully, and understands what the machine is doing so that if it doesn't do the work properly, he can fix it.


C++ with Lua is a good choice.


Java is a good choice as well, don't get me wrong. It is a very good choice. But I don't think C/C++ deserve as bad a rap as they've been getting lately. I don't think the answer is clear cut- you can't just say learn program X because it's the best for thing X. I think it boils down to expression. If you can feel you can express yourself properly in Java, then you have no need to use anything else. Use whatever language you can express yourself most clearly in.

Of course, this doesn't help the original poster at all, since you don't know what you can express yourself best with until you try it.

princec
12-29-2004, 08:19 AM
It's tricky to dabble but I've discovered something really cool that I just didn't "get" a few months ago: applets! Designing a project that has to fit under half a meg to download and takes less than a week to do from start to finish is great fun and it's helped me to really appreciate a whole new facet of Java I've hitherto ignored.

I think it's the best recipe for experimenting: write a full, working game in 10hrs. You could do 5 versions of the same game, one in each language, and after a week you'd have a great idea how much hassle is involved in each language.

Cas :)

GBGames
12-29-2004, 08:29 AM
With CPU speeds getting as fast as they are, processor cycles aren't nearly as precious as they used to be. Using C/C++ for speed doesn't apply nearly as much with games as it does with operating systems. The trend is to get the compiler to do as much work for you so you can concentrate on developing software instead of programming. Garbage collection is just one feature that makes life easier for the developer.

That all said, I think it is fair to say that there are plenty of projects that have been done well using C or C++. If you know C++, it might be faster for you to just use it rather than learn all the nuances of a completely different language. The trick is to avoid thinking that your hammer will work great for cutting wood because learning how to use a saw would be just too time consuming.

EDIT:
So if you are deciding on which language you want to use, you do have to analyze what your goals are. Do you want to learn how to program, how a computer's memory architecture works, etc? Use C. Do you want to get a product out there? You might be better off using something like Java. And if you already know a language really well and want to get a product out there, use it. The expertise you have will probably mean that it is quicker for you to use it than to learn something new. It is possible to use C++ in a safe manner, but to learn how to do this comes with experience, something you may not want to wait to develop. It is also possible to use Java and C# in a dangerous manner. Maybe not the same dangers, but they exist.

halodrake
12-29-2004, 08:30 AM
That reminds me- the first thing I do when I learn a new language is I try and program a video game in it. I think to me the reason why I learned to program is to make video games. All that other crap just came along with it. Yeah that's probably the best way to test each one- although until your comfortable with a language it's hard to see the big picture. For a while I almost swore of all other programming languages completely and programmed in Python. Only after a year of doing it (when I was comfortable enough with the language) did it's really disastrous quirks begin to show. And then, I started getting frustrated because Python wasn't what I needed. It wasn't a magic bullet to cure anything. Sure, it's expressive and easy to pick up- but it has a lot of flaws that are only visible in larger scale projects. So, I went back to being multi-lingual, and use Python for small things and prototyping.

Heh, I haven't done an applet in ages. That's what I first learned on how to do Java in 98. God that was a long time ago.

EpicBoy
12-29-2004, 08:34 AM
I look forward to not playing HL2
Excellent. Not playing the best FPS game to come out in years will do wonders for keeping your finger on the pulse of the industry.

BedroomCoder
12-29-2004, 10:45 AM
Excellent. Not playing the best FPS game to come out in years will do wonders for keeping your finger on the pulse of the industry.

That is if you consider it one of the best FPS games to come out in years.

I also don't buy games much anyway, its hard to actually get excited enough about them to put the money forwards.

EpicBoy
12-29-2004, 10:48 AM
Your designs should be something to see. Can't wait!

BedroomCoder
12-29-2004, 02:36 PM
Oh no, you've got me there, really. I feel so downhearted now you are insulting the design of my levels that I havent even made yet. ¬¬

I've played most of the bigguns, the only ones I havent played are Deus ex (mainly because I've only just heard of it), and half life 1 (because for the first 30 mins I played it, I regarded it unworthy of installing on my own PC). I do play games, but I didn't think I should mention the ones I've played here, since the majority of them are not "ethically purchased".

princec
12-29-2004, 03:02 PM
You're really giving us a lot of rope to hang you with here. I suggest you be quiet for a time.

Cas :)

BedroomCoder
12-29-2004, 03:06 PM
K epicboy, made a quick level for ATAK, 3d space ship arcadey ring flying game, my next one, hopefully. I hope you like the level - if not, eat shit.

[NOTE: I know its made in Terragen. Its CONCEPT ART.]

EpicBoy
12-29-2004, 04:35 PM
"Eat shit"? We're doing personal attacks now? Grow up, kid.

BedroomCoder
12-29-2004, 04:48 PM
I see you didn't comment on my level design, then.

Whats the point in arguing if its just an argument between "I like Doom 3" and "I like HL2"? Lets stop arguing, we'll only get this topic locked.

Is python any good? I haven't heard much about it.

What I'd probably do to choose a language is pick the arguably best game made in the language and have a look at it. If it meets ya specs, try the language :)

Dan MacDonald
12-29-2004, 04:55 PM
BedroomCoder work on presenting a more mature additude in these forums or you will find that the forums are "read only" to you the next time you log in.

This discussion has deteriorated too far, I'm going to have to close it as well.