Skip to main content
GameDev.net gamedev.net
🔒 Locked

New standard language?

Started by User ID Jun 18, 2004 at 5:20 PM 83 replies 14.9k views
Original Post
User ID
User ID
I'm currently using C# right now, I used to use C++ back when I never heard of it. And from that time to the time I switched which was recently it seems to have become very popular. But not so much in the game programming field. I'm not talking about in the industry. Due to that there isn't a lot of game programming tutorials on it. I can only find 1 decent website that uses it for non-puzzle games or rather with DirectDraw. There are some others I'm sure but very few. Will C# eventually catch on for game programming hobbyists and hopefully in the in gaming industry, and as a result more available learning resources? I'm not sure if this is an overdone topic or not.
falkone
falkone
I'm sure it will eventually.. but C/C++ is going to hang on for a long while.. It would take a very significant change in the way we write programs to make it obsolete..
Disclaimer: "I am in no way qualified to present advice n any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)" o
Samith
Samith
If you're a good enough programmer and you know both C++ and C# then you should be able to read a game tutorial in C++ and be able to apply it to C#. In fact, if you're a good enough programmer and you only know C#, you should be able to translate game programming concepts into C# code.

Anyway, C# might catch on, but I really think C/C++ will be the standard for quite some time. C# just isn't that much of a leap to change the industry standard. C++ has been good enough for programmers for years, I don't see why C# would change this. It's not really that much easier to code with or anything.
Etnu
Etnu
C# will eventually replace C++, but probably not for at least a few years.

+ C# is "cleaner" currently; it actually has built in support for things like real strings and whatnot, unlike the hacks found in C++ like the STL. Yes, eventually C# will have these hacks too, but at least it won't need seperate libraries for something as basic as a string.

+ C# makes portability far easier - you'll never have to write platform-specific code again, unless you really, really need that extra bit of optimization that somehow got missed at initial compile time, install compile time, or JIT.

+ C# has syntax and useage that any C++ programmer should (unless they're retarded) be able to pick up right away. I've never really written a full-fledged C# application, but I have no trouble understanding exactly what's going on in source that I've looked at.

+ C# compiles into CLI code, which is an ISO standard. There are ALREADY compilers and IDE's for it on virtually all platforms.

The downsides:

- C# code is currently slower than native code. This will become less significant with JIT and "Install on compile" improvements. You can already see many areas where C# runs just as fast as C++ code while doing the same algorithm. The DX9 SDK shows samples for comparison, and while on one sample there may be a difference in frame rates of several hundred frames per second, on others that difference may be practically nil. FPU-intensive applications (GAMES!!!) are still quite crippled under C# as opposed to C++.

- C# really doesn't provide any inherent advantages over a C++ codebase that's already mature. The algorithms aren't going to be any simpler, the data structures aren't any less complex, and the need for intuition and innovation is still there.

I think that, ultimately, C# is the logical successor to C++ in the way that C++ succeeded C, and C succeeded Assembly.

It just doesn't make sense to develop applications in C++ anymore, unless speed is still an issue.

There is no place where speed is more of an issue than in real-time graphics.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
bytecoder
bytecoder
C# isn't the only other language out there. I, personally, prefer a mixture of python and C++1 for game programming and plain python for everything else.
1Used sparingly for the speed-intensive parts, such as collision-detection.
User ID
User ID
Good posts. I guess the major thing hurting C# really is speed and I mentioned before the lack of learning resources. I guess I shouldn't plan on it become the standard language at least any time soon. First assembly then C then C++. Each langauge seems to be slower than the previous ones. So really speed shouldn't be as big an issue as other parts I'm guessing. But in game programming it seems to be a lot more important than other areas of programming which I understand why.

I looked into python before I used C#. I was going to try Pygame but not sure how many people use it or do people use Python for games if so is Pygame just to make it more simple? I looked around a bit and saw that C# was becoming popular while Python seemed to be only used for parts of a program or just as a scripting language and not the whole most of the time.
C-Junkie
C-Junkie
Quote:
Original post by Etnu

C# will eventually replace C++, but probably not for at least a few years.

I think that, ultimately, C# is the logical successor to C++ in the way that C++ succeeded C, and C succeeded Assembly.

It just doesn't make sense to develop applications in C++ anymore, unless speed is still an issue.

There is no place where speed is more of an issue than in real-time graphics.
I think you're sort of right, and sort of wrong.

First, you have to realize that C++ never beat C. C is still used. A lot. I write C code just as much as I write C++ code, if not more. The thing is, it's on a different level that C++ or C#. It would be stupid for system-level libraries to be written in anything other than C. C dominates that low-level system-wide stuff (C libraries can have bindings in any language), and I am not stupid enough to predict that anything will replace it anytime soon.

However, above that you have a lot of layers. IMO, C# is going to take a lot more of the market share away from very high level stuff like VB or possiblely some java than it will C++, at least for a while.

