2D Gaming Chapters now Online

Dear All,

I’ve started putting the 2D gaming chapters of my
book “Java Programming Techniques for 2D, 2.5D, 3D,
and Networked Games” online at
http://fivedots.coe.psu.ac.th/~ad/jg/

Comments, suggestions, are appreciated.

Thanks,
Andrew
dandrew@ratree.psu.ac.th

whoa THX :wink:

cheers,

bibo

Hey thanx for sharing :slight_smile:
I went through your first chapter and would like to say that you have an interesting workaround concerning the poor resolution of the sleep() method. However, I am not sure wether it is a good idea to continue developing games with a sleep method in their game loops. The issue of garbage collection does come up, but some of the more experienced programmers here have found ways of ironing out the kinks in that, and I am guessing that future jdk’s will have solved some of the problems related to the GC. Then again I really dont have enough experience to be sure about this, so any responses are more than welcome.

Andrew, I am working through the 2D stuff in your book, what a great resource!

I have noticed an issue with FSEM WormChase. About half the time on my machine when the WormChase starts up it just paints the screen gray and that’s it. Hitting ESC exits the program. I’m running 1.4.2 on a not-too-ancient Dell running Windows XP with Direct X 9.

I experimented a little by changing the background color of the JFrame to Color.BLUE and indeed, it now gives me a screen full of blue about half the time. I’m wondering if the JFrame is occasionally winniing a race to grab the drawing surface?

  • Nick

Tha could be a known full screen exclusive bug with 1.4.2 Also are you checking that all you images are loaded completely before the first rendering is done?

V.Useful introduction to J2D.

Are you going to cover ManagedImages, HW acceleration, and the other black arts of J2D in the coming chapters? (I hope so, It would solve so many of the reoccuring questions that come up on this, and other forums :P)

1 thing the Fullscreen Exclusive Mode bit doesn’t touch on, is the reason the fps maxed out at 80-85, when 100 was requested - Vsync.

[quote]Tha could be a known full screen exclusive bug with 1.4.2 Also are you checking that all you images are loaded completely before the first rendering is done?
[/quote]
The sample app is not loading any images. It draws text and calls AWT drawing functions.

Which known bug are you reffering to? Is there a work around? I couldn’t find it in the bug database but maybe I missed it. Thanks for your help!

I think Kommi is refering to the fullscreen deadlock bug that surfaces occasionally during bufferStrategy creation.

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=2D;action=display;num=1046462693;start=2#2

looks like that was it, works fine now. ;D

Dear All,

Thanks for the info on the buffer strategy creation
bug; I’ll try to add the fix into the code and chapter
today or tomorrow. Did the problem occur in
1.5, which is meant to have fixed it?

The next chapter is about image manipulation, with
a discussion about managed images, and a
few special effects like fading, flipping, etc.

One dilemma I have, is how much to stick with 1.4.2. :slight_smile:

For example, I really need to revisit chapters 1-3
and use the nanosecond counter rather than the
Java 3D timer. In chapter 4, should I mention the
workaround when using ImageIO to create a
managed image?

  • Andrew

Hey Andrew how is the book going by the way?

Not good I suppose, broken link :’(

[quote]Dear All,

I’ve started putting the 2D gaming chapters of my
book “Java Programming Techniques for 2D, 2.5D, 3D,
and Networked Games” online at
http://fivedots.coe.psu.ac.th/~ad/jg/

Comments, suggestions, are appreciated.

Thanks,
Andrew
dandrew@ratree.psu.ac.th
[/quote]
Thanks a lot Andrew. You are being a big help to the games community. I have your 3d chapters already and the 2d stuff will be very useful.

Dear All,

The book’s Web site was offline last week, due to
cable repair in Japan. It’s been back since then.
http://fivedots.coe.psu.ac.th/~ad/jg/

I’ve just added a long chapter (70 pages) called
“Images, Visual Effects, and Animations”,
about Java 2D imaging.

Please have a look if you’re interested.
Comments appreciated, of course.

Thanks,
Andrew

Congratulations for finding a publisher. I really liked what i have seen so far from your book. I have read quite a few books about java game development but they all lack on going into depth of the graphics features. so you have a good chance to fill a gap.

thx, for distributing them for free.