Java or Flash for game programming: which one?
This question comes up a lot.
No, a lot!
The problem is, it’s not important.
Not important?! you exclaim. Then why do people ask it all the time?
Ok, actually this is a variation on another question: “What programming language should I use to make my game?” Once you’ve made some games, you come to know that it doesn’t matter. Any language will do. What does matter is the end product! Is it fun? Does it run on enough machines to meet your goals? Does it do what you wanted it to do? That’s all that matters.
Technology is a tool, so use whatever language you’d like.
As true as that is, it’s not always true.
The one way that choosing a language does matter is in the context of what you want to accomplish. Is your game downloadable? Or is it meant to be played in a browser? Those are big considerations, and they will have a material effect on what language (and tool set) you choose.
Narrowing things to Flash versus Java (where I have the most experience if you don’t count 10 years of C++), though, the answer is still, “It depends.”
Java and Flash both do downloadable and browser deployment, so let’s assume those factors are equal and are, thus, non-factors.
Do you want to reach the broadest audience or are you more interested in fast rendering and processing?
We all want fast rendering, but I mean does your project need lots of rendering muscle to succeed? Not just, “Oh it looks so cool.” but “Oh, this is not playable!” It’s got to really matter to the end product (because, ultimately, the end product is all that matters).
Java can render using hardware and is way faster than ActionScript, so it will have more power than Flash. A great browser library for Java is PulpCore. The feel of Flash with the speed of Java (although, it doesn’t do hardware rendering that I know of–but it is very close to a Flash experience without Flash, if that suits your persuasion).
Flash will ensure that your users have a more hassle-free experience since it’s installed on 99% of computers, whereas Java has quite a few old versions that are common. Relying on hardware rendering can give rise to technical incompatibilities, though Java doesn’t have to use hardware, so that can be mitigated.
Java is getting better about updates and penetration, but Flash still wins when you want to be compatible with the most computers (especially older or quirky hardware). That’s not to mention Flash is more web-enabled (ie, has strong support for integration with many sites and game portal APIs like Kongregate and Facebook), so for online games it makes lots of sense.
So, again, your answer has to derive from the question of how it affects the end product and what your goals are for it.
I’m doing online games, so I don’t want players to have to download and install anything. That’s a huge concern to me, so Flash wins almost right away because it’s the most hassle free. My second concern is penetration, and again–for my goals–Flash wins. I design for lower quality visuals but it’s made up for by the fact that I can reach more potential players. For commercial reasons, reaching more players is more important than having the best rendering sizzle.
For my backend (a.k.a. game servers), I use Java. Java is plenty fast, works on the platform I care about (Linux for servers), and was easy to learn with my backlog of C++ experience.
To summarize: the language you use is only relevant in context of the goals of your end product.
If you’re a hobbyist and don’t have any real goals, pick anything you like. If you have commercial goals, pick something that directly supports those goals.
It’s very project-specific, and it might even change from one project to the next.
Whatever the case, just make sure you’re having fun and don’t get all serious and uptight about languages and tools. It’s about the games!