I'm going to instead of explaining with a lot of words, make an attempt at some horrible ASCII-art diagrams. :)

   Now                    EventuallyH /- C -----------------\ /- C ---------------i |                     | |                   |g |    /----------------/ \-------------------/h |    | /- C++ --------\ /- C# ----\/- c++ --e |    | |              | |         ||        |r |    | |              | |         ||        |- |    | |              | |         ||        |l \----/ \-----------\  | |         ||        |e /- Java\ /- VB ---\|  | |         ||        |v |      | |        ||  | |     /---/\-----\  |e |      | |        ||  | |     |/- VB ---\|  |l |      | |        ||  | |     || & Java ||  |  \------/ \--------/\--/ \-----/\--------/\--/|V


This isn't meant to be accurate, only to show that C will settle in as a low-level only, and that C++ and C# will coexist. And to show that I'm predicting VB & Java to dwindle, again, mostly to C#.

This is also assuming that Microsoft isn't criminally stupid, and doesn't start trying to make all of C# proprietary.

NOTE TO MODS: Forums eat lines that end with \, please fix, mmmkay?
Ravuya
Ravuya
I'm not really much of a fan of C# quite yet (except for network apps -- oo la la!), but I can definitely see where managed code will come in -- I just don't want to relinquish control!
C-Junkie
C-Junkie
I forgot to mention, that I agree that C++ will still be the de facto game programming language for a long time.

I'm betting on this enough that if microsoft penalized "Unmanaged" code in longhorn, that PC gmaing will dwindle to consoles and Mac/Linux.

Managed code is a pain in the ass for games, but brilliantly excellent for applications. :)
Ravuya
Ravuya
Quote:
Original post by C-Junkie
I'm betting on this enough that if microsoft penalized "Unmanaged" code in longhorn, that PC gmaing will dwindle to consoles and Mac/Linux.


They wouldn't do that. Thankfully Microsoft has a history of bending over backwards for developers -- that's where a number of their security flaws comes from (backwards compatibility at all costs -- even to LANMan hashed passwords!).
Drakonite
Drakonite
Quote:

It just doesn't make sense to develop applications in C++ anymore, unless speed is still an issue.

There is no place where speed is more of an issue than in real-time graphics.


Speed and memory usage should always be an issue IMO.
Too many people think that just because their app/game runs on a dual 2ghz athlon system with 1gb of ram that it's good enough. What about a 1gz with 512mb ram? or a 400mhz with 192mb ram? Or what about a system that has lots of things running at once?

All of these performace problems coders put up with in programs because they just don't seem to make a difference add up, and you end up with bloated systems, like most windows boxes I see, where there is no reason a 600mhz system shouldn't be able to do all of that, except that all the various programs are bloated too much and the programmers are too lazy and don't care enough to optimize.


A bit more on topic, I think c# will end up being like c++ or java. A lot of people won't see the purpose in using smaller languages and will use c# instead, and it will be popular; but the hardcore people will still be writing a lot of stuff in c with important parts optimized in asm, and their framerates will still be blowing everyone elses away.

..btw, before I start a flame war, I am not trying to say any language is better than another. Yes, I am mentioning that OOP is a bit slower and require more memory than non OOP, but that doesn't make it inferior, they are each better for different purposes.
Shoot Pixels Not People
C-Junkie
C-Junkie
Quote:
Original post by Ravuya

Quote:
Original post by C-Junkie
I'm betting on this enough that if microsoft penalized "Unmanaged" code in longhorn, that PC gmaing will dwindle to consoles and Mac/Linux.


They wouldn't do that. Thankfully Microsoft has a history of bending over backwards for developers -- that's where a number of their security flaws comes from (backwards compatibility at all costs -- even to LANMan hashed passwords!).


There was a recent article (pointed out in the lounge before it got slashdotted) about the Windows API that suggests that the other "camp" has won out over the backwards-compatible "camp."

I wouldn't be so sure that they won't make unmanaged code a second-class citizen.

But again, this is about microsoft, let's try and keep it clear of unnecessary refrences to them, so this doesn't turn into a flame war even faster.
C-Junkie
C-Junkie
Quote:
Original post by Drakonite
there is no reason a 600mhz system shouldn't be able to do all of that, except that all the various programs are bloated too much and the programmers are too lazy and don't care enough to optimize.
This is, arguably, the purpose. Paul Grahm, or whoever it is, has a paper on "the hundred year language" and while much of it is bunk because he's a LISP whacko (not that they don't have some good ideas!), he mentions that sacrificing code efficiency for programmer efficiency is a good thing, mostly.

I think I agree, which has made me warm up a bit to C#, but definately not for games. At least, not good (read: modern) ones. Maybe an EMPIRE clone, or tetris... But I doubt I'd even user it for a liero/worms clone, since I COULD be using those cycles for physics :)
Drakonite
Drakonite
Quote:
Original post by C-Junkie
This is, arguably, the purpose. Paul Grahm, or whoever it is, has a paper on "the hundred year language" and while much of it is bunk because he's a LISP whacko (not that they don't have some good ideas!), he mentions that sacrificing code efficiency for programmer efficiency is a good thing, mostly.

