I thought I'd look into game programming as a hobby. I've been in business application
development for over 20 years - so am very familiar with many languages - C, C++, Java, etc.
I'm currently going through "Killer Game Programming" which focuses on Java as
a programming tool.
Questions:
1. Should I be focusing on C++ development and what are the best books for that language?
Are there any free IDEs that you would recommend vs spending the big bucks on Visual Studio?
2. I'm also interested in application development for iPhones, iPods, etc. How is that
different from traditional PC programming, and which books/languages would you recommend?
Quote from: silvers1 on January 23, 2013, 12:35:39 PM
I thought I'd look into game programming as a hobby. I've been in business application
development for over 20 years - so am very familiar with many languages - C, C++, Java, etc.
I'm currently going through "Killer Game Programming" which focuses on Java as
a programming tool.
Questions:
1. Should I be focusing on C++ development and what are the best books for that language?
It's not necessary to focus on C++, though it is a solid language choice as you will find a lot of examples on the web and most game libraries are developed primarily for C++. However, if you are just starting, trying a higher level language such as Python could also be a good idea. C++ will steal some of your time and focus that you will need to devote to its intricacies, while a more expressive language will let you just write your game and don't worry that much about memory management and in general will get out of your way, letting you concentrate on what is really important - developing the game.
Quote from: silvers1 on January 23, 2013, 12:35:39 PM
Are there any free IDEs that you would recommend vs spending the big bucks on Visual Studio?
Actually you can use Visual Studio for free: http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-for-windows-desktop. It lack all the bells and whistles of the full package, but it still is a very solid IDE. There are others, of course, if you dislike VS or want to use a different C++ toolbox.
If you are going to stick to Java, Eclipse (http://www.eclipse.org/) and NetBeans (http://netbeans.org/) are popular picks, but you are probably already aware of that.
Quote from: silvers1 on January 23, 2013, 12:35:39 PM
2. I'm also interested in application development for iPhones, iPods, etc. How is that
different from traditional PC programming, and which books/languages would you recommend?
If you're looking at doing native iOS development, you're pretty much going to have to learn Objective-C. There are some wrappers that make doing simple apps easier, but for anything serious you're going to want to use the native APIs directly.
Quote from: silvers1 on January 23, 2013, 12:35:39 PMShould I be focusing on C++ development and what are the best books for that language?
Are there any free IDEs that you would recommend vs spending the big bucks on Visual Studio?
Codewalker and I both use C, and you've seen what we could do with it, so there's that. (-:
I can't speak for him on all counts, but I do know that we both prefer C because it's "simple" in the context that what you code turns into the equivalent machine code after compiling, and nothing else. There's no overhead, no automatic management of anything. Just exactly what you type, translated into machine code. This enables C to be faster than more abstract languages, and produce smaller code.
The downsides to C are obvious: I've heard it referred to as the stick shift of programming. Object-oriented programming in C requires careful manual manipulation of memory: you need to allocate and deallocate memory buffers yourself, and don't lose track of them. Strings of text are not part of the language either, but there are string operations that are available to use on arrays of bytes. And you'll often encounter cases in C where you need to keep track of multiple levels of indirection, such as "char ***listaddr". But just like cars, while accelerating uphill in a stick shift can be painful, when you do it well it easily out-performs any automatic.
Plus, OpenGL was designed to be used from C. DirectX was designed to work with C++, but I've done one of the stick shiftiest things ever and used it from C... don't try that. Java was designed to work with neither, so you won't be getting any hardware-accelerated graphics from that.
Quote from: silvers1 on January 23, 2013, 12:35:39 PMI'm also interested in application development for iPhones, iPods, etc. How is that
different from traditional PC programming, and which books/languages would you recommend?
Mobile programming is very similar to workstation programming. You just need to use a different UI library is all. Android applications are written in Java, though they don't use the AWT/Swing library. I'm not sure what iOS uses.
Quote from: Codewalker on January 23, 2013, 02:35:51 PM
If you're looking at doing native iOS development, you're pretty much going to have to learn Objective-C.
I don't have experience with iOS programming, but I do believe that both C++ and Objective-C are treated as first-class citizens on that platform.
Quote from: Little Green Frog on January 23, 2013, 03:05:48 PM
I don't have experience with iOS programming, but I do believe that both C++ and Objective-C are treated as first-class citizens on that platform.
Sort of. There's what they call Objective-C++ which allows you to use both languages in the same source file, so you can use C++ in your main code. However all interfaces with the OS are done with Objective-C calls / messages so you end up either mostly using it anyway, or writing a lot of wrapper classes.
Quote from: Codewalker on January 23, 2013, 03:17:29 PM
Sort of. There's what they call Objective-C++ which allows you to use both languages in the same source file, so you can use C++ in your main code. However all interfaces with the OS are done with Objective-C calls / messages so you end up either mostly using it anyway, or writing a lot of wrapper classes.
That explains why Objective-C seems to be the language of choice for most projects I know of. Always wondered about that.
Thanks guys. Guess I'll start out with Java, then perhaps switch to C++ if I get into serious development.
Can't say I care that much for pure C code though, since memory management can be a nightmare.
Quote from: silvers1 on January 23, 2013, 10:45:58 PM
Thanks guys. Guess I'll start out with Java, then perhaps switch to C++ if I get into serious development.
Can't say I care that much for pure C code though, since memory management can be a nightmare.
Bah! Real programmers know how to handle memory management. :P
Honestly, is there any actual complex Java programs out there? Java is to OOP as Pascal was to data structures in the 70s, an OK teaching language but hardly a language to do any serious development with.
I can't say I'm a programming wizard, or anything, but I learned on BASIC and Pascal. I'm taking programming classes, ATM, and the first real class (beyond "Intro," which is programming concepts using faux code) is Java. I think I would do better at it if I'd known nothing about programming going in. I cannot reliably create my own classes and methods.
Quote from: FatherXmas on January 24, 2013, 12:58:23 AM
Bah! Real programmers know how to handle memory management. :P
Honestly, is there any actual complex Java programs out there?
That would be affirmative. The company I currently work at does most of their development in Java, with some legacy code in C.
The size of the application is probably in the millions of lines of code.
The forum at GameDev.net (http://www.gamedev.net/index) has a few threads devoted to this. I'm not saying there's anything like a consensus, but there seems to be a lot of love for Objective-C and Objective-C++, more for their power than cross-platform flexibility. I'm playing around with an IDE for Android, and there are some huge differences between it and what I would do in class on a PC. Also, Java is finickier when it comes to handling 3D graphics.
There are quite a few knowledgeable individuals over there who explain it a lot better than I could. Anyone can read, but you have to join to post (obviously). Membership is a little steep for the casual hobbyist.
Makes sense if you are targeting for IOS/OS X and Android/Windows.
One thing that is important to keep in mind while approaching game development is that the languages play secondary role to algorithms and data structures. Sure, it's not like all languages are suitable for particular game ideas, but it is quite difficult to end up being unable to finish just because you chose one language over another. You could, if you had resources, develop all currently best selling games in the languages that were mentioned in this thread.
But I consider the non-deterministic nature of Java's garbage collection a hazard to code that's suppose to provide consistent near real time response. Now a Civ 3 like turn base game, not so much a problem.
Quote from: FatherXmas on January 24, 2013, 12:58:23 AMHonestly, is there any actual complex Java programs out there?
Minecraft?
I tend to prefer Java over C. Performance is an issue, yes, and it does have some weird quirks, but I prefer its much more solid OOP structure that takes care of all the nitty-gritty details automatically without forcing me to keep track of too many things. I don't know what constitutes "complex" but I've made some sizable software as part of my job and - being the horribly messy programmer that I am - never bothered to put a line of comment or documentation down. Anywhere. I can still follow most of my programmes just fine even a long time later because the class reference structure is pretty straightforward outside of multi-threading scenarios.
Can't say how well it does for graphics, though. Never used anything graphical about it aside from the Swing package.
Quote from: FatherXmas on January 25, 2013, 12:22:25 AMBut I consider the non-deterministic nature of Java's garbage collection a hazard to code that's suppose to provide consistent near real time response. Now a Civ 3 like turn base game, not so much a problem.
Yeah, that's a pain in the ass, but you CAN actually request garbage collection manually. You're not always guaranteed to get it and you're not always guaranteed to clear everything you think it should clear, but I've found it to work pretty reliably when needed. That's something I've had to deal with very recently, managing a 2GB data file in 1GB of memory with the considerable memory bloat of putting it into structured lists for easy access. Ended up having to read it in pieces and garbage-collect every piece when I was done with it. Haven't run out of memory since I figured that out.
The honest answer is that what language you use largely depends on your goal. There are
general guidelines. There are exceptions, but you'll almost always be safe with these:
- If you are writing games, your best bet is C or C++. Personally, I'd recommend studying the OpenGL graphics library, as it is supported in Widnows, Linux, MacOS, Android, iOS, and a lot of other environments. The downside is that unless you purchase a third-party library to do it for you, you'll have to develop most of your UI widgets from scratch, and that is not an easy thing to do.
- If you are writing Windows desktop applications, your best bet is C#.
- If you are writing MacOS software or iOS apps that use use the built-in UI widget toolset (stuff like text entry boxes, buttons, etc.), your best bet is Objective C.
- If you are writing high-performance web applications, you'll probably want to go with Java.
- If you are writing mediocre-performance desktop applications that you want to be cross-platform, and you're not going to be using a lot of native functionality of the host OS (for example, the Windows registry, jump lists, shell integration, etc.), then Java is also a good choice.
- If you are writing native Android applications using its built-in UI widget toolset, you'll want to use Java.
- For web sites that aren't so performance-oriented, go with a scripting language like Python or PHP.
- For full-blown interactive web applications (such as Gmail) as opposed to more simple page-oriented sites, you'll need to be a Javascript guru. Even for more simple web sites these days, you'll have to be at least passingly familiar with it.
- If you are writing a compiler, may god have mercy on your soul. That was by far the hardest class I took while getting my CS degree. To this day, I'm extremely proud that I earned an A in it.
Since I'm very likely older than you, I'm guessing at least a decade or two, do they still use the dragon book as one of the textbooks for compiler design when you took it?
Quote from: FatherXmas on January 25, 2013, 07:47:32 AM
Since I'm very likely older than you, I'm guessing at least a decade or two, do they still use the dragon book as one of the textbooks for compiler design when you took it?
It wasn't aimed at me, but I can relatively answer that. At least they still did it 3 years from now at my school when I learnt of compilation.
Quote from: FatherXmas on January 25, 2013, 12:22:25 AM
But I consider the non-deterministic nature of Java's garbage collection a hazard to code that's suppose to provide consistent near real time response. Now a Civ 3 like turn base game, not so much a problem.
Yeah. Some languages are better for the job than others and Java wouldn't be the best candidate to build the next Crisis game. But the point still stands: if you want to learn about game development, language choice isn't really that important. You need to learn about algorithms and you need to learn how to use APIs like OpenGL/DirectX or SDL. Once you have that knowledge, you can apply it with small modifications to nearly any language.