Why Java, not C++?

Hello, I would like to answer the original question “Why Java for games?”.
I am not a code guru but I have a fairly good amount of experience at coding games( more precisely FPS modifications).I have reached a good level of expertise before realizing I was wasting my time develloping huge projects for a commercial game engine for which I would never own a license (and no, I don’t have the “dream” of working as an employee for corporate videogame industry ) :-X

Well back to the point: I think Java would be awesome for games because of it’s high level approach, and its perfect implementation of OOP. When games start reaching a certain threshold of complexity you just can’t keep coder ressources invested on two huge fronts (low-level stuff and high-level).
When using high level object language, big chunks of code can migrate from the main loops to the objects, you can manage your project easier and can deleguate tasks to second-rank coders and artist guys.Complexity is an important factor in the success or the failure of a project.
A language like java is very well suited for complex games such as RPGs, MMORPGS,Strategy games,network games, etc,etc…

Today the japanese are the ones winning the battle of innovation in videogames.They can pull very original games such as Ico,viewtiful joe, to name a few, while western devellopers can’t go beyond the paramilitary “infiltration” desert gun-show “games” they are serving us non-stop now. studios like Capcom,and other develloping games on consoles, don’t need to waste ressource on low level stuff because the consoles limits are set and known from the start. Console devellopers are “free” to conceive original games (actually they are forced to search new ideas to stand out from the mass), while most PC devellopers just change the game engine and serve us the same game than 10 years ago(doom with bump mapping, half-life with bump mapping,etc…).
Java devellopers can be in the same situation than the console devellopers since they don’t have to worry about low level specificities (CROSS PLATFORM remember?).
And the high level oop coding and libraires available make it easier to devellop middleware. All we need is a couple of succesfull projects that would start a critical mass.

Oh and before I finish, the very popular unreal engine uses a powerful scripting language that is based on(and very similar to) java. UnrealScript is an interpreted OOP language that manage all the in-game objects and maps. The only things done in native code are generally the renderer routines, and so most of the unreal engine games (this is alot of commercial games) are coded (almost!) in java
So Java is already in games, and you don’t know :slight_smile:

(I apologize if that post doesn’t make a lot of sense, it’s because of my bad english)

Sadly, this isn’t true. Java up until version 5 is far from perfect, failing to implement some fundamental aspects of OOP. With 5, it might finally be a complete implementation, but I’m not sure since 5 has so many other problems I haven’t tried using it yet :).

Advanced C++ programmers would probably notice this quite quickly.

Commercial games projects do this all the time, no matter how complex. I’m afraid don’t see the problem you’re getting at here. Could you explain a bit further?

Most people in the games industry would disagree with this, quite strongly. Most people in the UK would, I believe, probably put UK first for innovation :). Just look at Molyneux’s games (and those of his ex-employees) - that’s just one studio (plus offshoots). Have a look at some of the games mags, or Developer (UK-specific game-industry), and see what’s going on.

You’ve been paying too much attention to a small number of very large publishers, naming no names :). I agree that every time you go in the games stores round here (London) there’s a rack full of those things, a new set of titles each time, but … it seems to be dependent upon your local shop and what people in your country / city like to buy. In the US, for instance, the big seller is sports games. In the UK, it’s military and FPS’s (going by store stocks). And the rst of the store still has a huge variety of games for sale…

Don’t forget the hotbed of invention in the indie scene too eh?

Actually here’s a big shitter for us: using Java, we can’t get our games on XBox. One of my “competitors”, Raptisoft, has recently just quickly ported their game Hamsterball to run on XBox. I can’t do that. Same has happened to PomPom’s Mutant Storm, and Retro64’s Best Friends. I am at a severe commercial disadvantage in that respect. This is only very slightly offset by the fact I can run stuff on the Mac without effort.

Bottom line: no Java on consoles, no deal for any serious studio, period.

Cas :slight_smile:

[quote]Don’t forget the hotbed of invention in the indie scene too eh?

