off-road driving game

Started by dmouse, October 12, 2008, 02:27:49 PM

Previous topic - Next topic

dmouse




Hi all,

I just recently finished my first game with using jpct  :)

Any feedback is greatly appreciated.

Click <a href = "http://www.javagameplay.com/offroadrally/rally.html"> here </a> to play.


Thanks in advance.

paulscode

The physics in this game are very good, especially momentum and centers of gravity when the vehicles are in free-fall.  I also think the play-control is comparable to other racing games, so great job on that.  If you don't mind my asking, what method you are using to keep all four of the vehicle's wheels on the terrain and the vehicle's rotation correct as it drives over various altitudes?

JavaMan

Nice graphics. Very fast performance only jumped on time.
Could you tell me what shape your sky is? Is it a cube or half-sphere?

EgonOlsen

I've already spotted it on Javagaming.org. It's pretty cool albeit i suck at it. I stand no chance against the AI drivers... :'(
Do you mind if i add the game to the projects page?

fireside

click here->Fireside 7 Games<-

dmouse

Quote from: paulscode on October 12, 2008, 03:42:50 PM
The physics in this game are very good, especially momentum and centers of gravity when the vehicles are in free-fall.  I also think the play-control is comparable to other racing games, so great job on that.  If you don't mind my asking, what method you are using to keep all four of the vehicle's wheels on the terrain and the vehicle's rotation correct as it drives over various altitudes?

Paulscode,

Thanks for trying it out, and for the kind words.

I am use the wheel ray-casting technique to find out where each wheel would rest, if the car is on the ground.  That is to say, that you can work out the distance from (wheel.x, H, wheel.z) to the ground model, using a straight down movement vector (0,1,0). This gives you the y position the of the wheel when touching that particular point on the ground. If you do this 4 times, once for each wheel, you can then work out the x and z rotation of the car to match those 4 height coords. I believe (but don't quote me on this :), this method is used in the jpct car example, as well as the vehicle demo that comes with the jbullet physics engine, and in other car related games. It is pretty simple, efficient, and fast. I think some other solutions involve casting a volume (such as a cylinder) for greater accuracy, but rays were good enough for me.

I hope this helps, I am usually very bad at explaining these kind of things :)

Ben.

dmouse

Quote from: JavaMan on October 12, 2008, 08:06:33 PM
Nice graphics. Very fast performance only jumped on time.
Could you tell me what shape your sky is? Is it a cube or half-sphere?

Thanks, I prefer to use a cube for the sky, simply because I am very economical with vertex and polygon counts. IMHO with a good texture, and it is hard to notice the difference, and therefore not worth the extra (albeit rather small) computation time to render a half sphere.


dmouse

Quote from: EgonOlsen on October 12, 2008, 11:13:02 PM
I've already spotted it on Javagaming.org. It's pretty cool albeit i suck at it. I stand no chance against the AI drivers... :'(
Do you mind if i add the game to the projects page?

I am curious as to whether it is actually running at a playable frame rate on your EEEpc, Egon, since I am considering buying one in the near future.

Also, your comments about difficulty, as well as some comments on JavaGaming.org, are making realize that I need to tone down the difficulty a bit during the early levels.

Feel free to add it to the projects page (i would be honored), do you need anything from me with regards to this?

Thanks,

Ben.

dmouse


paulscode

Quote from: dmouse on October 13, 2008, 05:59:36 PM
I am use the wheel ray-casting technique to find out where each wheel would rest, if the car is on the ground.  That is to say, that you can work out the distance from (wheel.x, H, wheel.z) to the ground model, using a straight down movement vector (0,1,0). This gives you the y position the of the wheel when touching that particular point on the ground. If you do this 4 times, once for each wheel, you can then work out the x and z rotation of the car to match those 4 height coords.
That is what I was planning to do, so it is great to see a really good working example.  One potential problem I thought of is where two caticorner wheels are higher than the other two wheels:



