The Source for Java Technology Collaboration
User: Password:



Athomas Goldberg

Athomas Goldberg's Blog

You Can Make Real Games In Java!!! Yeah... But So What?

Posted by athomas on April 10, 2004 at 01:17 PM | Comments (15)

Yeah, there are still those annoying questions about whether or not Java is fast enough. "Yes" we say pointing at 800 3D animated vikings running around on a lush, fully rendered tropical Island, "anything you can do in C++, you can now do in Java"

Problem is, as far as these guys are concerned, anything we can do in Java, they can do in C++. And they already know how to write games in C++, so proving equivelant capability is no real argument at all.

Cross-Platform? Well, cross-compilers for games have been around for a while, and when game companies are thinking cross-platform they're primarily thinking PC, PS2 & Xbox not PC, Mac & Linux, so Java's not really gonna help them there. Even if we do get Java on the PS2 and Xbox, cross-platform is still a moot point for those who are already doing it.

How 'bout memory management? You know, that wicked cool Java Garbage Collector? No offense to the truly brilliant minds who continue to catapult the JVM leagues ahead in power and capability with each release, but memory management in games, especially on constrained devices like consoles, largely consists of pre-allocating objects and disposing of them when you're done. Having a process you don't control eating CPU cycles in the middle of a tight game loop isn't really seen as a bonus

What about RMI? Object Serialization? Surely, with all these Massively Multiplayer Online Games (MMOGs) people are creating, it seems like the perfect place for Java. When you've got a few thousand people sending 10+ messages/sec over 56K modem lines, you've got to squeeze as much information into a single packet as possible. The last thing you wanna think about is writing out (and reading in) some graph of objects.

Security? nope. Threads? uh-uh. Applets? ...don't even get me started on Applets.

Okay, okay, before you send the hit squad, let me assure you that I don't think Java for Games is a lost cause. But maybe, just maybe, we're fighting the wrong fight.

See, Java is being used in commercial games - as a scripting language.

Chrome by Techland and Vampire: The Masquerade by Nihilistic are just two examples of a new trend toward using Java as the basis for writing the game logic and AI for a game. Why? One word. Productivity

Scripting languages are often used in games to provide a more intuitive, less error-prone way for non-programmers (ie game designers) to rapidly create, test and revise content for games. For these reasons, Java is starting to gain real acceptance in the games industry as the scripting language of choice

But that's not REAL Java!

Why not? Why must it be all-or-nothing? We provide all this support in JNI to enable developers to call native methods from Java and to instantiate the JVM from native code, yet we call it "Dirty Java" when someone actually uses it this way.

Maybe it's an ego thing. We know we're good enough to play the lead and don't like being cast in a supporting role. But, as they say in Hollywood, "There are no small parts, only small actors" Instead, maybe we should look on the adoption of Java, in any capacity, as a real step forward for Java in an industry that had long ago dismissed it.

Because clearly the stigma around using Java in games is weakening and the advantages of using it are starting to be recognized, something those of us being paid to promote Java can point to with pride.

So what about JOGL, JOAL and JInput? If demonstrating you can make real games isn't going to make game developers switch, why bother?

Because, as far as I'm concerned, getting game developers who are currently working in C++ to switch isn't really the point.

Removing the barriers to entry for Java game development means Java developers, like you and me, can begin writing real games that take advantage of the true power of the platform. It means that students learning Java in college (because the learning curve is easier and they spend less time debugging) will have little or no reason to switch to C++ when it comes time to start making games themselves.

Because as far as I'm concerned, developers who don't want to switch, don't matter

At the end of the day, the publishers don't care whether a game's been written in C++ or Java as long as it kicks ass, so the longer professional game developers stubbornly refuse to take advantage of everything the Java platform has to offer, the better it is for the rest of us.

So stop bitchin' about what other game developers aren't doing and go write some cool games! :-)