Actually here’s a big shitter for us: using Java, we can’t get our games on XBox. One of my “competitors”, Raptisoft, has recently just quickly ported their game Hamsterball to run on XBox. I can’t do that. Same has happened to PomPom’s Mutant Storm, and Retro64’s Best Friends. I am at a severe commercial disadvantage in that respect. This is only very slightly offset by the fact I can run stuff on the Mac without effort.

Bottom line: no Java on consoles, no deal for any serious studio, period.

Cas :slight_smile:
[/quote]
This is a very good point. There are only two options really, write a native code compiler for the platform, or write a JVM for it… both would require alot of time/money.

[quote]Bottom line: no Java on consoles, no deal for any serious studio, period.

Cas :slight_smile:
[/quote]
Here, here. How many times and ways must we say this? :wink:

ASA a usable public JVM implementation is available on consoles you will see playable hobbists games there, and shortly after you MAY see production level games.
But only in that order, not the other way around.

Has anyone considered simply porting a JVM to the consoles? As much as I generally don’t like the Kaffe, Kaffe + LWJGL should be relatively easy to port to these systems. You can even have fun stripping out all the libraries you don’t want, and linking in only that native code that you DO want.

Starting such a project would probably be more productive than complaining that Sun should do it. :-/

Besides, what is going to change Sun’s mind if they don’t first smell money in that direction? :wink:

Edit: Kaffe even lists the Playstation 2 on their Ports page!

[quote]As much as I generally don’t like the Kaffe, Kaffe + LWJGL should be relatively easy to port to these systems. You can even have fun stripping out all the libraries you don’t want, and linking in only that native code that you DO want.
[/quote]
You certainly can’t do that and call the result Java. You would have to go with some MIDP profile or other manner to limit the API set and define what must be implemented and what is optional. That’s a good thing really, since there must be some guarantee of what APIs are available to code to.

Of course getting someone’s attention with awesome Java games on PCs & Macs might make the port to consoles look a bit more attractive.

[quote]You certainly can’t do that and call the result Java.
[/quote]

'Tis true. However you can code in Java and then “produce an executable for consoles” from that Java. ;D It works out to more or less the same thing.

[quote]You would have to go with some MIDP profile or other manner to limit the API set and define what must be implemented and what is optional. That’s a good thing really, since there must be some guarantee of what APIs are available to code to.
[/quote]
Indeed. I actually have a nearly complete CLDC 1.1 implementation that I plan to donate to the JOP project. It’s my intent to use it as the basis for the JGC project, plus some custom sound and graphics libs.

[quote]Of course getting someone’s attention with awesome Java games on PCs & Macs might make the port to consoles look a bit more attractive.
[/quote]
Too true. :slight_smile:

[quote] Bottom line: no Java on consoles, no deal for any serious studio, period.

Cas
[/quote]
What about gcj? Ok, it’s compiled and missing a lot of the extended APIs but is probably complete enough for a game - particularly through lwjgl and is supported on all consoles.

[quote]What about gcj? Ok, it’s compiled and missing a lot of the extended APIs but is probably complete enough for a game - particularly through lwjgl and is supported on all consoles.
[/quote]
Very good point. From Jacob Marner’s report Evaluating Java for Game Development:

[quote]It is true that there are no Java virtual machines available for the Nintendo 64, Sony Playstation or the Sega Dream cast, but because GCJ (the Java GNU compiler) can run on any platform that has a port of gcc and because gcc ports exist for the consoles you can in effect write efficient GCJ programs for consoles.
[/quote]

Last time I checked, using GCJ was constraining yourself to java 1.1.x, since even the java 1.2.x work wasn’t complete. I’m assuming by now they’ve finished that, but IIRC they haven’t got 1.4 ready yet?

So…works in theory, but in practice it’s not doable? If all you want is to write java 1.1 code, well…a 1.1 JVM isn’t too hard to write. But what we actually want/need is the level of arch-specific and clevel runtime optimization in a Sun or IBM JVM, and that’s a whole different kettle of fish.

