why isnt java been used to write major game titles?

Discussion in 'Programming & Software Development' started by MadOnion87, Mar 30, 2006.

  1. Ravenclaw

    Ravenclaw Member

    Joined:
    Dec 6, 2004
    Messages:
    2,090
    i'm guessing garbage collection pauses would be a reason for not using java for games. allocation might be slower with malloc but at least it is consistantly slow, not really really slow now and again.
     
  2. MetalSkin

    MetalSkin Member

    Joined:
    Sep 24, 2002
    Messages:
    856
    Location:
    Brisbane, Australia
    try playing bf2 on a box with only 1 Gig of RAM. Garbage collection can be an issue, but at the same time it can be managed and boils down to what type of game your playing. As has been previously posted, there was a flight sim written in java quite a while back that performed quite well.

    the next version of java will have a lot of performance improvements taking advantage of openGL for both 2D and 3D. standard Swing gui will improve on any low end system that has openGL support. From what I have read the improvement in straight forward 2D stuff is quite impressive. The openGL project is comming along very nicely too, although I havn't delved into what's happening for 1.6.
     
  3. akashra

    akashra Member

    Joined:
    Apr 25, 2003
    Messages:
    3,883
    Location:
    Melbourne, AU
    Yeah, but Java 6 (Mustang) STILL doesn't use native or hardware accelerated drawing for Swing and AWT controls. Hence, Swing apps still look non-native :(
    Hopefully they'll work on this in Dolphin, but I ain't holding my breath.
     
  4. gibbz

    gibbz Member

    Joined:
    Jan 20, 2004
    Messages:
    1,473
    Location:
    Adelaide, SA
    Who even has or wants to instal java on their pc?!

    i dont!
     
  5. flightcrank

    flightcrank Member

    Joined:
    Aug 6, 2004
    Messages:
    745
    then u cant run any java apps. so get out of this thread. i like java its good for desktop applications. it best feature is the ability to run across all major platforms. so you only need to code once.
     
  6. qwijibo

    qwijibo Member

    Joined:
    Apr 22, 2004
    Messages:
    408
    Location:
    Old Sydney Town
    You're mixing up two concepts there:
    1) Hardware accelerated drawing - i.e. offloading graphics operations to the GPU is there, via the OpenGL and DirectX renderers. Its just not on by default - for whatever backward/hardware/driver compatibility reasons.

    2) Using native controls instead of emulating them. AWT have always been the native windows controls, and in JDK 6.0, if you use the windows L&F, then it uses windows XP uxtheme support to draw the widgets (or GTK under linux) - so they should look much closer to native.
     
  7. MetalSkin

    MetalSkin Member

    Joined:
    Sep 24, 2002
    Messages:
    856
    Location:
    Brisbane, Australia
    My understanding was that 6 will have acceleration for swing. I got this from Guy's blog, he makes a reference to that demo saying to incorperate it in 1.5 would be possible but that they would loose the acceleration that you get with 1.6 due to swing openGL support.

    I presuemed that it ment that 6 has built in acceleration but maybe they just utilised some acceleration in their code.

    Ahh, found the reference:
    So I would presuem from the quote that it's up to the individual to utalise openGL with swing in lightweight components, which would make sense, their animated buttons would require openGL to get decent performance.
     
  8. hyperstyle

    hyperstyle Member

    Joined:
    May 24, 2003
    Messages:
    1,731
    Location:
    Brisbane
    I learnt Java at uni and never liked it. Java is just a bad as VB IMO.
     
  9. akashra

    akashra Member

    Joined:
    Apr 25, 2003
    Messages:
    3,883
    Location:
    Melbourne, AU
    I was referring to hardware acceleration via use of native controls - this isn't via OGL or DX at all. Windows uses hardware acceleration for a lot of its control drawing (though it can be disabled). You'll notice that a lot of Java controls don't make use of built-in features, such as font smoothing or cleartype. There's other little quirks that they also don't obey. For that reason alone, they end up looking non-native.

    Theh same thing under OS X. Buttons and other controls are non-native, so you end up with things like the background behind the rounded corner drawing over top of of the resize handles on corners, which are correctly handled when using native controls.

    I haven't used Java for much OGL stuff, so I can't comment on that front regarding its speed, however based on my experience with the Win32 controls available, I wouldn't imagine it's all direct interaction with the OGL driver.
     
  10. Bradzac

    Bradzac Member

    Joined:
    Aug 17, 2003
    Messages:
    1,744
    If there was a "Most stupid reply" award, you would have just won it.
     
  11. akashra

    akashra Member

    Joined:
    Apr 25, 2003
    Messages:
    3,883
    Location:
    Melbourne, AU
    I think what he meant to say was:

    "They tried to teach me Java at uni, but I didn't understand even the basics so I reckon it's as bad as VB
    :)
     
  12. qwijibo

    qwijibo Member

    Joined:
    Apr 22, 2004
    Messages:
    408
    Location:
    Old Sydney Town
    Like I said, native fidelity (i.e. how much it looks & feels like programs written using the native controls) and hardware acceleration (how fast things get drawn) really are two separate issues.

    You can have hardware acceleration (i.e. fast drawing) of swing without using the native controls - as it is in java 6.0. Swing uses java2d to do all its operations, and java2d renders via OpenGL or DirectX (if its turned on). I realise there are other methods of graphical acceleration available, but everyone is moving towards using the 3D hardware for the GUI, so those methods are a bit obsolete anyway.

    If java used native controls instead of rendering them itself, it would achieve the same effect - which is why a lot of people prefer SWT instead of swing. I think the architecture and the expected operation of swing (i.e. being able to mix controls, 2D & 3D drawing) might hamper any swing -> native control bridge.

    Its the same direct interaction as a program written in C/C++ would be. JOGL is a fairly thin JNI wrapper around the OpenGL API. Java3D is the marshmellowy abstraction layer over either OpenGL or DirectX.
     
  13. MetalSkin

    MetalSkin Member

    Joined:
    Sep 24, 2002
    Messages:
    856
    Location:
    Brisbane, Australia
    I'm not part of 'a lot of people' but then I'm a special case. When you do touch screen interfaces you don't want the LnF to change if you decide to change the underlying OS, which with embedded boards and SBC's can happen.

    But I do agree with people doing WinXP development, SWT is better for this if you want to hide that your using Java. Personaly I have felt that since 1.5, the WinXP LnF is good enough to fool the average user. Anyone experianced with Windows however would pick up differences and we wont even mention the whole issue with clicking twice to select and drag.
     
  14. Luke212

    Luke212 Member

    Joined:
    Feb 26, 2003
    Messages:
    9,999
    Location:
    Sydney
    If you program in Java, then Java's the best.
    If you program in C++ then C++ is the best.

    Groundbreaking stuff.
     
  15. littlemaelstrom

    littlemaelstrom Member

    Joined:
    Mar 16, 2004
    Messages:
    357
    Location:
    Brisbane
    I'm now in my 5th year of a double degree in Eng(Electronic)/IT (Soft Eng).

    Languages I've written in at some stage or another thoughout my course:

    Java
    Matlab
    x86 Assembly
    C (ANSI and DynamicC)
    Motorola Assembly
    C++
    Haskell
    C#

    Really, it all comes down to horses for courses. IMO Java and C# are the easiest to program in, though obviously slower. I would have to say that I prefer C# now, doing GUI's is a lot easier. Java documentation and tutorials I find a lot better though. I'm starting to find more and more useful 3rd party .NET stuff too, which was lacking in the past.

    Matlab can do some specific engineering/scientific things really well (toolboxes), but doing GUI's is an absolute pain.

    Doing most things is a pain in assembly, but gives you a good appreciation for what goes on "behind the scenes". C is good for doing embedded stuff, C++ I've hardly touched to be honest, so can't say much about it. I'd rather be stabbed in the eye than have to program in Haskell again lol.
     
  16. Ze.

    Ze. Member

    Joined:
    Sep 13, 2003
    Messages:
    7,871
    Location:
    Newcastle, NSW
    You do realise that references in java are basically pointers in c++? the only thing you can't do apart from having a reference to a basic type is pointer based arithmetic but that's done by the compiler and runtime as optimisations.

    One can tinker with the policies , change it or completely remove the automatic garbage collection if one wants to in java.

    The next c++ standard will be including optional garbage collection.
    I would like to see evidence of delphi being the quickest around , i'm going daresay it was a highly compiler dependent comparison like most tests. The most common languages for writing high performance apps are still c and fortran.
     
  17. Ze.

    Ze. Member

    Joined:
    Sep 13, 2003
    Messages:
    7,871
    Location:
    Newcastle, NSW
    The motivation for swing was to avoid the bugs and differences associated with native controls :(.

    The main problem with swing is simply that people don't know how to code in it. I've written code that used a table with thousands of rows without any lag. I've also written code that used java2d methods to create and paint a large picture with any hassles.

    The slowness you see with apps behind swing is in most cases the programmer not knowing how to write code for swing.
     
  18. Luke212

    Luke212 Member

    Joined:
    Feb 26, 2003
    Messages:
    9,999
    Location:
    Sydney
    half the time tho its not worth the effort learning how to do that. id rather it work by dragging a table onto a form, and setting up the data in two clicks.

    btw a table with 1000 rows is not a good table :p
     
  19. houseofzeus

    houseofzeus Member

    Joined:
    Mar 25, 2005
    Messages:
    3,195
    Location:
    St. Lucia, Brisbane
    Without context there is no way of knowing it's good or bad. Excel sheets support around 65000 rows, is excel 'bad' as a result of this?
     
  20. hyperstyle

    hyperstyle Member

    Joined:
    May 24, 2003
    Messages:
    1,731
    Location:
    Brisbane
    :thumbdn: I think your reply may have just stolen my award. Do you know that IMO is an abbreviation for the words "In My Opinion"? It is my opinion that Java is as bad as VB. People may contest whether Java is good or not, but i'm pretty sure we all know where VB stands. I do appreciate java's cross platform ability and OO design, but it runs like a turd. Like all programming languages it has its place where it is suited best. In Java's case it's cross platform small to medium sized apps that don't do a whole lot of physical work.
     

Share This Page

Advertisement: