Who feels sometimes like he (she) is using the wrong language?

I don’t know about you, but sometimes I just feel like this lazy developer pampered by all the awesome tools and just sheer convenience of the java platform, while perhaps I should be biting the bullet and moving towards C++ for games.

Why? Apart from all the obvious good sides of java, there are of course a few serious downsides:

  • It’s not as portable: you’re always depending on the quality and scope of the java implementation on the target platform, if that java implementation actually exists at all.
  • There are performance issues: Even if performance on desktops more or less on par with C++ nowadays, on more limited devices like phones or tablets it’s pretty awful.
  • I’m still not very comfortable with Oracle being in charge of java now. I’m giving them the benefit of the doubt, but their heart doesn’t seem very compatible with the spirit of java.

Those concerns are mostly about non-desktop platforms, but the thing is, those platforms are getting more and more important!

Thoughts?

I’m actually starting to get the impression that Oracle will be a pretty good steward for Java, they’ve got a solid direction for Java now, throwing plenty of resources at it and have got the industries biggest software companies backing OpenJDK. Maybe a strong headed company like Oracle is what Java’s needed and been missing. Although it would have been great for Java to be more free and open but that sort of software development model just hasn’t proven to work well (like the JCP), even projects like Linux have a pretty dictatorial leadership. Guess we’ll have a better picture in a year of two of how well Oracle will be able to push Java forward.

They’ve already started to look at ways and methods to getting Java on more platforms (like compiling it to javascript) and have hinted that they’re aiming to get it onto the iphone but guess those plans are still in the early stages. There has also been some movement with Java SE Embedded (which kicks Androids butt in benchmarks) but who knows what the plans are for that.

But as for your main question, yeh i do feel at times that using something like Flash maybe a good idea due to how nice its clientside experience and crossplatforms support is and with upcoming stuff like molebox. Even Unity3D is looking super good these days, espeically with todays announcement that Kongregate will also be supporting Unity3D now.

As far as your negative sides go:

  1. I often find that Java performance is better than the C++ equivalent. I recently did a refactoring of the Bullet physics engine and get better runtime by pretty significant margins (e.g. 50-60 ms down to 40-50 ms per physics update).
  2. It bugs me to no end how people talk about the “spirit” of Java. Java is a tool to use to make games or other things. I use it because it, and all of its helper tools, are the best programming experience I’ve found. The spirit of Java is what everybody is doing with it and where it’s going. 90% of what I do doesn’t depend on anyone else, and I’ve seen hardly any significant changes to the Java platform in the last couple of years.
  3. The spirit of pretty much any other language seems to be “suffer and deal with it” (for various definitions of “it”).

But I know the feeling. For a long time I felt like I wasn’t a true game programmer if I didn’t do it C++ and was just missing out on my full capabilities as a developer if I couldn’t do it C++. Then I tried it in C++ and realized that its a lot easier to reach your full capabilities when you have tools that do 80% of the really easy stuff and let you think about the hard decisions. Which is why I will use Java for the foreseeable future, no matter what Oracle does with it, because I’ve had enough politics just living with US’s democrat and republican parties.

I don’t think of c++ as being portable. It’s quite a bit of work to make it cross platform. Sure, you can just drop the source, but most people don’t like that, which means compiling for each platform. Small indies usually just release a windows version. I don’t think c++ is enough of an advantage in speed to make up for the inconvenience. I can see possibly using c# and AS3 for a few projects, but not c++. People I know that get involved in c++ usually get hung up on engine type things and never write games. Not all, but a good share.

[quote]I don’t think of c++ as being portable. It’s quite a bit of work to make it cross platform.
[/quote]
What I meant is that there are C++ compilers for every platform, unlike java.

[quote]I often find that Java performance is better than the C++ equivalent.
[/quote]
Surely not on anything other than desktops, though.

[quote]I’m actually starting to get the impression that Oracle will be a pretty good steward for Java…
[/quote]
Hm yes, good points.

