|
keeskist
|
 |
« on: December 30, 2007, 07:23:27 pm » |
|
About two years ago I made a simple racing game in Java 3D for a school course called Advanced 3D. Although the result looked reasonable, especially as I had only six weeks to make it, it suffered from always consuming 200+ mb of memory and having framerates of 15-20. A few months ago I discovered jMonkeyEngine, and quickly became impressed with its set of features. As I no longer have the time to create an entirely new game I decided to port Ferrari3D to JME. The result is quite impressive, it looks and plays MUCH better and smoother than the original. The game itself is rather basic though, although all the standard stuff (multiple cameras, AI, track records) is there. Multiplayer is only via LAN through standard sockets, I havenŽt really read into what is available for networking these days. Some features are disabled currently because they broke during the Java 3D to JME transition, but I plan to re-add them when I have time. I would really welcome any feedback, as even though the game is quite basic it still makes me somewhat proud that I achieved to make a full game  IŽm very impressed with the games that others here are making, finally there is some sort of Java gaming community! Screenshots:    Download URLs: Windows: http://www.dennisbijlsma.com/data/ferrari3d/ferrari3d_windows.zipI will be adding downloads for Mac OS X and Linux, and maybe even webstart in the near future. At the moment you can already run the game from non-Windows OSes by just ignoring the .exe file and launching the .jar instead. Java 5 is required for all platforms.
|
|
|
|
|
Logged
|
|
|
|
Core-Dump
Committer
Hero Member
Offline
Posts: 2663
|
 |
« Reply #1 on: December 31, 2007, 01:11:33 am » |
|
I can't keep on the track in curves because the car does not steer enough, It seem not even the AI manages to keep on the Track  And when i crash into a wall, i am Stuck. Somehow i can't drive backwards. Otherwise it looks nice, keep working on it, i am sure it will be fun to play after a few things have been fixed.
|
|
|
|
|
Logged
|
|
|
|
|
keeskist
|
 |
« Reply #2 on: December 31, 2007, 11:55:53 am » |
|
Well, you could always brake before a corner. This isn't Mario Kart  I agree with you that the AI is poor, IŽll be looking to improve it a bit. You can see in the screenshot how it works, there is a number of control points which each have a hint for controls (red for accelerating, yellow for braking and orange for neither). In the settings menu you can switch on the option "auto reverse". When this is enabled you can drive in reverse by holding the brake button. Actually IŽll change this to enabled as the default value.
|
|
|
|
|
Logged
|
|
|
|
Core-Dump
Committer
Hero Member
Offline
Posts: 2663
|
 |
« Reply #3 on: December 31, 2007, 02:36:54 pm » |
|
but but but, i do brake before the the curve  But even when i drive 10 km/h i can't keep on the track in the first S-Curve. Another thing is that when you break, you can't steer at the same time.
|
|
|
|
|
Logged
|
|
|
|
renanse
Champion
Hero Member
Offline
Posts: 5457
|
 |
« Reply #4 on: December 31, 2007, 06:06:00 pm » |
|
Thanks for sharing your experiences in porting a game across to jME.  It looks nice. If you can grab some video footage, post it on youtube so I can add it to the jME play list 
|
|
|
|
|
Logged
|
--- next gen Ardor3d has reached 0.6!
|
|
|
|
keeskist
|
 |
« Reply #5 on: January 06, 2008, 10:15:28 pm » |
|
IŽve fixed a few things that were broken in the posted version, you can use the same link from my first post in this thread to download the new version. I also added collision reactions for when you hit other cars. Previously you would just stop dead after hitting an opponent (like the original Ridge Racer). One area that IŽm having problems with is cheating. You can easily gain time by cutting corners. I know that old racing games prevented this by reducing your maximum speed for a while as a penalty, or to put "invisible walls" at the inside of corners. My fear is that this will be annoying as hell though. Currently the grass already has a higher friction, but I donŽt want to turn it into quicksand. @Renanse: I have videos at http://www.dennisbijlsma.com/data/media.php?id=168 and http://www.dennisbijlsma.com/data/media.php?id=169, but MEncoder produces crappy FLVs which YouTube canŽt upload. IŽll try to convert with a different program.
|
|
|
|
|
Logged
|
|
|
|
renanse
Champion
Hero Member
Offline
Posts: 5457
|
 |
« Reply #6 on: January 06, 2008, 10:30:24 pm » |
|
mpeg4 and avi both work ok... (for best results use 640x480)
|
|
|
|
|
Logged
|
--- next gen Ardor3d has reached 0.6!
|
|
|
|
Ender
|
 |
