• What Language Is Best For Game Programming ?
    42 replies, posted
I know intermediately C++, Python and Java but i have to choose one and starting to improve myself to be an expert in one of these languages. You can suggest me an another programming language besides them. I'm waiting your comments.
There's no "better" language to do game programming and game development. It all depends on what language you're more comfortable with and what you would prefer. Though at best, in my opinion I prefer to use C# over C++ because there's some things that make it a lot easier for me, like garbage collection. But I wouldn't say that it makes C# "better" for game programming, if you get what I'm saying. :P
Language doesn't matter, as most languages have OpenGL/DirectX bindings of some kind. Just code in the language you feel the most productive in.
For industrial development, I'm gonna have to go with c++ out of those three.
Haskell
Honestly, I love Pyton in Java, but they're just not too viable for game making. They do alright for 2D and 3D, but if you want to do anything more advanced you'll want to use C++. Don't try throwing the "b-bu-but Minecraft/Runescape" argument at me; those are two successful cases. I used to use Java for everything, but I realized how impractical it is for my current projects.
C is also good. People will go on and on about how essential OOP is, but if you think about natural language, people typically keep objects and actions separate. So the separation of data and method that you see in a language like C is actually a lot more natural than many would have you believe. You can still do 'inheritance', in a sense, where you need it using unions, but I find that I really don't need it all that frequently. If it's popularity you're concerned with, C++ is definitely first, with C in (a probably distant) second place, and other languages way near the bottom of the list. C# is becoming popular with hobbyists, but I don't think many big professional projects are using it. Execution speed is a big issue with games because they have real-time constraints. C/C++ are both equally fast (just about anything else will be around 5X slower), but you can use a slower, more expressive language and just write the time-critical routines in C/C++ to get a huge performance boost (90% of the time spent by your program is generally spent in 5% of the code, so you only have to re-write that 5% to get a huge boost). If you're concerned with seeing results fast (most beginners need immediate feedback to learn), you'll probably want to go with something like Lua+LOVE or Python+PyGame. C#+XNA or Java are probably somewhere in the middle, but I'd say it's an uncomfortable middle where you don't get the expressiveness of Python or the speed of C/C++. Like usual, I'd suggest starting with Python and then later learning C or C++.
[QUOTE=ROBO_DONUT;33491081]C is also good. People will go on and on about how essential OOP is, but if you think about natural language, people typically keep objects and actions separate. So the separation of data and method that you see in a language like C is actually a lot more natural than many would have you believe. You can still do 'inheritance', in a sense, where you need it using unions, but I find that I really don't need it all that frequently. If it's popularity you're concerned with, C++ is definitely first, with C in (a probably distant) second place, and other languages way near the bottom of the list. C# is becoming popular with hobbyists, but I don't think many big professional projects are using it. Execution speed is a big issue with games because they have real-time constraints. C/C++ are both equally fast (just about anything else will be around 5X slower), but you can use a slower, more expressive language and just write the time-critical routines in C/C++ to get a huge performance boost (90% of the time spent by your program is generally spent in 5% of the code, so you only have to re-write that 5% to get a huge boost). If you're concerned with seeing results fast (most beginners need immediate feedback to learn), you'll probably want to go with something like Lua+LOVE or Python+PyGame. C#+XNA or Java are probably somewhere in the middle, but I'd say it's an uncomfortable middle where you don't get the expressiveness of Python or the speed of C/C++. Like usual, I'd suggest starting with Python and then later learning C or C++.[/QUOTE] If you use GCC you can actually implement a form of pseudo-OOP in C. It's actually a really great feature of the compiler. Let me research it real quick, and I'll inform you of the details.
C# is fast enough for games. He's not trying to create the next Crysis, so the speed loss (~3%) is neglectible. It are the algorithms and programming style that will be the biggest speed factor, not the language itself; that's abysmall and can be ignored.
Are you talking about GObject? Because that's a Gnome thing, not GCC. Although I don't doubt that GCC might have implemented something like that, I think the devs just get bored and start tinkering with shit. Next thing you know, GCC flys a fighter jet and shoots lasers from its eyes.
[QUOTE=Shammah;33491126]C# is fast enough for games. He's not trying to create the next Crysis, so the speed loss (~3%) is neglectible. It are the algorithms and programming style that will be the biggest speed factor, not the language itself; that's abysmall and can be ignored.[/QUOTE] Then use Java. There are much more libraries out there for it compared to C#. [editline]29th November 2011[/editline] [QUOTE=ROBO_DONUT;33491142]Are you talking about GObject? Because that's a Gnome thing, not GCC. Although I don't doubt that GCC might have implemented something like that, I think the devs just get bored and start tinkering with shit. Next thing you know, GCC flys a fighter jet and shoots lasers from its eyes.[/QUOTE] No, it's GCC.
[QUOTE=Shammah;33491126]It are the algorithms and programming style that will be the biggest speed factor, not the language itself; that's abysmall and can be ignored.[/QUOTE] This is true [i]until you get to systems with real-time constraints[/i]. You need [i]both[/i] efficient algorithms and fast execution in these situations. That's why you don't see many routers with firmware written in Java. You'd drop packets every time the GC ran.
[QUOTE=Soviet_Banter;33491147]Then use Java. There are much more libraries out there for it compared to C#.[/QUOTE] For the love of god, [B][U]DON'T[/U][/B] use Java. It's missing key features like default parameters, operator overloading and other general things. Ofcourse you may still use it and yay it's maybe cross-platform, but it's like telling somebody to use a car running on steam instead of a modern fast one. It's redundant and there are better alternatives. Besides, C# and it's libraries are growing exponentionally. [QUOTE=ROBO_DONUT;33491164]This is true [i]until you get to systems with real-time constraints[/i]. You need [i]both[/i] efficient algorithms and fast execution in these situations. That's why you don't see many routers with firmware written in Java. You'd drop packets every time the GC ran.[/QUOTE] Luckily our old bean wants to create simple games and is not limited by real-time constraints. He may pick any language he wants as the impact of some langiages on the speed is neglectible. A 300MHz Pentium processor running a Java program may easily outperform a Quad Core 3.6GHz processor running a program in C solving the same basic problem. @ 44:00 [url]http://www.youtube.com/watch?v=JTAkUs-NjxU&list=PLE621E25B3BF8B9D1&index=2&feature=plpp_video[/url] I suggest watching his lectures anyway to get a general feel for speed and algorithms. [editline]29th November 2011[/editline] I forgot to say; it is a core issue for the OP to understand the concept of creating games and knowing what he's doing. Using an easy language will make him fixate on the game and not on the lower level annoying problems he shouldn't be dealing with anyway.
[QUOTE=Shammah;33491236]A 300MHz Pentium processor running a Java program may easily outperform a Quad Core 3.6GHz processor running a program in C solving the same basic problem. @ 44:00 [url]http://www.youtube.com/watch?v=JTAkUs-NjxU&list=PLE621E25B3BF8B9D1&index=2&feature=plpp_video[/url][/QUOTE] You kind of took that out of context. That was showing [b]algorithm[/b] speed differences, not language speed differences.
[QUOTE=Jookia;33491346]You kind of took that out of context. That was showing [b]algorithm[/b] speed differences, not language speed differences.[/QUOTE] It does show that the algorithm and programming style show a rather dominant role in execution speed, however. The slowdown caused by some languages is in the end so small it can be neglected; even more when the benefits outweigh the trouble to just get that ~1-3% speed gain. The lad's just wanting to create games, he won't have to deal with timing and performance issues that big. If it's too slow it's 99.999% his code, not the language.
Overloading of any type is an abomination.
[QUOTE=ROBO_DONUT;33491142]Are you talking about GObject? Because that's a Gnome thing, not GCC. Although I don't doubt that GCC might have implemented something like that, I think the devs just get bored and start tinkering with shit. Next thing you know, GCC flys a fighter jet and shoots lasers from its eyes.[/QUOTE] I misunderstood the lecture. What I was talking about was nested functions. I believed that you could call the nested function outside of the parent, but that's a fallacious assumption.
XNA for example is a framework for C#. Beautiful 3D games have been created with stunning graphics running smoothly on an Xbox 360. The avarage PC nowadays is faster than an Xbox 360, and now don't tell me he'll be creating such stunning graphics the first time as well when he's trying to lean stuff. [editline]29th November 2011[/editline] [QUOTE=ROBO_DONUT;33491391]Overloading of any type is an abomination.[/QUOTE] Could you please eleborate that? I find overloading a magnificent feature saving me heaps of time and work.
[QUOTE=Shammah;33491402]XNA for example is a framework for C#. Beautiful 3D games have been created with stunning graphics running smoothly on an Xbox 360. The avarage PC nowadays is faster than an Xbox 360, and now don't tell me he'll be creating such stunning graphics the first time as well when he's trying to lean stuff.[/QUOTE] He will. Sorry, I'm such a rebel.
[QUOTE=Shammah;33491384]It does show that the algorithm and programming style show a rather dominant role in execution speed, however. The slowdown caused by some languages is in the end so small it can be neglected; even more when the benefits outweigh the trouble to just get that ~1-3% speed gain. The lad's just wanting to create games, he won't have to deal with timing and performance issues that big. If it's too slow it's 99.999% his code, not the language.[/QUOTE] Yes, but your post implied that Java on a P3 could run better than C on a Quad Core, you didn't note that using different algorithms was the way this happened, and it was in the context of languages, so it implied that it was language specific.
[QUOTE=Soviet_Banter;33491398]I misunderstood the lecture. What I was talking about was nested functions. I believed that you could call the nested function outside of the parent, but that's a fallacious assumption.[/QUOTE] I guess you kinda had it right. I'm guessing these nested functions also support closures, and "closures are the poor-mans OOP". [QUOTE=Shammah;33491402]Could you please eleborate that? I find overloading a magnificent feature saving me heaps of time and work.[/QUOTE] One thing I really believe in with regards to programming is that code should be explicit and clear. Overloading of operators (and functions/methods in general) is in direct opposition to that.
[QUOTE=ROBO_DONUT;33491476]One thing I really believe in with regards to programming is that code should be explicit and clear. Overloading of operators (and functions/methods in general) is in direct opposition to that.[/QUOTE] [code]vector2d a(4,5,6); vector2d b(1,2,3); vector2d c = a + b; // 5, 7, 9[/code]
[QUOTE=Jookia;33491444]Yes, but your post implied that Java on a P3 could run better than C on a Quad Core, you didn't note that using different algorithms was the way this happened, and it was in the context of languages, so it implied that it was language specific.[/QUOTE] What I was trying to say was that even with the fact that Java does run in fact slower than any other unmanaged programming language, in the end that factor can be totally ignored. Especially in the OP's case where that tiny bit of speed up just isn't worth the hassle of dealing with pointers or other volatile and error-prone language features. In the end he will be able to spend more time on programming his game rather than fiddling with linking errors and segmentation faults. He will learn these lower-level languages when the time's right and he in fact really needs those features these languages offer.
[QUOTE=Shammah;33491502]What I was trying to say was that even with the fact that Java does run in fact slower than any other unmanaged programming language, in the end that factor can be totally ignored.[/QUOTE] No. It can't. The same algorithm will run faster in C than in Java. This is important in mission critical programs. Languages matter.
[QUOTE=Jookia;33491498][code]vector2d a(4,5,6); vector2d b(1,2,3); vector2d c = a + b; // 5, 7, 9[/code][/QUOTE] And then you have to worry about what multiplication does... It's clear to you [i]when you're the one writing it[/i], but it's just a source of uncertainty for anyone reading your code.
Im using [URL=http://www.love2d.org/]this[/URL]. It uses Lua and has enough power. (Tho it can only write to an Appdata folder.) Great to use, can be compiled into an .exe (with some .dlls) Only downside is that you can de-compile that .exe with Winrar to see all the .lua files.
[QUOTE=Shammah;33491502]What I was trying to say was that even with the fact that Java does run in fact slower than any other unmanaged programming language, in the end that factor can be totally ignored. Especially in the OP's case where that tiny bit of speed up just isn't worth the hassle of dealing with pointers or other volatile and error-prone language features. In the end he will be able to spend more time on programming his game rather than fiddling with linking errors and segmentation faults. He will learn these lower-level languages when the time's right and he in fact really needs those features these languages offer.[/QUOTE] The myth, "Java is so slow" is such bulltshit. There are many examples of an algorithm in Java running many times faster, than in C. Just a second, let me link you the tests. [editline]29th November 2011[/editline] Albeit, every language has their own shining moments, and their, eh, rather embarrassing(?) ones.
[QUOTE=ROBO_DONUT;33491529]And then you have to worry about what multiplication does... It's clear to you [i]when you're the one writing it[/i], but it's just a source of uncertainty for anyone reading your code.[/QUOTE] My example showed how operator overloading can be used to make life easier. If multiplication with vectors is ambiguous, then you shouldn't be overloading multiplication. But with things that aren't ambiguous, overloading helps make code cleaner and more readable.
[QUOTE=Soviet_Banter;33491541]The myth, "Java is so slow" is such bulltshit. There are many examples of an algorithm in Java running many times faster, than in C. Just a second, let me link you the tests. [editline]29th November 2011[/editline] Albeit, every language has their own shining moments, and their, eh, rather embarrassing(?) ones.[/QUOTE] If Java ran faster, it was an implementation issue, not a language issue.
[QUOTE=Soviet_Banter;33491541]The myth, "Java is so slow" is such bulltshit. There are many examples of an algorithm in Java running many times faster, than in C. Just a second, let me link you the tests. [editline]29th November 2011[/editline] Albeit, every language has their own shining moments, and their, eh, rather embarrassing(?) ones.[/QUOTE] You are right, I was being dragged into the stereotypical thinking of managed vs unmanaged. Nowadays the speed difference is even [I]more[/I] neglectible. OP just wants to create video games, and he'll most probably start of creating non-heavycalculative 2D games where these language speeds are to be ignored. That's why he should start with an easy language giving him a chance to feel the taste of programming, instead of fiddling with errors. [editline]29th November 2011[/editline] Some benchmarks: [url]http://www.freewebs.com/godaves/javabench_revisited/[/url] [url]http://keithlea.com/javabench/[/url]
Sorry, you need to Log In to post a reply to this thread.