|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| What advantages does Java2d have for games? |
|
![]() nonnus29 Member since: 3/2/2002 From: USA |
||||
|
|
||||
| Until now I've always used plain old java and AWT for my games. From my research I've found that Java2d ala 1.4 provides alot of things; 1. Access to full screen modes (on platforms that support it) 2. You can select resolution and color depth in full screen 3. Hardware accelerated blitting via volatile images 4. There is a better timer out there, somewhere (not sure where yet) 5. Alot more image formats supported. 6. BufferImage is WAY better than memoryImageSource The other things I've found include alpha blending and rotating of images; although these don't appear to be accelerated at this time. So am I missing anything? |
||||
|
||||
![]() snowmoon Member since: 11/16/2000 From: Albany, NY |
||||
|
|
||||
| 1) Yes 2) Yes 3) Yes, But buffered images are almost as fasy with none of the drawbacks. 4) No... people have written ( myself included ) timers that can approximate 30fps based on 100% pure java OR you can use of the native libs that provide that functionality. 5) Yes, minimally you can use J2d for it's image support 6) Yes If you search under my name ( snowmoon ) here and at javagaming.org you will probably be able to pull up the code I wrote. Unfortunatly I lost most of it in a HD crash. If I were to be starting again today I'de be using lwjgl since it's lean and fast. There is no upper level functions, but it's still a great starter. |
||||
|
||||
![]() snowmoon Member since: 11/16/2000 From: Albany, NY |
||||
|
|
||||
| http://www.gamedev.net/hosted/javanerd/ It's a 2d library that incorperated my threded timer control. |
||||
|
||||
![]() nonnus29 Member since: 3/2/2002 From: USA |
||||
|
|
||||
| Snowman, your the prodigal son that has returned. I've been using your timer code for a long time and I recently reposted it over at javagaming.org. They have a wiki over there it needs to go on too, but someone must provide hosting for the file. I believe there is a better timer in jdk 1.4.2.b3 or something, I'll have to research it. |
||||
|
||||
![]() tortoise Member since: 7/9/2002 From: Cedar Rapids, USA |
||||
|
|
||||
| Eh, just use a native timer. You only need the native interface for Windows, all other OSes provide proper resolution. Slap a timer factory front end on, you're done. Java2D is generally hardware accelerated under Windows, most of the time BufferedImages are hardware accelerated and if they're not it's easy to make them so they are. It is strongly rumored this will also become the case for Linux with 1.5. Java2D's major disadvantage is it is so sporadically implemented on all the various platforms. It's not consistent at all . You can get a program running like butter on Windows and it will be a dismal mess on Linux. I have a paint program I wrote that is 100% unusable on Linux, runs beautifully on Windows. MacOSX? Solaris? I have absolutely no idea what would happen on them. If I use Java2D to any extent, I just declare "Windows only". Which usually means I either don't use java2d or use it in a modular fashion. |
||||
|
||||
![]() Anonymous Poster |
||||
|
||||
| Ok Java2d seems better but i have no idea how it works, and i want to write a game (Sopwith clone) which needs to rotate images, so does anyone know of a good Java2D tuturial? Or maybe a small demonstration program? Thanks.. |
||||
|
||||
![]() NuffSaid Member since: 1/13/2000 |
||||
|
|
||||
quote: If you are interested to know, I run OS X and I can give your app a go and see how things run. In my experience, Java2D on OS X seems to be pretty complete and well done, thanks to Apple's work on integrating it with the OS. |
||||
|
||||
![]() tortoise Member since: 7/9/2002 From: Cedar Rapids, USA |
||||
|
|
||||
quote: Rotating images in real time with Java2D would be difficult, if not impossible. You'd be much better off using OpenGL. http://java.sun.com/docs/books/tutorial/2d/ looks good. Keep in mind Java2D was meant more for like batch processing and image touch up. Using it in a real time game can be very difficult. quote: Cool. I've got next week off and one thing I'll be doing is cleaning up all my projects and putting them on my website. I'll post here when it's up, right now it's just sitting in eclipse, hasn't been "packaged" yet. |
||||
|
||||
![]() nonnus29 Member since: 3/2/2002 From: USA |
||||
|
|
||||
quote: You can use BufferedImage and the rotation algorithm in this article. http://www.gamedev.net/reference/programming/features/imageproc/ Per pixel operations like rotation and blending are do-able as long as the image isn't TOO big. |
||||
|
||||
![]() snowmoon Member since: 11/16/2000 From: Albany, NY |
||||
|
|
||||
quote: Yes, bow down before me It was just a simple solution to the problem. Of course if sun got their act together we would have something better, but us poor game developers always seem to get the shaft. Biggest problem I had was working out the jitters in my demo. I'm fairly sure it had to do with memory allocation since it was almost 100% reproducable when the free memory jumped. I'm investigating lwjgl since it's the most promising at this point. |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|