« Reply #7 on: January 06, 2008, 11:34:15 pm » |
|
Again a poor performance game under Mac OS X (7 FPS, track disapears frequently, probably because of the poor framerate). I guess you use swingui.
|
|
|
|
|
Logged
|
|
|
|
|
keeskist
|
 |
« Reply #8 on: January 07, 2008, 03:01:29 pm » |
|
Again a poor performance game under Mac OS X (7 FPS, track disapears frequently, probably because of the poor framerate). I guess you use swingui.
That surprised me a bit. I have a Mac Mini myself and I get framerates between 25 and 30. Which kind of Mac do you have, and are you using Tiger or Leopard? It's bizarre how low your framerates are, I tested on a 4-year old laptop and the framerate was almost never below 20. Edit: What could happen is that your resolution is so high that the painting of the HUD takes up an unreasonable amount of time. Could you try running in non-fullscreen mode, so that the HUD is 800x128?I use a quad in ortho mode to paint the GUI, as described in the tutorial "HUDs for the total n00b", although I do use Java 2D to paint the actual image on the HUD. The menus are in Swing, but they are in a separate window that is destroyed when the game is started. Also, videos are now at http://www.youtube.com/watch?v=o4_ILn5SjXM and http://www.youtube.com/watch?v=08Eagw5WcoE . Thank MEncoder for the blurryness.
|
|
|
|
« Last Edit: January 07, 2008, 05:39:47 pm by keeskist »
|
Logged
|
|
|
|
|
Ender
|
 |
« Reply #9 on: January 07, 2008, 10:40:12 pm » |
|
Unbelievable!!! I have a Mac Pro 2 * Quad Core 3 GHz, 4 GB RAM, a ATI Radeon X1900 XT with 512 MB of VRAM, and Tiger 10.4.11. Java version is: $ java -version java version "1.5.0_13" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241) Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing) Is your Mac Mini a Intel Mac Mini or a PPC Mac Mini? Every other 3D applications run really smooth. I reached 127 FPS with World of Warcraft full screen and all the graphics and audio settings at the max. EDIT: I explored the libraries folder and I discovered that openal.dylib is not Universal, it is a PowerPC binary. Do you think that it could be the cause?
|
|
|
|
« Last Edit: January 07, 2008, 11:00:46 pm by Ender »
|
Logged
|
|
|
|
|
Ender
|
 |
« Reply #10 on: January 08, 2008, 04:25:40 am » |
|
Ok. I tested the openal.dylib sobstituting it with a Universal version taken by MacPorts but this not resolved the problem.
Anyway after playing a little more with it I can make this considerations.
1. At the start the track is always invisible and I have poor framerate. 2. When framerate is poor (about 5-7 FPS), the track is allways invisible and I only see other cars, other objects in the scene and a light-gray background color. I guess the two things are related. 3. Framerate is not allways 5-7 FPS, there are areas of the track where I see the track and I also have about 60-87 FPS.
I guess 2 possible reasons.
1. It could be something that is related to acceleration of the car. Even if it is strange that at the beginning the problem appears even if my car is almost 0 velocity. 2. Or it could be something related to some lighting effect. I notice that there is a Sun flare...
... any other ideas?
|
|
|
|
|
Logged
|
|
|
|
|
Ender
|
 |
« Reply #11 on: January 08, 2008, 11:04:17 am » |
|
I made some more tests and I have some new observations. The track generally disapears when my car is rotated of a certain angle relative to the track direction (or relative to something else, i am not sure). Though if I keep my car stright haead or I turn it left, I have no problem and the framerate is high (in a range from 60 to almost 100 FPS). When I turn right relative to track direction framerate decades and track disapears. In the images below you can see. 1. The black screen when loading track after I press "start". It is a long load. Maybe 30 seconds or more. Though, less than a minute I think. 2. The start grid. I noticed that the game starts at 60 FPS but after some milliseconds it decades to 5-7 FPS. 3. I need to run for some meters before I am able to turn left and see the track. 4. I turned left and I finished on the grass. 5. The more stright orientation I have been able to reach before the track disapeared again. I tried to run farest, and I noticed that the problem behave always the same way also in the rest of the track. I tried some profiling with Profile4j. Consider that profiler kills performances, so I was not able to have more that 9 FPS also when track was visible. But I do not think that this affects affects stats. 1. What happens when Game loads. I unfolded the most time consuming calls. 2. This is what happens when I was at the start grid. I tested almost the same things then before. Note the 148% and 227% of the displayBackBuffers() and update() calls. 3. and 4. should be on the grass with visible track (turned left) and back to right with disapeared track.
|
|
|
|
|
Logged
|
|
|
|
|
keeskist
|
 |