If no special coding were in place, a scenareo like this would result in what would appear to be two wheels falling out from under the car.  I can think of 3 ways around such a problem.  The first way would be to make sure a situation like this could never occur, by ensuring that all terrains are smooth with no sudden changes in altitude (your game seems to use this method, as I could not create such a scenareo to see what would happen).  The second way would be to use a weight distribution model for the vehicle to determine which direction the vehicle would rotate due to torque.  The third way would be to set a maximum distance that a wheel can fall in relation to the other wheels, but that could lead to some pretty unrealistic situations, such as the vehicle balancing on a single wheel.

EgonOlsen

Quote from: dmouse on October 13, 2008, 05:59:36 PM
I believe (but don't quote me on this :), this method is used in the jpct car example..
Yes, it is done that way IIRC.

EgonOlsen

#11
Quote from: dmouse on October 13, 2008, 06:07:44 PM
I am curious as to whether it is actually running at a playable frame rate on your EEEpc, Egon, since I am considering buying one in the near future.
Hard to tell, because i can't steer (as mentioned on Javagaming.org) on the EEEPC. Judging from the intro sequence, i would say that it's a little slow with normal details but runs fine on low.

Edit: That's an EEEPC 701, i.e. first generation with a CeleronM running on 630Mhz. The 900 and 901 ones should be faster because they either run on 900Mhz or are using the Atom CPU. I did a comparision (albeit based on the hardware renderer) and the 901 was 20-50 faster than my 701.

EgonOlsen

Quote from: dmouse on October 13, 2008, 06:07:44 PM
Feel free to add it to the projects page (i would be honored), do you need anything from me with regards to this?
Ok, i've added it. It got second place in the list. Because i wildly inserted new projects anywhere on the list in the past, i decided to reserve the first spot for my own stuff and add each new project below that. Your game is the first one that benefits from this.

JavaMan

Quote from: dmouse on October 13, 2008, 06:03:51 PM
Quote from: JavaMan on October 12, 2008, 08:06:33 PM
Nice graphics. Very fast performance only jumped on time.
Could you tell me what shape your sky is? Is it a cube or half-sphere?

Thanks, I prefer to use a cube for the sky, simply because I am very economical with vertex and polygon counts. IMHO with a good texture, and it is hard to notice the difference, and therefore not worth the extra (albeit rather small) computation time to render a half sphere.



Ok, thanks for the suggestion!

dmouse

Quote from: paulscode on October 13, 2008, 07:54:22 PM
Quote from: dmouse on October 13, 2008, 05:59:36 PM
I am use the wheel ray-casting technique to find out where each wheel would rest, if the car is on the ground.  That is to say, that you can work out the distance from (wheel.x, H, wheel.z) to the ground model, using a straight down movement vector (0,1,0). This gives you the y position the of the wheel when touching that particular point on the ground. If you do this 4 times, once for each wheel, you can then work out the x and z rotation of the car to match those 4 height coords.
That is what I was planning to do, so it is great to see a really good working example.  One potential problem I thought of is where two caticorner wheels are higher than the other two wheels:



If no special coding were in place, a scenareo like this would result in what would appear to be two wheels falling out from under the car.  I can think of 3 ways around such a problem.  The first way would be to make sure a situation like this could never occur, by ensuring that all terrains are smooth with no sudden changes in altitude (your game seems to use this method, as I could not create such a scenareo to see what would happen).  The second way would be to use a weight distribution model for the vehicle to determine which direction the vehicle would rotate due to torque.  The third way would be to set a maximum distance that a wheel can fall in relation to the other wheels, but that could lead to some pretty unrealistic situations, such as the vehicle balancing on a single wheel.

I wanted to make a level that would have players jumping off of the top of a steep cliff edge, but at the same time, I needed to prevent them from driving (vertically) back up the cliff side after they landed (the snow level based in Austria). If I understand you correctly above, this may be similar to the potential problem you are mentioning. My (temporary) solution was not particulary realistic, but was quick and efficient, at least until I develop something better as I continue to work on the car handling engine. This solution may be similar to the 3rd option you mentioned above, where I do some specific basic checks to see if the wheel's Y positions do not differ too much (within some tolerable threshold). As I said, it's not incredibly realistic, but served my purposes well enough, perhaps until I further evolve the engine.

Ben.