Mr. Gol
|
 |
«
Posted
2006-05-08 20:01:51 » |
|
Hi all, I have been using Java3D for quite a while now, and as a result of this I've made this racing game to see if it was any good for making games. It's not actually a game since there is only one car on the track. The collision detection is dodgy, and the physics still need work but overal I'm pretty happy with the result. I'm very interested in your feedback, although it's far from completed I'm curious how it rates among Java game design experts. If anyone wants to know how I did certain features just ask. Download: http://www.freewebtown.com/dennisbijlsma/files/ferrari3d/ferrari3d_150.zip 
|
|
|
|
|
Breakfast
|
 |
«
Reply #1 - Posted
2006-05-09 17:49:04 » |
|
This looks very interesting- I haven't had time to get it downloaded yet, but the screenshots look great!
|
|
|
|
|
Herkules
|
 |
«
Reply #2 - Posted
2006-05-10 10:58:46 » |
|
Great stuff, works fine here out of the box.
I'm always interested in the simple things: how did you implement text output?
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Mr. Gol
|
 |
«
Reply #3 - Posted
2006-05-10 11:19:23 » |
|
Great stuff, works fine here out of the box.
I'm always interested in the simple things: how did you implement text output?
I don't really understand what you mean by 'text output'. If you mean the HUD, I override the postRender method of Canvas3D. I read everywhere that it's supposed to be very slow, but I didn't see any major differences in performance. There is one bug that I find really annoying, after loading, when the Canvas3D is created, you have to click it before the keylistener works (I partly solved it by warning on the loading screen). I'm thinking it may have something to do with the lightweight menu and the heavyweight Canvas3D transition. Has anyone else had this problem?
|
|
|
|
|
noblemaster
|
 |
«
Reply #4 - Posted
2006-05-10 12:38:40 » |
|
Looking good  . Worked without problems. I like the interface graphics! The controls/smoothness of motion needs some work though!
|
|
|
|
otelo
|
 |
«
Reply #5 - Posted
2006-05-10 14:09:17 » |
|
The wheels don't turn  You've put a lot of effort into this though, so ignore the complaining. I wonder what is slowing it down so much on my computer.
|
|
|
|
|
Mr. Gol
|
 |
«
Reply #6 - Posted
2006-05-12 11:01:12 » |
|
The wheels don't turn  Erm...they do...at least on my computer  About the motion, I get a framerate of 22, dropping to about 17 in the 'busier' parts of the track, but since my graphics card is terrible I thought it would be the same or faster on other computers.
|
|
|
|
|
swpalmer
|
 |
«
Reply #7 - Posted
2006-05-12 21:22:19 » |
|
Did he mean "steering" turn or "spinning" turn?
|
|
|
|
Mr. Gol
|
 |
«
Reply #8 - Posted
2006-05-13 11:46:33 » |
|
Did he mean "steering" turn or "spinning" turn?
They are supposed to turn in both lateral (turning) as well as longitudinal (rolling) direction 
|
|
|
|
|
NewbTon
Junior Member  
Odejava games rock!
|
 |
«
Reply #9 - Posted
2006-05-18 14:06:29 » |
|
Wow great job. Did you model everything yourself ?(very impressive I think)
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
cylab
|
 |
«
Reply #10 - Posted
2006-05-18 15:19:31 » |
|
There is one bug that I find really annoying, after loading, when the Canvas3D is created, you have to click it before the keylistener works (I partly solved it by warning on the loading screen). I'm thinking it may have something to do with the lightweight menu and the heavyweight Canvas3D transition. Has anyone else had this problem?
Maybe the Frame has focus at first. Either call requestFocus on the canvas in it's addNotify()-method or add the Listener to the Frame instead (you might have to set focusable to false on the canvas then).
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
Mr. Gol
|
 |
