View Full Version : Languages: C, C++, Java, C#...
alchemist
12-06-2002, 02:41 AM
Okay, I really don't want to start any sort of a language war here. But I'm wondering what languages everyone is using for writing their games. Do you do it all in C++? Anyone doing any prototyping in Java? I've been hearing good things about C# (despite its origin in Mordor), as a good "get stuff done" language ala Java, but with the conciseness of Perl and portability of C. Good assessment, do you think?
What other languages do people use, if any? How about programming environments/IDEs?
kerchen
12-06-2002, 04:43 AM
I'm using MS Visual C++ & Dev. Studio. I'm just now getting around to learning Java (!) and I don't know anything at all about C#. I plan to make a simplified Java version of my game for promotional purposes (like Pogo's model), but it'll be a while before that happens.
Diodor
12-06-2002, 04:58 AM
I'm don't think the choice of language is particularly relevent, the libraries and APIs make the difference.
I'm quite happy with C and SDL for now.
I do everything with C++ in VS.NET. At work doing boring database stuff, I use C#, and it's awesome, but until I see it's performance under DX9, I won't be using it for games. Maybe to make some nice stable internal tools, but requiring your customers to have the .NET runtime installed is just too much to ask!
At least for a couple years...
;)
Grimreaper
12-06-2002, 06:35 AM
This may sound silly, but as person proud to be a programmer I would never dream of using anything but C/C++ for serious work; especially games. Ofcourse, the right tool for the right job so I would use VB for a front-end app if it is a better tool than C but generally speaking C/C++ and Perl are God's programming languages :)
Good games software pushes hardware limits therefore it requires smart, tight coding. Nothing in Java/C# or VB can give the same power to a games programmer.
Brian Azzopardi
PS
I have the sneaking suspicion that Microsoft is trying to kill of C in favour of C#.
Mark Fassett
12-06-2002, 07:13 AM
I use C# for any windows UI now. .Net is supercool for that. For game code, it's still C++, and I don't think I will change that any time soon.
Davaris
12-06-2002, 07:32 AM
I use C++ and I wouldn't use anything else because
a) It runs fast and is modular (if you know what you're doing).
b) Its an industry standard (if you use anything else you may find it hard to get good programmers).
P.S.
C is OK. But after using C++ I would hate to go back and use C (yuck!).
alchemist
12-06-2002, 08:43 AM
I've started reading a bit more about C#, and am impressed. It looks like a streamlined C++ in a lot of ways, but without closing you off from the flexibility you want.
Does anyone know about performance of C++ vs. C#? A few folks above have implied that C++ is still the fastest thing this side of assembler, but I wonder how true that is.
I'm not trying to be an advocate either, like I said before. I'm just curious about this new language. (I write a fair amount in Java myself, and have written extensively in C++ in the past.)
Jake Stine
12-06-2002, 10:04 AM
C#'s performance is pretty satisfactory. It's still a virtual state machine-based language, like Java, but with a much more compiled state of existence. Offhand I bet you could liken it's performance to something like Unreal's Unrealscript. Unrealscript has a much smaller memory footprint than the .NET bloat, but the process of interpretation is quite comparable in terms of CPU consumption (and syntax for that matter).
Microsoft's intended use of C# is as a higher level language, best suited for more scripting-like situations. In fact, MS has tools which allow you to incorporate C# into your program as an interpreted scripting language. MS made extensions to C++ to allow it to be able to handle a number of the new C# features, so that you can interface the two more smoothly. From there, you can use C++ for your core/engine/etc and then C# for upper level gameplay scripting. I know of one amateur game project specifically that implemented this idea in one of their recent development tests (that being Verge, http://www.verge-rpg.com ).
So yeah, if you're willing to give up some cycles to run a scripting language (and it seems most game developers are these days), then you should by all means be willing to give up some cycles to use C#. Just don't use it for your core rendering pipelines. ;)
Anyways, I think the most important point noted still is the fact that requiring the .NET components for your game is pretty critical still. If a 12 meg DirectX 8 download is something you're afraid might deter gamers, then what would a 20 meg .NET download do? :) That's the reason why the Verge project guys decided not to stick with the C# idea, because most of the Verge users didn't have .NET and they were balking big time at it. I'm not even sure if .NET is included with XP or not (can someone confirm that for me?).
- Air
Kai-Peter
12-06-2002, 10:10 AM
At the moment I use C++ extensively with Microsoft-Dev studio, Emacs and NMake as build tool. I write code and build in Emacs and debug in Dev-Studio.
I have tried prototyping in Java and actually had a positive experience with it. Then again, you have to be able to spare the effort, and I am not really sure if it paid off in the end. One problem I had was to decide the turnover point to the final language.
As all languages mentioned are still capable of producing the core code I agree with Diodor in that libraries are more important. I use C++ because it gives the closest relationship with the libraries I use. Probably, if you used MS libraries extensively you could argue for C# on the same basis.
As a sidenote:
I have tried various multi language solutions eg: C-Scheme, C++-Python, C-Java-Scheme. I have also checked out a host of other "scripting" languages to drop in as a higher level glue but so far my experiences have been negative. I site a few reasons:
- Extra effort required in maintining the glue code
- Difficulty in deciding which level a feature should be done in
- Too small projects to warrant the overhead (about 40-100k lines)
I don't think the idea of eg. C++-Python is very bad but I think you have to refactor a susbstantial and stable project into scripting and not try to set out with it. Somebody WILL disagree with this. C++ with configuration files seems to be quite a useful way to start out with.
I code in C, C++ and Delphi (done a bit of Java), I use Delphi by Choice. Fitznik is written in Delphi. These days I don't know what I'd do without published properties and virtual constructors.
It is interesting when I tell people I program games in Delphi , a large number think I'm crazy because most of the user interface generation support from Delphi is useless for games. The UI component is largely useless for games. The underlying language is very well designed however. It is also gettign to be remarkably easy to get a hold of to use in this respect. Borland is going for the GUI/Database market and doesn't really care about people like me so they give away versions of the compiler lacking Database support and other components I could care less about. Delphi 7 has apparantly just appeared on a coverdisk in this style.
As for speed of the different languages it is very difficult to test. Small tight loop code tests are easy to benchmark but most of the potential slowdowns are in other areas. The language may need a cleanup of temporary objects upon exit of a scope for instance. For many languages memory gets allocated or data can get shifted in a real world application that a simple benchmark wouldn't trigger writing a complex bechmark with lots of data storage and manipulation is too difficult because you cannot ensure that the benchmark is exactly the same, indeed the language itself might demand that it be quite different in implementation to take advantage of language features.
It is probably enough to say that a decent compiler in any language would make the speed differances trivial enough to not worry about. (I did recently see a guy complaining about Delphi's floating point being about 1% of the speed of C++, but you get that if you use 6 byte software floats :) )
Dan MacDonald
12-06-2002, 10:50 AM
The .NET framework is included in XP, however I'm not sure how much it's changed since XP was released. I'd bet that users will probably need to have at least one patch or update to it.
I use Java and JSP at work on HPUnix boxes, and I use VB,ASP,C++ at home. I've played with some of the cool new stuff in .NET. Like making a C++ class deriving from it in C# and then again in VB. It's fun, the new WinForms functionality is quite nice as well.
I want to preface what I say next by saying, I think people should use whatever language is comfortable for them. If you make a game in BlitzBasic or Java I'll have just as much respect for you as if you did it in C and assembly. There are so many other challenges when creating a game, good game play, consistent polished art, quality music, and design. Getting those things to all come together and end up as an enjoyable finished product is, in my mind, just as challenging as building the technology for a game. Also, these things don't really get easier or harder if you use a high or low-level language, their complexity and difficulty is independent of what language they are implemented in.
That said, I just love C++; C# and some of the cool new languages out there are really nice and even easier to use then C++. Something about C/C++ just keeps me coming back for more, maybe it's the familiarity, it could even be ego, but i love that little language ;)
jaggu
12-06-2002, 11:15 AM
I am using C++ with STL for data structures and Allegro for the graphics. My game lends well to object orientation and C++ is the fastest for what I want to do. If you use C, you could still use a C++ compiler ie use C++ as a better C. I was thinking of using C for my project but after sitting thru reading the entire Thinking in C++ book (available online at http://www.bruceeckel.com/) I decided to go C++ (I do have on/off experience with using it in unrelated projects though). Wrapping Allegro in C++ is a pleasure too.
Like http://www.popcap.com/ you could use Java to make web-only games and offer a downloadable version too. Going Java for the full game may make development simpler for you but prolly a headache for the user to download and install the virtual machine or the Java plugin. I think C# suffers the same fate too. If you are only going to use it for prototyping - go for whatever that gets the job done quickly but you must throw out ur prototype not fall in love with it.
DavidRM
12-06-2002, 11:21 AM
The original Paintball Net client was written with Delphi, and the server with ANSI C.
Artifact (http://www.samugames.com/artifact) follows the same pattern: Delphi for the client software, and ANSI C for the server.
I also wrote The Journal (http://www.davidrm.com/thejournal) with Delphi, but it's not a game and so probably doesn't count for the discussion... ;)
For the new version of Paintball Net, since we're using the Torque Game Engine from Garage Games (www.garagegames.com), we're using C++.
Use whatever works for you. Or whatever is forced upon you. Interestingly enough, a clone of Paintball Net was written by some fans using VB6 for both client and server. So don't discount the possibilities of anything, I figure.
svero
12-06-2002, 04:42 PM
I use C++ and have used a little assembler here and there, although the assembler code seems less necessary these days. (except I suppose for 3d shaders which I dont currently have need of)
ferret
12-06-2002, 07:24 PM
Hi
I'm just looking at getting back into game programming as an additional home-based business to what I'm doing now.
Back when I was programming games professionally, 6502 assembly was THE language. Times have changed.
I'm working on creating a game that will be of interest to people who I already reach through my primary business.
I'm hoping to model my business from Dexterity's example where a straightforward playable game like Dweep can be marketed for years.
To that end, what I'm trying to produce will probably have the graphic complexity of somewhere between Pac Man and Mario Bros. (for fellow Atari 800 lovers a better description would be along the lines of Bruce Lee to Ali Baba).
I don't need incredible 3D rendering speed and don't want to learn the underlying details of DirectX, etc. -- I just want to make a simple attractive 2D game that will have elements that will appeal to the customers I already can reach.
I do need something that can produce a professional end product and that can hide a lot of the underlying complexity for me. I want to actually be able to finish what I started instead of getting stuck somewhere figuring out Windows calls.
Right now I have BlitzBasic 2D which is really cheap and I've been able to have hundreds of objects moving on screen on a PII 266 running Win 95. That's plenty overkill for my needs and Basic is very easy to work with - it's embedded in me from my TRS-80 days. There are no memory allocation issues, etc. and putting a sprite on the screen is as simple as using the command to put a sprite on the screen.
However, I did come across two other tools that I'm wondering if anyone else has any experience with. Both seem to be simplified beyond even programming - they are more like "construction sets".
1. Game Maker - which is free
http://www.cs.uu.nl/people/markov/gmaker/
2. Multimedia Fusion - $99 / $299
http://www.clickteam.com/English/welcome.php
Although I do intend to try both of them out, I'm wondering if anyone here has any experience with either of these - or suggestions of other products I should look at. They certainly make it look like I could even teach my wife how to make game levels with them.
Remember that my goal is not to create the next mind-blowing first person shooter, I'm just trying to create a professional looking product that will appeal to the people I'm trying to sell it to.
Thanks for your input
- Eric
Aside: I remember my boss explaining how the processor is running at a million clock cycles a second (yeah, 1 MHz) so there is plenty of time to do all the LDA... STA instructions you need.
svero
12-06-2002, 08:13 PM
Blitz is nice. So it blitz3d. I think they're good tools depending on your level of expertise and your end goal. I know the recently released "Rotadim" (by addictive247) uses fusion. There's also something called darkbasic which I havent used but might be a good tool.
Dan MacDonald
12-06-2002, 09:46 PM
Fusion does allow you to program in your own routines. I have no idea how easy or difficult it is. Only that I’ve seen people on message boards say it's extensible that way. I've always been impressed at the quality and speed at which people are able to produce games with fusion.
I really wished I would have checked it out before building my own technology for Katsu's Journey. While my own technology does indeed do everything I want it to and everything I need, I’m in the business of making games not technology. It's foolish to build your own when there are so many nice options out there freely or cheaply available. I've spent months getting the technology rolling for Katsu's Journey and only just recently been able to see the first gameplay elements in action. I'd rather have to design around a few things in someone else’s technology and spend all my resources on polishing gameplay, graphics, and music. Then spend most of my resources coding technology and have less to spend on the things that are really important to the success of my game.
kerchen
12-07-2002, 06:12 AM
Another option you may want to check out is Macromedia Flash ($99, I think), though that product is geared toward web-based games.
Siebharinn
12-07-2002, 09:01 AM
I use C# almost exclusively at work, but that's boring business stuff. My project is currently in C++, but I would use C# if the runtime download wasn't so big. DirectX 9 will have native bindings, which will be sweet, but that will be ANOTHER big download. I can't reasonably expect someone to download 30-40 meg of runtime for my little 2 meg game.
A couple additional thoughts:
1) As indies, we're probably not going to be doing anything that taxes the processor enough that "C++ vs C#" is ever an issue. Most indie games are small, puzzle type things.
2) If you DO need that burst of speed, C# has the "unsafe" keyword, that will let you stick raw C++ code right in the middle of your program. Or you could do the C++ stuff in a DLL and link it in.
3) So much of graphics today happen on the video card itself, making highly optimized graphics code less necessary.
If it wasn't for that gigantic download. :( I believe that Dan is mistaken in thinking that XP comes with dotnet, I just installed XP on my wife's computer, and there is no dotnet to found.
bernie
12-07-2002, 01:29 PM
Well, as the others I practice many languages. Mainly C, C++, Java, Vb, x86 asm and autolisp. I like to write code in object oriented C but not in C++. I think Java is better oop language than C++.
As IDE I use the ms devstudio 6. I think it is the best IDE since Borland had created the Turbo languages. Currently I evaluate the Kde development desktop that is quite an aspirant to through over vc6 reign. :)
That's right, I don't think .NET comes with XP. It shows up as an optional install on XP Service Pack 1. Although, IIRC it showed up preselected as a NECESSARY update on Windows Update a couple months ago. All my machines now have it installed, so I can't check that.
jasondarby
12-08-2002, 04:12 AM
I use Multimedia Fusion and i have to say its great :D
To be honest i havent got time to learn C++ or C# or any other new langauge that comes out. Thats why ive been using this software for a long time.
I dont really care about whats considered industry standard as other wise i would have spent 7 (at least) times as much on Director and have to do more work to put simple buttons and graphics on the playfield ;)
So with regards to MMF i would recommend it if you want to speed up development of simple prototypes or game ideas. It also allows C++ programmers to add onto the package in the form of Extensions.
Jason
Addictive 247
12-08-2002, 05:27 AM
Yeah we used MMF 1.2 to write RotaDim and all our other games. I find it great to use and extremely powerful - just what we need. I'm from a programming background and have spent many years on VB, C++ and assembler but I think MMF just makes game creation a lot more fun!
At the end of the day I don't think it should matter what you use as long as you write good games and other people enjoy them!
princec
12-09-2002, 09:23 AM
Being one of the authors of the Lightweight Java Game Library (http://java-game-lib.sourceforge.net/ - shameless plug...) I pretty much exclusively use Java. Although I suspect I may end up compiling it to native binaries for distribution because of the trouble with the size of the JVM.
Performance wise - it's not too far off C++ and the advantages of using it to develop more than make up for a little performance hit. When compiled natively it's basically the same speed; when it runs under Sun's 1.4 client VM it's a bit slower; when it's under the server VM it's roughly the same speed. The bottleneck, of course, is all graphics rendering, and that's purely in hardware now.
I use Eclipse IDE to develop in, because it's free.
Diary of my game's sudden development has begun in Java Gaming http://www.javagaming.org/cgi-bin/JGOForums/YaBB.cgi?board=volunteer;action=display;num=1039105813 which you might find amusing.
Cas :)
alchemist
12-09-2002, 02:04 PM
Cas, what version of Java are you using for your games?
And can you provide information on compiling Java apps (mine are all in 1.1 for browser compatibility :rolleyes: ) into Windows native exes that don't require an external JVM? I've looked at several solutions for this, but none of them "really" create a pure standalone don't-need-no-external-JVM executable. How do you do this?
Dan MacDonald
12-09-2002, 02:23 PM
Ahh the Shaven Puppy guys! I remember your post on gamedev.net about a year ago. That project you were working on looked very nice. I was quite impressed with the technology you had as well as the art assets.
princec
12-10-2002, 12:54 AM
Hi Dan & Alchemist,
I'm using 1.4.1_01 now, because I couldn't care two hoots about browser compatibility! Performance is what's needed.
I think Jet 3.0 will do what I want but it's a bigger hassle than you might imagine. I have had to ditch all the AWT and ImageIO etc. etc. etc. and write my own classes to deal with it all. This is basically a licensing restriction - you can only compile true standalone exe's with Jet if you don't use the AWT as Sun don't allow partial JRE distributions and it would depend on their AWT dlls. However, this is actually a bit of a bonus because my own classes are much, much, lighter and smaller and geared specifically just for doing games.
Unfortunately the game we started on at Shaven Puppy lives in limbo due to lack of funds... Chaz is a great artist though don't you think? (http://liquid2k.com/chazeem)
Cas :)
alchemist
12-10-2002, 04:21 AM
I wonder if you could strike a licensing deal with Jet to include your non-AWT classes with their distribution? I know I'd be a lot more likely to try something like this if it didn't mean rolling my own -- heck, that's one of the reasons why I liked java in the first place!
princec
12-10-2002, 05:32 AM
Oh, they're not a replacement for AWT (you want SWT for that - which is looking excellent!) - they're just a bunch of simple classes for storing image data and rectangles, points, blah blah. During development I specify all my data in an XML file and run a converter on it. This allows me to use the Java stuff to render fonts at development time and then distribute the bitmaps.
In fact they're all open sourced now as the Shaven Puppy Game Library and you can surf around the CVS(http://sourceforge.net/projects/spgl)
Cas :)
Lingo:
C and C++. Preferably C++ of course, but unfortunately some C libraries fight with C++.
Compiler:
GCC. MinGW32 2.0 (gcc 3.2) on Win32, GCC 2.95 on Linux.
IDE:
MED (http://med-editor.com/indexus.html) -- an _excellent_ lightweight editor.
Ratboy
12-11-2002, 01:46 PM
I'm a BlitzBasic junkie. 12 years of game experience, but all of it from the art side, plus, TRS-80 BASIC in high school infected my brain, making it nearly impossible for other languages to reside within.
BB is such a nice, fast development language...