Now, while I would agree with that for certain purposes, I wouldn't listen to anyone that claims that without qualifying it. Sacrificing a small bit of effeciency for easy of programming can be a good thing, however it seems that far too often lots of bits are sacrificed in lots of area, includind tons of very large problems, a very large number of with are because of a lack of planning (or a plan that never thought about effeciency) or just plain lazy programming.

*sighs*
I suppose this makes me sound like an old inflexible hardcore programmer that hates everything new eh? [embarrass]
Shoot Pixels Not People
Doc
Doc
Some people still seriously use FORTRAN. It takes a very very long time for a language to become unused, and that will be especially so for languages as ingrained as C and C++.
Kylotan
Kylotan
Quote:
Original post by User ID
Will C# eventually catch on for game programming hobbyists and hopefully in the in gaming industry, and as a result more available learning resources?


In my opinion, yes and no. Yes, it'll catch on for hobbyists, and no, it'll never be popular in the professional industry.

I see no reason why hobbyists shouldn't use it if they enjoy the language and are happy with the limited number of platforms they can deploy their game on.

However I seriously doubt any professional developers are going to see any reason to change from C++ to C#. C# undoubtedly has some development time merits but it would involve all these developers retraining and learning a new language as they go along, which is going to be considered risky. They're going to be less able to draw on existing code, meaning they're building more from scratch. They're also probably going to be reluctant to relinquish memory management to the garbage collector, although C# may handle that very well. And how many existing libraries work with C#? Probably not many. I expect it's reasonably simple to wrap them so that they work, but it's more effort and more scope for things going wrong. (A recent thread in this forum suggested that linking C# to C++ code is a lot more awkward than I'd expected it to be.) Lastly, while theoretically a JIT-compiled language could run faster than native code, practically this doesn't really happen yet. Apart from isolated incidents, nothing is beating C/C++ for speed, and speed matters to most game developers.

If I was going to move to a new language to gain benefits in terms of development time and ease, I'd want to make a much bigger step than just to C#. I'd be more inclined to go to Python, Ruby, or something like that. I think that any small step towards a new language won't happen for another 4 or 5 years, and when it does, it'll be towards that sort of language.
clum
clum
Quote:
Original post by Etnu
C# will eventually replace C++, but probably not for at least a few years.

+ C# is "cleaner" currently; it actually has built in support for things like real strings and whatnot, unlike the hacks found in C++ like the STL. Yes, eventually C# will have these hacks too, but at least it won't need seperate libraries for something as basic as a string.

+ C# makes portability far easier - you'll never have to write platform-specific code again, unless you really, really need that extra bit of optimization that somehow got missed at initial compile time, install compile time, or JIT.

+ C# has syntax and useage that any C++ programmer should (unless they're retarded) be able to pick up right away. I've never really written a full-fledged C# application, but I have no trouble understanding exactly what's going on in source that I've looked at.

+ C# compiles into CLI code, which is an ISO standard. There are ALREADY compilers and IDE's for it on virtually all platforms.
I haven't looked into C# that much (in fact, I haven't looked into it at all), but if those are the main advantages C# offers over C++, then I'm glad I haven't. Those aren't very good reasons to switch languages, especially since C++ is also "portable", and having "built-in" strings is no different from having a "hack". However, most people that I know that have used C# do seem to think highly of it, so I'm assuming there are better reason for using it over C++.
Zorx (a Puzzle Bobble clone)Discontinuity (an animation system for POV-Ray)
NickB
NickB
Quote:
Original post by Doc
Some people still seriously use FORTRAN. It takes a very very long time for a language to become unused, and that will be especially so for languages as ingrained as C and C++.


*shudders* - I just completed my thesis project in Fortran 90 (still, I managed to write 2500 LOC in 24h, whilst effectively learning the language with what little of F77 I knew - why didn't the F90 standard just reference the C standard I wonder ... its not as if they didn't break all F77 code anyhow)

Still, on the bright side I can recomend the xmlf90 (xmlf90 lib) library for anyone who needs XML under FORTRAN 90 with all the bells and whistles of the DOM/SAX etc.
bytecoder
bytecoder
Quote:

I was going to try Pygame but not sure how many people use it or do people use Python for games if so is Pygame just to make it more simple?

Pygame is basically a port of SDL to python, which means that it runs almost as fast as using SDL in C/C++.
Quote:

I looked around a bit and saw that C# was becoming popular while Python seemed to be only used for parts of a program or just as a scripting language and not the whole most of the time.

Usually you right the bulk of the code in python and write the rest of it in C++, then create a python add-on out of the C++ code and use it from python; you get the best of both worlds: speed and ease of development. By the way, python is a very nice and clean language; even more so than C#, IMO. There's so many things that you take for granted in python that you would have to implement yourself in C++, not to mention the fact that you don't even have to spend the time to compile it! Anyways, now I'm just blabbering... Hope I changed your mind about python, it's a wonderful language :)
Wysardry
Wysardry
Excuse my ignorance, but is C# available on platforms other than Windows and/or from vendors other than Microsoft?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.