On a side note, I wouldn’t listen to a single word J Marner had to say, based on the atrocious quality of his previous work, until/unless he owned up to and corrected his previous mistakes. If I were him, I’d take that report off the net, because it just lets everyone who’s curious see just how naive a “researcher” he can be; not a good advert. (of course I’m bearing in mind the state of play when he wrote it - I first read it when it was first released).

[quote]Last time I checked, using GCJ was constraining yourself to java 1.1.x, since even the java 1.2.x work wasn’t complete. I’m assuming by now they’ve finished that, but IIRC they haven’t got 1.4 ready yet?
[/quote]
As I understand it, GCJ relies heavily on the ClassPath project. This makes it sort of a weird combination of 1.1 and 1.4 libraries. i.e. You can have ByteBuffers, but no BufferedImage. Thus a developer would need to cover the missing pieces with some sort of application specific API. In this case, LWJGL actually makes a lot of sense.

[quote]So…works in theory, but in practice it’s not doable? If all you want is to write java 1.1 code, well…a 1.1 JVM isn’t too hard to write. But what we actually want/need is the level of arch-specific and clevel runtime optimization in a Sun or IBM JVM, and that’s a whole different kettle of fish.
[/quote]
I think it’s quite doable. The only issue is that you have to define the constraints up front. i.e. These libraries will work, these won’t, and this is how these will fit.

[quote]On a side note, I wouldn’t listen to a single word J Marner had to say, based on the atrocious quality of his previous work, until/unless he owned up to and corrected his previous mistakes.
[/quote]
It was just the first reference I came up with. Don’t shoot the messenger. :slight_smile:

blah^3 wrote:

[quote] So…works in theory, but in practice it’s not doable? If all you want is to write java 1.1 code, well…a 1.1 JVM isn’t too hard to write. But what we actually want/need is the level of arch-specific and clevel runtime optimization in a Sun or IBM JVM, and that’s a whole different kettle of fish.
[/quote]
Except you get gcc performance with (AIUI) 1.2 language - your biggest issue is which APIs you do/don’t need. And gcc is the main workhorse for PS2. Or have I missed something about language level you’re after?

I’ve been down the native compiler route already with a product that’s at least 100x better than GCC, and it’s not why I use Java. I use Java because it’s easy and deployment is easy, and putting a native compiler in the way just makes it all hard again. Screws up any chances of remote classloading too.

Cas :slight_smile:

[quote]I’ve been down the native compiler route already with a product that’s at least 100x better than GCC, and it’s not why I use Java.
[/quote]
Fair enough. But porting Kaffe still makes a lot of sense, don’t you think? :slight_smile:

[quote] I use Java because it’s easy and deployment is easy, and putting a native compiler in the way just makes it all hard again. Screws up any chances of remote classloading too.
[/quote]
I don’t think deployment is going to be nice on consoles, no matter what you use. As for remote classloading, that’s probably only an issue in network enabled environments. Granted, consoles are going that way so it will be an issue in the future.

I grabed a little source code with FFT in Java and did a little test on it. Client JVM would finish in aprox 4.5 second with 1/10 second inicialization. It was on 1.8 GHz computer. And yes the length of the array, that array was 2^20 long. JVM was 1.5.0 downloaded in aroud 11 2004.
Dunno if this is fast enough.

Regarding where all the great java games are hiding, at least I had never heard of this game until recently:
www.hockeychallenge.se

Don’t let the word “manager” fool you - it has some really neat 3D graphics. I think it’s almost finished…

It should be easy to navigate even though the text is in Swedish - there’s like one button :slight_smile: (big)

PS: I think jadestone got rated as the fastest growing Swedish game developer or something like that.

It’s quite cool game, but it isn’t work under Linux (at least uder my Gentoo with Java 1.5) :frowning: For peapole who have this OS and want to see this game I’ve made some screenshots:
Screen #1
Screen #2
Screen #3
Screen #4
Screen #5
Screen #6
Screen #7

That looks pretty good indeed. The player models are a bit weak, but other then that it’s not to bad looking.