Edit: Yes, I realize that for a whole host of reasons, a significant percentage of commercially available mobile games are written in Java. While that's absolutely fantastic, this blog is directed at the "mainstream" universe of PC and console games

Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Dirty Java
    I think it's silly to say that JNI is "dirty java" too, and it's something I seem to hear a lot. Some people don't even consider using Java for programs that will only run on Windows. These people seem to think java is only good if you want your program to run on multiple platforms.

    I don't think any of that, I think Java is a cool platform for any kind of code. Right now I'm writing a windows-specific (and hardware-specific) program in Java with some JNI, and it's going well so far. I think people should stop thinking that Java = cross-platform, and start thinking about it as just another way to write whatever programs you want to write.

    Posted by: keithkml on April 10, 2004 at 08:24 PM

  • let the games begin
    u go game boieeeeeeeeeee!

    Posted by: gonzo on April 10, 2004 at 11:14 PM

  • Faster, better, cheaper
    Thats what :)

    I'll reply to you in MY first Blog, as soon as I figure otu how to post to it.

    JK

    Posted by: jeffpk on April 11, 2004 at 12:24 AM

  • Faster, better, cheaper
    Hey no argument there. that's what I meant when I said that the advantages of Java were beginning to be recognized in the industry. I think with existing developers, productivity may be the real selling point for Java (at the moment) something they're only going to accept if they see it themselves, which is why it's cool that Java is being used for scripting.

    That said, I don't see us winning any real converts to 100% Pure Java games in the near future, no matter how many demos we give. After all, anyone in the industry dying to use Java could have done what Cas did when he wrote Alien Flux. In the overall scheme of things, writing simple wrappers around OpenGL and OpenAL ain't that hard.

    My point is that it doesn't really matter because I think there are plenty of people, like Cas, coming in from the outside, who don't have years of legacy experience writing games in C++, who understand the benefits of Java who are willing to do what it takes to make it work. It's not that I think one of these guys will have a hit and suddenly the whole industry's gonna flock to Java, it's that I think more and more Java developers will begin having hit games and over time become an increasing percentage of the professional game development market. Eventually you'll reach the tipping point and Java for games will become commonplace.

    Posted by: athomas on April 11, 2004 at 12:51 AM

  • Another great technology for gaming: Jini
    Check out my 7th Jini Community Presentation: Jini Gaming http://www.gizmowerkz.com/jcm7/space/Gaming

    Posted by: asberry on April 12, 2004 at 11:04 AM

  • Another great technology for gaming: Jini
    And that's part of the problem right there.

    We (or most of the Java community) are far too much centered on "cool new tech" rather than using the best tool for the job at hand.
    We select the tech to use first and figure out how to get it to do what we want later rather than figure out what needs to be done and select the best tech to use based on those requirements...

    I'm not saying Jini isn't appropriate to make games (I wouldn't know, having used Jini nor having made games) but your post gave me a chance to make a point that needs to be made and made badly.

    Posted by: jwenting on April 13, 2004 at 12:17 AM

  • The reality of Java gaming...
    Ok, games developers are making things hard for themselves because they are stubbornly sticking to C++/C/Assembler? Could this really be the case in such a competetive business, or could there be another explanation...

    Why adopt Java and cut out 80% of the market because you can't run your game on that platform (PS2, XBox etc)???? And even if you could, you would have non memory left for models/textures/bounding volume trees after the JVM had loaded! So we're already limited to games that will only ever be PC based.

    And ... object-oriented code is not particularily useful when writing a physics engine (for instance), which is why many games companies still write the core code in C and assembler for speed, leaving simple high level stuff like scene-graphs for C++, and even higher level stuff for a scripting engine.

    As for speed - things are never fast enough when developing cutting-edge games, so back we go to C and assembler for those bits. (For instance it would be nice to be able to do realistic fluid effects using finite element analysis, but I don't think we will see this in real-time in the next 10-15 years.)

    Posted by: andylarder on April 13, 2004 at 05:16 AM

  • Another great technology for gaming: Jini
    What's "part of the problem"?

    I implemented a dynamic, highly fault-tolerant, recoverable, massively multiplayer online gaming platform in 9 months! I didn't use Jini because it was "cool new tech", I used it because it was the only thing that could get me there! Who else out there has done the same thing (especially given the timeframe)? [crickets]

    Follow the link I posted for a clearer description of what I did.

    The only point that you've made is that you don't know what you're talking about!

    Posted by: asberry on April 14, 2004 at 07:08 AM

  • Another great technology for gaming: Jini
    Where can I play this game?

    Posted by: athomas on April 16, 2004 at 04:43 PM

  • What matters about Java ... or not for game development
    Athomas -

    Since you are behind in comments relative to Jeff, I thought I'd wax poetic over here.

    Big Comment: If Sun wants Java to be real for the games vertical, it needs to build or have built a PS2 JVM. PERIOD. Sony states that they see 10 more years for the PS2 product and they are probably right. They are the dominant platform. Saying you are multi-platform for gaming without including PS2 is like trumpeting support for the Amiga (or my old, old, old Atari ST).

    If you can get X-Box or Nintendo, that would be nice.

    Multi-platform only matters if it is the right multiple platforms.

    Little comments:

    * Ease of Development - Hey, if more developers know C++, real development will be easier in C++(if you've got a hammer...).

    * Quality of Code - Double Hey, if people or business cared about quality code, we'd probably be using ADA.

    * Speed of Development - See Ease, above.

    * Multi-platform ? - I don't claim to be an expert on Java, but our experience bringing J2SE down to J2ME is not encouraging. Language constructs and libraries aren't there. The libraries make the language. I would be happy to take this as an extended off-line discussion. I think it is a huge problem now and will be worse if Sun wants to play in the games space more aggressively.

    * Business Bottom Line for Java and Gaming - You have correctly identified multi-platform and speed of development as critical issues for the future of the computer games industry. Java is only a potential solution at this time. There is no inherent reason not to have a powerful, multi-platform, shared set of libraries on top of C++ OR Java (OR whatever) to facilate game devlopment. This type of solution could also come from a game engine developer.

    * Technical Bottom Line - Sun and/or others will need to engage in a serious effort to engineer game tools and libraries to speed development without unnecessarily restricting creativity. I personally think this will include splitting game engines into "Game Play Engines" and "Game Presentation Engines".

    The time to market and development risks for games are getting exponentially worse. Java can step into that gap.. or someone else will. This will require a change from the design and development philosophies of the past for the industry. After all, Sony has little interest in a multi-platform world and neither does MS or Nintendo. Only developers do. They do care about improving time to market since that is how they get that licensing revenue stream.

    Steven Davis
    CEO
    IT GlobalSecure Inc.
    http://www.secureplay.com/

    Posted by: secureplay on April 19, 2004 at 11:30 AM

  • What matters about Java ... or not for game development
    Hey Steven --

    Many good comments.

    Absolutely agree about the multi-platform issues. I don't think I could possible agree more, without sprining something.

    J2SE vs. J2ME - I call it the "One Java" problem, Last JavaOne we made a big deal about this, but it's light-years away from not only being realized but even being realizable. My favorite example is the UI button. Okay, as a component, what could be simpler? But if I show you a picture of a button, you couldn't tell me which API was used to create it, or what device it was designed to run on. As a result you can't write even a simple component without making decisions about the network/device architecture on which it's going to run. The truth is we've done a great job in the VM with abstracting away the operating system, but have done a much poorer job of abstracting away the network and the device. This is the subject of a much longer blog entry, which you've inspired me to compose, so I'll leave it at that for now.

    As for the business & technical bottom line, I think you've hit the nail on the head. Does Java have better potential for multiplatform and speed of development than raw C++? Sure, but add Criterion's tools and middleware on top of C++ and the picture gets significantly murkier. Whether it comes from Sun or one or more 3rd parties isn't important, but without some foundation of game tools and technologies (significantly more than what we currently have) it will be difficult for Java to make serious inroads.

    I especially like the idea of "Game Play Engines" vs. "Game Presentation Engines" as I think this reflects (at a coarse level) the client-server models currently prevelant in networked games. I think on a finer grained level, extending this paradigm into the client, would increase the flexibility of how and where specific "game play" happens. With this as a model, whether a game is a single-player, LAN or MMOG because a question of deployment (and content of course) not one of engine design.

    My hope is that we'll see the more "common" capability released open source through the games community on java.net and that we'll start to see tools and middleware vendors with unique offerings (like yourselves) begin to build on top of this foundation.

    I'd like to note that these concerns are primarily leveled at the client-side, as I think Java has a greater near-term potential in the datacenters for network games.

    Posted by: athomas on April 19, 2004 at 01:40 PM

  • What matters about Java ... or not for game development
    Athomas -

    J2ME vs. J2SE - Actually, as I wasn't even up to the interface - Collections ... only three types???? Crazy. I can understand picking only a couple for the core libraries, but at least there should be standard implementations of all J2SE bits for J2ME developers to import. And security (or lack thereof) in J2ME. Yuck. I kind of get the sense that Java "forked" a couple of years ago and J2ME froze? (Sorry, I can only follow so many language histories at one time).

    I think Java won't make inroads in the data center for the same reason ... multi-platform. I think I would rather figure out how to build a PS2 blade (and reuse my C++ code or whatever) and not do a port at all. I might even do a PS2 emulator blade, just to avoid hardware risk. Hardware is cheap and getting cheaper. Java has to provide a client value proposition or it is a performance/training shoot off - as you said, no clear winners and if Java doesn't win, it loses.

    From my previous note, Java's customers are developers and third party publishers. They need a standard development solution - from Java or someone else. I would actually guess the biggest potential threat/competition for Sun would be Metrowerks given its aggressive and wide range of supported platforms.

    I think this gets to a basic question for Sun - does it want to "play" for real in games. If so, it has got to start with its foundation - JVMs and basic IDEs for the major game platforms. This could also get Sun engineers looking at extending device profiles up from J2ME environments and into bigger machines (which could be a powerful tool to help manage the variety of graphics, and to a lesser extent, sound, and memory capabilities of PCs - something of continuing interest to game developers).

    Then get the community to work on libraries (they probably will at that point without a lot of prodding).

    At risk of starting a flame war, open source is probably not going to go over big with the game developer biz - everyone wants to be able to protect their proprietary code. An open framework would be more promising.

    I applaud, as do most folks I suspect, Sun's initial foray into gaming. It is a great market with real revenue potential in hardware, software, and services - And a great place to show leadership. But...Sun needs to decide to lead, not inspire, coach, cajole, or cheerlead. That means real dollars and substantial resources.

    I suspect that it will be obvious within 6 months how seriously Sun takes this market - there will either be a strong move into console gaming, and an aggressive thrust at handhelds, ... or not. A web community does not a business sector make.

    Gaming has always been the source of leading technologies for computers. Sun can use gaming to establish a leadership role for everything from cell phones to consoles, set top devices, and data center servers.

    Steve

    Posted by: secureplay on April 19, 2004 at 07:30 PM

  • Regarding Java and the Playstation 2
    To Anyone who can answer.

    I am seriously considering moving into games programming for my newly acquired Playstation 2.
    While there is Linux available for the PS2 (https://playstation2-linux.com/) with Linux, Hard drive,
    Keyboard, Mouse etc,. for a reasonable price there is no Java VM been written for the PS2 Hardware.

    These web URL's showed some sort of promise.

    http://java.sun.com/features/2001/06/sony.html

    http://www.sun.com/products-n-solutions/media-entertainment/press/pressrel_jun04_sony.html

    Does anyone know what the situation is above, any email addresses I can email to i.e. Sun or Sony
    to get an answer. In one of the articles above they had Java Running, is this CD Software Devlopment Kit available.

    An answer to this will enable me to start the necessary preparation for Games Development and
    what language to concentrate on. I would prefer not to have to start C++ Programming.

    Regards

    David Thomson
    Java Developer

    Posted by: dthomsonjavanet on May 04, 2004 at 08:06 AM

  • Kaffe's already there
    Kaffe has been ported to PS2-Linux by Dulan Schell back in 2002.

    cheers,
    dalibor topic

    Posted by: robilad on July 17, 2004 at 05:28 AM

  • I think that making a game is more than a fast code. I am making a game engine in ActionScript 2.0 that is slower than Java. But at the final state even Flash can be faster then Java. The most important is the game design and how you get advantage of your development plataform. I think that java makes developers confused, because it offers repetive objects like swing e awt. openGL bidings like lwogl, jogl, java3d. The marjority of java programs that a see at internet looks amateur.
    For this, many people think java is slow and isn't ideal to make real games.

    Posted by: aogor on November 11, 2004 at 03:35 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds