Java 3D Games Programming Chapters online

Dear All,

I’ve been working on a book tentatively called:
Java Programming Techniques
for 2D, 2.5D, 3D, and Network Games

I’ve just placed the 10 chapters on Java 3D (including source code) online at:

http://fivedots.coe.psu.ac.th/~ad/jg/

Please download it, try it. I’d like comments.

Thanks,

Andrew

I’m reading the articles now and they are very nice. The code that goes along with them is also very good (except the styling… ugh… but to each their own :smiley: ). Still on ch 9, but read ch15 first :slight_smile:

One thing that puzzles me, why do you say that J3D uses the Y axis as vertical? I’ve always used the Z axis as vertical in J3D. I haven’t seen anything in the API which restricts the “ground” to xz and “vertical” to the y. If your checkered tiles went along the xy axes rather than xz, then z would be “vertical”.

That is just a matter of convention. But we use an y-up as well.

This way the xy-plane forms your screen and you are looking down the z-axis.

That’s kinda what I figured, but the way it’s written sounds like you’re restricted to a y-up configuration. I would add in something like “by convention in J3D the y axis is up”.

I personally prefer z-up and it makes sense to me to match the modelling software.

But it’s flexible and you can do it however you choose and I guess that’s my point. A newbie might feel restricted to a y-up when there’s no reason to be.

I’ve always found y-up is more natural.

I’ve always found y-up is more natural.

I think it’s pretty much the standard convention everywhere. For example, the OpenGL redbook is written with the Y-axis as up.

God bless,
-Toby Reyelts

[quote]That’s kinda what I figured, but the way it’s written sounds like you’re restricted to a y-up configuration. I would add in something like “by convention in J3D the y axis is up”.

I personally prefer z-up and it makes sense to me to match the modelling software.

But it’s flexible and you can do it however you choose and I guess that’s my point. A newbie might feel restricted to a y-up when there’s no reason to be.
[/quote]
3dstudiomax uses both. The z-up is called screen coordinate system like vrml and java3d, the z up is called world coordinate system, used in the perspective view. Like you probably know already if you use 3dstudio.

I allways found the 3dstudio naming much more simple to understand than the right hand rule or something like that mentioned in the java3d specification.

[quote]Dear All,

I’ve been working on a book tentatively called:
Java Programming Techniques
for 2D, 2.5D, 3D, and Network Games

I’ve just placed the 10 chapters on Java 3D (including source code) online at:

http://fivedots.coe.psu.ac.th/~ad/jg/

Please download it, try it. I’d like comments.

Thanks,

Andrew
[/quote]
That was great of you.

There are some cool things that would be a great help if you want to research it or add it to your book.

To name just a few:

Non-expensive programming of games in java3d.

Realistic terrain rendering like in the vt.org site or geovrml adapted to games. Nothing like that fustrum culling limitation. Realistic size terrain with realistic distance fog. Im talking about 10 of kilomteters until the terrain starts fogging.

3d clouds that cast shadows in the ground.

How to implement night/day cycles in games.

How to implement weather changes in terrain textures like snow or ash changes, etc.

Rendering ocean and rivers realistically. The best ihve seen is in Ashgan from Silmarilis (old game).

Good AI like the one that is going to be in Half-Life 2 and Deus Ex 2. Quoting “the npcs allways check if there is a cool thing they can do, then do it with style” or something like that.

Morphing.

Blending animations.

Procedural textures receipts.

Assigning material information to geometry like tagging that a certain wall type can be climbed or something is inflamable.

Physics that uses the previous info.

And of course every wanabe gamer/programmer needs to do its own editor. Knowing good programming techniques is not enough if a person doesn’t know how to put everything working together. And that means knowing how to use knowledge in a working sequence.

Animations editor. Script editor. Properties for objects. Assigning textures, collision data, placing and displacing objects in a world view. Dialog editor. Etc…

I allways found the 3dstudio naming much more simple to understand than the right hand rule or something like that mentioned in the java3d specification.

Seems to me that naming “right-hand, left-hand” comes from math, as I have heard it termed that way from everybody in the math/physics disciplines.

God bless,
-Toby Reyelts

Zingbat,

Thanks for the great (and long!) list of possible extras.
Some of these things are already around. A great
starting point is:
http://www.j3d.org/sites.html

j3d.org has quite a bit on terrain rendering, which
I mention at the end of chapter 17 “Fractal Land”.

Morphing is used to animate the figure in the tutorial
“The Little Purple Dude Walks” by Ben Moxon at
http://www.gamejug.org/tutorials/.

As I mention in the intro chapter, section 2.3.2,
a good technique is to search sourceforge and
other game/coding sites.

  • Andrew

Yup i checked this link out already. Its possible to render a vast piece of land or even an entire planet with some advanced lod algorithms they mention.

What puzzles me is how to lod behaviours. For instance a great city being watched from the top of a far away mountain. There are hundreds of small lights going back and fort (cars), airplanes landing, people walking and doing a great number of different things (lots of people).

Doing this by representing everyone and every actor by a single object would require much more than any personal computer can handle.

But if the player can’t interact with that great city at the distance then we can “fake” the looks of a great city when looking at it from a “safe” distance.

When the player gets near the city then pieces of it start to unfoald and the player finally starts to interact with the individual parts when they start being loaded into memory.

This is the kind of behaviour lod that i never seen in the net. If you could find some solution or at least an half solution to this it would be great for us wanabe game makers.

I can’t remenber anymore cool things right now.
;D

Making a “LOD behaviour” isn’t that hard if you think
of the behaviour being modified based on the current
location of the player.

In my FPS examples, there’s a KeyBehaviour object
that converts user keypresses into moves of the
viewpoint. It knows the current position of the
viewpoint and could pass that information on to other
behaviours.

When a ‘LOD behaviour’ is triggered it could first
do a test on the user’s current position to decide
what behaviour to exhibit.

  • Andrew

Thanks for the draft version of the book. :slight_smile:

I get an error for Ben Moxon’s example ( I downloaded the example and then tried compiling it by “javac *.java” ):

BasicWalkDude.java:13: package com.glyphein.j3d.loaders.milkshape does not exist

import com.glyphein.j3d.loaders.milkshape.;
^
ClimbDude.java:13: package com.glyphein.j3d.loaders.milkshape does not exist
import com.glyphein.j3d.loaders.milkshape.
;
^
FollowcamDude.java:13: package com.glyphein.j3d.loaders.milkshape does not exist

import com.glyphein.j3d.loaders.milkshape.;
^
ShowDude.java:14: package com.glyphein.j3d.loaders.milkshape does not exist
import com.glyphein.j3d.loaders.milkshape.
;
^
Theres other errors, but I think those errors are because those packages don’t exist. Anyone know how to fix the problem / where to get the package?

For best results, you should post to a more relevant
topic, or make your own. The online book is written
by me, not Ben Moxon, so he may not read your
message.

You might also consider mailing to the Java 3D
interest list, and perhaps searching its archive:
http://www.mail-archive.com/java3d-interest@java.sun.com/

Your diagnosis is right – no Milkshake loader.
You can get it from
http://home.earthlink.net/~kduling/Milkshape/

Moxon’s tutorial can be found at:
http://www.newview.co.uk/e/tutorials/java3d/index.jsp

  • Andrew

Thanks for the help. :wink:

hmmm, seems to be down right now, I was looking at it earlier though, it looks great! Now sure if it’s just me, but I want to keep reading!

Power failure. We’re back now.

Great! ;D