Not sure what you mean by portable, but i am guessing you haven’t done much portable C++. Or at least not any C++ with more than one target (more #ifdef than C++ code!). Even getting the build tool chain to work on different platforms is a PITA. Just recently one of us wanted to have a C++ problem spawn a process and communicate with it via the processes standard IO. It was not really easy and very platform specific.

Sure java is not on every platform, but its still by far the most portable thing out there.

Every time i have to do some C++, I remember why i avoid it when i can. Segfaults and memory leaks are a poor substitute for null pointer exceptions and the cost of bounds checking. Boost and STL come some why with making it easier to code these days, but its a shadow of the java api.

Au contraire, I’ve got here an ARM Java 6 VM that’s as fast as the desktop one more or less. Blistering. The only real performance bottleneck in Java nowadays is bounds checks that aren’t removed by the compiler - a bit of a shame. The rest is just swings and roundabouts with typical C++ compilers. Specialist tools are always going to be faster but general purpose game programming, Java really does rule when it comes to effort : results ratio. I just wish the platform were openly available everywhere. Fingers crossed Oracle groks this unlike Sun. I hope Larry and Steve are friends enough to sort out the biggest one; no idea if Playstation or Xbox will ever happen though.

I wish Excelsior would do an ARM compiler :slight_smile: And a Mac one… and a Linux one. God how I wish. I’d give them $20k right now for an ARM compiler.

Cas :slight_smile:

C++? Portable? Is it a joke? I know Christmas is coming but Santa Claus won’t offer you a portable C++! It is NOT portable, even POSIX non real-time signals are not fully portable in C and C++.

Flash? Portable? :o No there is a need of product differenciation. Therefore, the proprietary implementation of Flash is quite buggy especially on Linux. Yes, we have our own bugs, only for us ;D The last time I tried a FPS written in Flash, I disabled textures and I got only … 0.5 frame per second. Are you sure it is still a first person shooter? It should be called a permanent bullet-time mode first person shooter ;D Nice concept.

I admit the absence of JVM on some platforms is a real problem, especially on set top boxes, some smartphones, video games machines…

Why do you speek French suddenly?

A Dalvik VM is not a JVM. Now you know why I’m not completely convinced that I should port some of my projects on Android… The J2ME implementations have really poor performances on some phones too but J2SE For Embedded is promising and kicks Google’s ass :wink:

Many people tell me that I have chosen the wrong language but when I see that WebSockets won’t be in MSIE 9 (only testable in HTM5 Labs as optional extensions), Mono not as portable as Java and with very poor OpenGL performances (at least 70% worse than JOGL), Unity3D with no support for Linux and my strong experience in C that reminds me how difficult writing a FPS by using this kind of language is even with SDL (that has some problems on very recent hardwares), SFML (that has some problems on very old hardwares), and some 3D engines that have support for Windows and Linux or Windows and Mac but not the 3 or with a poor support of non-Windows platforms… I wish Java will have a very long life. If you find bugs, why not fixing them?

Electronic Arts found the default implementation of STL so bad that it rewrote it for its own needs…

Well written C++ code is highly portable, to many more platforms than Java. It’s just that:

  1. It’s very, very hard to write good portable C++
  2. It takes a lot of time, and a lot of testing effort.
    For people who only care about platforms with an existing VM, those are deal breakers. For those of us who’d quite like to get on those remaining platforms, suddenly decisions start becoming very hard.

Yes, and the open sourced it for everyone to use, so that’s a rather pointless argument.

[quote]Well written C++ code is highly portable, to many more platforms than Java. It’s just that…
[/quote]
Not really. You have basically $N versions of the program with conditional compiling for each platform, so the project looks like its portable. But you end up with big code sections that run on one platform only, but are all in one file.

The real problem is that there is just very little cross platform libs that really are as good as javas api. Its also 2010 almost 2011, you shouldn’t need 5 different network back ends for 5 different platforms anymore in the core langs. They should bite the bullet and provide more complete default library as part of the C/C++ spec…

Not really. You have basically $N versions of the program with conditional compiling for each platform, so the project looks like its portable. But you end up with big code sections that run on one platform only, but are all in one file.
[/quote]
Like I said, you’ve got to write good code in the first place. :slight_smile:

If you do it right, your platform specific #ifdefs are constrained to a few low-level abstraction layers. 90% of your code should be identical.

[quote]The real problem is that there is just very little cross platform libs that really are as good as javas api. Its also 2010 almost 2011, you shouldn’t need 5 different network back ends for 5 different platforms anymore in the core langs. They should bite the bullet and provide more complete default library as part of the C/C++ spec…
[/quote]
Yeah, that’s still a problem. If you’re taking the above approach though, you can switch in different libraries for each bit, so you don’t have to find cross platform libraries, just ones that do X on your target platform. Again, it’s a massive amount of extra development time, but that’s the price you pay for the extra portability.

True in any language. Who here hasn’t had to track down bugs caused by different default character encodings or by dodgy assumptions about the filesystem?

[quote]Again, it’s a massive amount of extra development time, but that’s the price you pay for the extra portability.
[/quote]
We clearly have completely different definitions of portable.

I think the problem is that with Java we are in this gold cage. You can be very productive, doing awesome things, but you can’t deploy on, say, consoles, or anywhere else where there is serious money to be made. (Minecraft being the exception, ofcourse)

Did you mean in JBullet code or in your physics code that uses it? If the former, I would be highly interested :wink:

GNU Make, CMake et al have all been pretty painless for me.

I’ve never found writing portable C/C++ problematic (well at least since the early 90s). YMMV, of course, across different domains. There are a few basic gotchas but not a ton.

It is almost impossible to write some particular features in C (and in Java too but for other reasons) because some “portable” low-level APIs do not have the expected behaviour on several platforms and it is particularly difficult to work around it, especially with signal handlers. Java opens doors that it is (almost) the only language able to do it. In my humble opinion, decisions start becoming very hard when lots of users are on such platforms with no VM but my deep experience in C makes me come down to Earth.

They open sourced it not by philanthropy ;D Money is money.

I liked makefiles but it is not as portable as Ant & Maven.

Even GLUT has some bugs that forces you to call directly the Win32 API on Windows, even in very simple cases, for example to move the mouse pointer.

The only problem I’ve ever had with Java is: no native exe, but that’s not really a problem. I work on two commercial desktop applications for my mISV and I use Java, but deploying commercial Java desktop apps is non-starter (web start? no way, ensuring correct JRE in an Enterprise? No way, many companies are locked into whatever JRE they’re using). Cas’ experience proved that to me a long time ago. So I use SWT for the gui and bought a license to Excelsior JET last year to get my native exe for windows.

But then I’ve written a lot of code in a lot of languages, did all my uni work in c/c++. I still think in c. I think Java hits the sweet spot in terms of language features. It gives a well defined box in which to develop with the bobs and levers you need, you just have to know how to apply them.

Yes, that would be nice.

So far as cross platform c++, this guy has ported his puzzle game originally for the iphone to just about every platform you can name. There’s a post in there some where about how he does it:

The target is simply more important then the langauge or the platform. Regardless of if it does it well or badly, C++ hits all targets where as Java doesn’t.

I guess you missed the “et al” part. These were simple examples of first and second order make systems. Your assertation that gmake is not as portable as Ant & Maven is silly.

It’s exactly this kind of thinking that made me decided to stop contributing to GPL/LGPL projects back in the early 90s. So much so, that my open source code has a GPL/LGPL exception…none of my code may be linked or distributed with GPL/LGPL compat. licensed software. There are a number of people of my generation that later quit was well, notably around the time that Richard Stallman went on a tirade against O’Reilly at a conference that was mostly payed for by, you guessed it, O’Reilly. The ironic thing here is that without these evil for money companies contributing code, a tons of Open Source software would be utterly worthless. Since we’re supposedly talking about C/C++, look at the check-in logs of GCC as an example.

GLUT was written by Mark Kilgard ages ago for beginners to programming and OpenGL and was meant only for simple small demos. If you use libraries like this, you’re in a state of sin.