« Reply #12 on: January 08, 2008, 01:30:28 pm » |
|
First of all, thank you for your incredibly detailed post(s)! My Mac Mini has a 1.66ghz Core Duo, so Intel, and 1 gb of memory. To be honest I only know one other person with a Mac, and he has good framerates as well on his MBP with a Core 2 Duo. The first question I would like to ask is how you actually run the game, as I didn't make an application bundle before. You can get that at http://www.dennisbijlsma.com/data/ferrari3d/ferrari3d_macosx.zip. The first thing that I would guess from the combination of poor framerates and graphical problems, is that some operation is not supported by your graphics card. If you look at the two screenshots on the right, where everything appears to be normal, the framerate is 70 - 90, which seems reasonable for your uber-computer. It could be something with the bumpmap that the track uses, although it does seem to look OK in the last screenshot. Another possibility is that sorting Zs is really slow for some reason. As for loading, it's much faster when you're using Java 6, which is only available as a beta for Mac unfortunately. From the profiler shot I see that loading the circuit takes up 11 seconds. Even though that's by far the largest piece of geometry I'll check if something is taking up an unreasonable amount of time there.
|
|
|
|
« Last Edit: January 08, 2008, 06:05:31 pm by keeskist »
|
Logged
|
|
|
|
|
Ender
|
 |
« Reply #13 on: January 09, 2008, 12:20:24 am » |
|
I used a command line instruction (now converted to a bash script). if [ "$1" = "noprof" ] ; then echo "Run ferrari3d alone." java -jar -Xmx256m -classpath ./libraries/jme.jar:./libraries/lwjgl.jar:./libraries/platinumlaf2.jar:./libraries/quaqua.jar:./libraries/utilities.jar -Djava.library.path=./libraries ferrari3d.jar elif [ "$1" != "noprof" ] ; then echo "Run ferrari3d with profiler." java -jar -Xmx256m -classpath ./libraries/jme.jar:./libraries/lwjgl.jar:./libraries/platinumlaf2.jar:./libraries/quaqua.jar:./libraries/utilities.jar -Djava.library.path=./libraries -javaagent:/Applications/profiler4j-1.0-beta2/agent.jar ferrari3d.jar fi The first thing that I would guess from the combination of poor framerates and graphical problems, is that some operation is not supported by your graphics card. It is exactly the same idea I have. But I don't know how to isolate the problem. Generally JMEDesktop is a jME feature that gives a lot of problems with Mac. So, at the beginning I guessed that it could be the reason. But, after those experiments I changed my idea and I think that is something related to 3D GL, as to say LWGJL or jME. It could be something with the bumpmap that the track uses, although it does seem to look OK in the last screenshot. Another possibility is that sorting Zs is really slow for some reason. The important thing is the strange behaviour. There is something that triggers only if I turn right relative to the track direction. Anyway I will test it more to see what exactly happens there. If we discover any bug related to some Mac OS configuration in LWJGL and/or jME I will try to understand if I can fix it. Or if the authors can fix it for me. From the profiler shot I see that loading the circuit takes up 11 seconds. Even though that's by far the largest piece of geometry I'll check if something is taking up an unreasonable amount of time there. Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
Ender
|
 |
« Reply #14 on: January 09, 2008, 03:37:43 am » |
|
I tested the Mac Bundle. And I got the same problems. I made just one more test. I tried to invert the direction I run through the track. This confirmed that there is some computation triggered only if I point the car towards inner side of the track "ring". The 1st and 2nd images shows again the limit-orientation (this time I tried remain in the track lane, to see if the bump map could cause the problem, but it do not). Beyond the limit-orientation something is triggered. The 3rd image shows as the same situation is reproduced if I reverse direction. Outer side of the track ring is safe, while inner side triggers the problem. There is an exception to this. In the 4th image you can see a circle I drew (green angles are safe, orange are buggy) just before the 3rd curve, where "trees wall" is closer to the inner side of the track. There there is a little "umbrella" zone if I stay close to the "trees wall". I was thinking of something related to the Sun flare or some other lights issue. I will investigate also in the jME and LWJGL code...
|
|
|
|
|
Logged
|
|
|
|
|