«
Reply #11 - Posted
2006-05-18 16:38:10 » |
|
Wow great job. Did you model everything yourself ?(very impressive I think)
Yes. Although everything consists of the car and the track (which isn't that good) 
|
|
|
|
|
Mr. Gol
|
 |
«
Reply #12 - Posted
2006-05-28 20:45:46 » |
|
Yet another question  Is it possible to make a material in Java3D look something like the car in this screenshot:  I'm guessing it uses a custom pixel shader, as the differences in color seem to be caused by the sky texture, so there must be some raytracing involved. This look probably isn't possible with Java3D's standard Appearance class, but there seems to be little to no information about how to use GLSL shaders, and I don't think I'm capable of writing one myself. Is there anyone who can point me to some sort of starting point for this?
|
|
|
|
|
thijs
Junior Member  
Lava games rock!
|
 |
«
Reply #13 - Posted
2006-05-28 22:40:40 » |
|
Every time I download the file it's corrupt when I try to open it  'm guessing it uses a custom pixel shader, as the differences in color seem to be caused by the sky texture, so there must be some raytracing involved. This look probably isn't possible with Java3D's standard Appearance class, but there seems to be little to no information about how to use GLSL shaders, and I don't think I'm capable of writing one myself. Is there anyone who can point me to some sort of starting point for this? You don't (necesarily) need pixel shaders to pull that of, let alone raytracing  Look up for the term "environment mapping" on google, it's a cheap way of achieving that effect. Thijs
|
|
|
|
Mr. Gol
|
 |
«
Reply #14 - Posted
2006-06-02 12:56:24 » |
|
You don't (necesarily) need pixel shaders to pull that of, let alone raytracing  Look up for the term "environment mapping" on google, it's a cheap way of achieving that effect. Erm...yes, you are right. I thought it had something to do with pixel shaders because that's where I first saw it. However, I couldn't find any actual example on how to use it in Java3D. I know that I must render an image taken from the car, combine it with the existing texture, and then use the TexCoordGeneration class to make it look spherical. Is there some actual example of this being done on the internet, and if so, where 
|
|
|
|
|
Orangy Tang
|
 |
«
Reply #15 - Posted
2006-06-02 13:19:25 » |
|
However, I couldn't find any actual example on how to use it in Java3D. I know that I must render an image taken from the car, combine it with the existing texture, and then use the TexCoordGeneration class to make it look spherical. Is there some actual example of this being done on the internet, and if so, where  Most games don't bother having dynamic environment mapping, the cube maps are just calculated ahead of time somehow (either when the level is made or using a generic artist drawn texture).
|
|
|
|
|
|
otelo
|
 |
«
Reply #17 - Posted
2006-06-09 10:16:29 » |
|
Edit: Got it working now, the effect isn't that noticable, but those little graphical touches make a big difference.
I assume you used a TexCoordGeneration object in REFLECTION_MAP mode for the second 'gloss' texture?
|
|
|
|
|
Mr. Gol
|
 |
«
Reply #18 - Posted
2006-06-19 14:06:09 » |
|
OK, I've finally finished a stable version. You can download it at http://www.freewebtown.com/dennisbijlsma/files/ferrari3d/ferrari3d_150.zip. I also changed the link in the first post. Performance still isn't too great, but I can't think of any quick ways to improve it, and it's not too bad if you have a decent graphics card. Maybe I'll continue on this in the future, but for now thanks to all who have looked at and answered my questions! @otelo: Yes 
|
|
|
|
|
skyuzo
Senior Newbie 
|
 |
«
Reply #19 - Posted
2006-07-04 01:43:05 » |
|
There is one bug that I find really annoying, after loading, when the Canvas3D is created, you have to click it before the keylistener works (I partly solved it by warning on the loading screen). I'm thinking it may have something to do with the lightweight menu and the heavyweight Canvas3D transition. Has anyone else had this problem?
Maybe the Frame has focus at first. Either call requestFocus on the canvas in it's addNotify()-method or add the Listener to the Frame instead (you might have to set focusable to false on the canvas then). ...or you can use the java.awt.Robot class to move the mouse to where you want, press and release a mouse button. (but I think it is a little slower)
|
|
|
|
|
konieczny69
Senior Newbie 
|
 |
«
Reply #20 - Posted
2007-01-02 22:11:35 » |
|
good job
I am currently working on mu own racing game and but I am facing some problems with moving my car. I want it to look realistic (including acceleration for example) so decided to go with KeyNavigatorBehavior but still its not really what I want, could you tell me how did you implement the way to control the mobile ?
cheers, Lukasz
|
|
|
|
|
Conzar
Junior Member  
There is nothing common about common sense
|
 |
«
Reply #21 - Posted
2007-01-09 14:27:51 » |
|
Hey man, I really think the HUD is gonna kill your frame rates. I've tried painting on the Canvas before in my game and it was killer. Now I'm painting on several small QuadArrarys for each major group in my HUD (this is for a space sim game).
|
Ubuntu
|
|
|
Herkules
|
 |
«
Reply #22 - Posted
2007-01-09 14:40:49 » |
|
And how do you fill your Quads? I found that painting with Java2D and creating a new texture each frame can be a performance drain as well.
|
|
|
|
Conzar
Junior Member  
There is nothing common about common sense
|
 |
«
Reply #23 - Posted
2007-01-09 16:48:27 » |
|
You paint with Java2D in both cases. The difference is you DO NOT have to repaint every frame when using a QuadArray; however, you DO have to repaint every frame when painting on the Canvas. This is where you can save performance. I can't remember how often I update (every x milliseconds or something - I can check when I go home if you want).
Make sense?
|
Ubuntu
|
|
|
Herkules
|
 |
«
Reply #24 - Posted
2007-01-09 19:09:29 » |
|
makes sense
OTOH this would not make a smooth HUD (e.g. for a flightsim) possible, which needs to be updated each frame?
|
|
|
|
Conzar
Junior Member  
There is nothing common about common sense
|
 |
«
Reply #25 - Posted
2007-01-09 21:41:13 » |
|
Not true. You have to think about the information that is being convaied in the HUD. For instance, console messages do not need to be updated all that often (b/c people aren't typing and events aren't happening every frame). Almost every peice of information in the HUD is static from frame to frame. So you take some time slice to determine when the HUD needs to really be updated. This can save you alot especially if you have transparency in your HUD.
BTW, what does OTOH mean? Is it although?
|
Ubuntu
|
|
|
Herkules
|
 |
«
Reply #26 - Posted
2007-01-09 23:39:23 » |
|
OTOH == on the other hand
Think of a HUD that you have in jet sims, current horizon, angle-of-attack and so on. These displays have to me smooth.
I'd not call console text to be a HUD, thats just a GUI. HUD is a defined term in avionics.
|
|
|
|
Conzar
Junior Member  
There is nothing common about common sense
|
 |
«
Reply #27 - Posted
2007-01-10 15:45:13 » |
|
Well, in video games a HUD is usually defined as the tertiary information that is displayed to the user. In FPS's, health, ammo, number of lives, and etc are common elements in the HUD. And yes, text are very much an important function of the HUD.
I agree that HUD components need to be smooth. But smooth != updating every frame. Some HUD components might need to be updated more often then others, but still doesn't necessitate every frame.
|
Ubuntu
|
|
|
Mr. Gol
|
 |
«
Reply #28 - Posted
2007-01-14 14:47:36 » |
|
You paint with Java2D in both cases. The difference is you DO NOT have to repaint every frame when using a QuadArray; however, you DO have to repaint every frame when painting on the Canvas. This is where you can save performance. I can't remember how often I update (every x milliseconds or something - I can check when I go home if you want).
Make sense?
First of all, nice to see my thread bumped after six months. I actually did experiment with using Quads as a HUD, but the graphics looked fuzzt for some reason, and they were stuttering a bit. These problems seem to be standard for Java 3D users, just search on this forum for ´Java3D HUD´ and you´ll find multiple threads on this. I eventually decided that it wasn´t worth the haasle, and did my HUD the J3DGraphics2D way. The performance loss isn´t that bad, I still get a framerate between 25 and 35, which I think isn´t that bad.
|
|
|
|
|
Conzar
Junior Member  
There is nothing common about common sense
|
 |
«
Reply #29 - Posted
2007-01-17 21:51:55 » |
|
yea, but try running the game on an older system. I was shot, fired, and burned at the stake when my buddy couldn't run an alpha of my game b/c his 5 year old PC couldn't get more then a few frames a second (I was getting about 25 - 35 FPS on my system w/ a Geforce7800). Once I changed to Quad Arrays, he can now play smoothly (not sure of his FPS but its playable for him).
As for the fuzzy problem, I know in the past I have had issue's with using Text3D and scaling. You also might run into that using awt on a texture if your image size isn't a power of two. So you may want to try that.
|
Ubuntu
|
|
|
|