View Full Version : Physics test

04-11-2003, 11:52 PM
I've just started playing around with ODE and I've made the usual 'car on terrain' demo.

Could you please try it and tell me if it works for you and what sort of performance you get?

Download dgdevtest (http://terraqueous.f2o.org/downloads/dgdevtest.zip) and give it a try.

I'm using Windows 2000 and Delphi 6 with a Geforce2 mx and an AthlonXP 2000. If you are using a slower machine than me, you might have some problems with the physics stuff!!

When you run the demo you will get a blank screen (a nice blue blank screen) for at least a few seconds. Just bear with it, the demo will start *eventually* :)

Stats (fps etc.) are in the title bar of the window ;)

05-11-2003, 03:41 AM
Cannot run as OpenGL32.dll not found

Win XP, as installed no additional driveres etc installed.

05-11-2003, 05:46 AM
I get a motor.wav not found message with a strange path and get stuck on the blue screen (without any cpu load so no loading in progress).

05-11-2003, 08:15 AM
Well, like Paulius said the path to motor.wav is a bit of a problem, which you might want to fix in the next version. But otherwise this sure does look pretty sweet. I got 14fps on my machine at work (2,4mhz 512 mb and a radeon 7500)

The driving is pretty neat. A couple odd things I found:
:arrow: When the car flips over, the stearingwheels are suddenly at the back. And unless I flip the car again, I can't seem to turn the car.
:arrow: At some point and without changing the gravity or other things, I was able to lift off and take my car to the moon, using one the hills as a ramp.
:arrow: While writing this, I had the demo still running. When I returned to the demo again, my car was floating in the sky. It seems the demo is still responding to the keyboard, even though it doesn't have focus.

looking forward to the next update

05-11-2003, 08:51 AM
Oh dear, I never seem to notice the obvious things :(

Thanks for taking the time to download it.

cairnswm: The opengl32.dll problem is strange. It's in my system32 folder and AFAIK is installed with the video card drivers. Sorry it doesn't work for you.

Paulius: I can't believe I didn't notice that stupid path :lol: I'd forgotten that it even needs that file. The engine sound is not great at the moment, I've only spent about 30 minutes on it and most of that was downloading and installing OpenAL!

Traveler: Nice to see you got it working.

The problem you had with the steering wheels is really to do with the camera. It moves to the opposite end of the car when it flips over. I did this because it lets you see where you're going when it's upside down!! And it is hard to steer an upside down car, try it in a real one :twisted: Actually, lowering the suspension should bring the wheels nearer the ground but that's cheating really.

Why you went to the moon I don't know, but it's probably to do with the timestep of the physics updates. The rendering speed won't affect the physics up to a point. The physics is actually being updated while the quadtree is rendering but even then if rendering slows down too much it loses some precision and starts over compensating (which launches you moonwards). It's much more fun when you get more than 30fps (it's actually limited to 33fps anyway).

And I have to admit the keyboard input is a pretty poor effort. I've been using 99% of my brain's cpu to work with matrix math and physics so that bit of code has been neglected a little.

I'll upload a new version ASAP with some fixes. Let you know when it's ready, until then the link won't work.


05-11-2003, 09:31 AM
OK I've (hopefully) fixed all those problems and you can get the new version from the same place (dgdevtest.zip (http://terraqueous.f2o.org/downloads/dgdevtest.zip)).

05-11-2003, 12:44 PM
First of the program can't seem to find OpenAL32.dll so I had to add it manually. :(

First time I started the demo the car just jumped up in the sky and didn't want to come down... :shock:

Otherwise I get 5 fps on a Win98, 800MHz, 256 Mb Ram, TNT2 with a resolution at 1280x1024x32 and 8 fps with a 800x600x16 resolution.

05-11-2003, 03:41 PM
I get 33FPS even on 1600x1200 with my 1.4GHz thunderbird and GeForce4 TI4200

05-11-2003, 10:20 PM
i get openal errors :P

have you got it at fixed frame rate or frame rate indipendant? (my racing sim is using ode too :))

06-11-2003, 02:01 PM
p4 2.0ghz & GeForce4 MX (my Gfx card sucks) .

Near constant 33 fps & physic update rate of +300/s at resolution at 1024x768x32

~20fps & physic update rate of +160/s at resolution at 1600x1200x32

Its still way to damn easy to flip the stupid thing onto its back.

06-11-2003, 02:53 PM
Sorry about the openal error. My fault again :oops:

I've put a copy of openal32.dll here (http://terraqueous.f2o.org/downloads/openal32.dll) and it's in the main zip file now too.

dUmAsS: I'm limiting the fps so that I can use more cpu time on the physics updates. Can you tell me how you've implemented suspension, steering etc. My car has 11 bodies and 10 joints, an F1 car must be pretty difficult to simulate :?:

It is easy to flip the car but the only way I've managed to make it stable is to make the centre of gravity impossibly low (so far below the car it's under the ground!) and this, unsurprisingly, gives you the effect of a weight 'swinging' from the car. It keeps the car upright but I've gone to the trouble of simulating real physics, I'd rather not make it artificially less realistic. If you change the suspension height/power and the ground friction levels you get different car handling. Like in the real world, if a car keeps falling over you make a better car, you don't have the option of changing the laws of physics :)

Thanks to everyone for testing, the frame rate shouldn't affect the physics quite so much now as I'm using a larger timestep.

06-11-2003, 03:50 PM
im not using ode to simulate the suspension in the f1 car (basicly because it hardly moves :P)

i use ode physics for soft suspension. try changing the slip of the tires

i just use 4 hinge 2 joints for suspension and sphears for tires and 1 box for the chassis.

have you got the bendy wheel problem yet?

06-11-2003, 05:25 PM
p4 2.0 ghz and Geforce4Ti4400: ~30 fps @ 1280@1024@32 (with mcafee and firewall running).
Pretty cool thing. I've also tried to implement DelphiODE a few weeks ago into a small sample but I stopped it after some hours because it was too complicated for me (okay, maybe I wasn't motivated).
May you post the source code or a quick tutorial? :)

06-11-2003, 06:34 PM
dUmAsS: I guess you're using a hinge2 joint? I did get the bendy wheel problem with those joints especially when using CFM to set suspension 'softness'. Now I'm using (for the front wheels), a slider for the suspension springs (need damping!), a hinge for steering and a hinge for the wheel axis. There are small bodies between each of these joints, I've used small boxes with low density just to connect them.

It works nicely but does stress the CPU with more than one car and large timesteps just make it all go crazy :P

Snape: Thanks for the results. I asked for the fps to see at what level it starts to drop below 30fps, it won't go much faster than that on any machine because I've limited the rendering. I know exactly what you mean about ODE being complicated, one of the hardest things was extracting a body's matrix and converting to use in glMultMatrix, not nice. OK if you're a mathematical genius, or if you at least know one!!! Unfortunately I'm not so I just stayed up late for a few nights until I stumbled across the solution through trial and error :lol:

The best way to get started is to play around with the demos and change them. I used the terrain demo and the buggy demo and combined some of the code to work with my terrain engine.

I have been thinking about writing a tutorial and will whenever I have the time (if ever :? ).

The only thing I have trouble with now is updating the physics at 150+ updates per second while rendering several hundred thousand triangles at an acceptable rate. OK if you have a high enough spec but below a certain speed it seems that what I'm trying to do just isn't practical. I only have a Geforce2 mx though, hardly the latest thing ;)

I'm working on turning this into a game now and will just have to decide on the minimum requirements to run it. Hopefully I won't exclude too many people.

Harry Hunt
06-11-2003, 07:11 PM
Athlon 1 GHz, Radeon 9000 Pro 128 MB here....
I get 24 FPS most of the time.

Looking pretty good. Kinda hard to play but then again you wouldn't expect a smooth ride on that kind of terrain. Good job!

06-11-2003, 10:25 PM
Athlon 2800+, 512mb RAM, GeForce FX5800 and I only manage 18-19 fps at 1024x768x32 (Desktop Resolution). I'm pretty sure it can do better than that. Any ideas what's wrong?

07-11-2003, 01:10 AM
dUmAsS: I guess you're using a hinge2 joint? I did get the bendy wheel problem with those joints especially when using CFM to set suspension 'softness'. Now I'm using (for the front wheels), a slider for the suspension springs (need damping!), a hinge for steering and a hinge for the wheel axis. There are small bodies between each of these joints, I've used small boxes with low density just to connect them.

It works nicely but does stress the CPU with more than one car and large timesteps just make it all go crazy :P

yeah, but thats no option for me. with maximum 54 cars on track at any 1 time (im making lemans not f1 :wink: )

you using tri collider?

10-11-2003, 01:59 PM
works now. but no sound (is tere ment to be).

ure physics work pretty well :)

10-11-2003, 10:13 PM
The sound is not so good at the moment, I've fixed some bugs so that it at least works.
You've probably got the version with the strangely rotating sky, that's fixed now too.

I've simplified the suspension a little now too and removed 2 bodies and 2 joints to speed things up.

I'm working on fixing the frame rate and physics update rate to work on slower machines. Will upload a new version when it's worth doing so :)

And no, I'm not using tri-colliders. Have a look at the 'terrain demo' that comes with DelphiODE. It uses a function to get the height of the terrain. I think it's one of those nice GLScene terrain thingies. I don't use GLScene so I've just modified the function to work with my engine.

Thanks for trying it again :)

11-11-2003, 12:29 AM
i went to the openal site and dled the openal installer. sound works.

nice engine :wink:

to unlock the physics from fps (so u could have 1 or 1000000000000 fps and physics the same :P) use the main program loop to do the gfx and set a tthread at interval 10 to do physics update :) thats how im doing it and running pretty well :)

11-11-2003, 10:44 AM

I didn't have much luck with threads so now I'm just using gettickcount to set up 2 timers, one for physics and one for rendering.

It's working quite well now.

There's a new version (http://terraqueous.f2o.org/downloads/dgdevtest2.zip) available now.

When you run it the view distance will be very close, it will then adjust itself according to your machine's speed and your resolution and color settings. It should give you about 33fps when it settles down :)

This should make it run quite nicely on slower systems, even if you can't see very far!

I'm very interested in how this runs for people who have had trouble with it so far.

Just for reference, on my PC I get a view distance of around 30000 most of the time. :P

Do you have a link to your project dUmAsS? I'd like to see your ODE in action 8)

11-11-2003, 03:50 PM
my "play test" is at sulaco (link at bottom of this page)

set ure center of grav lower to make it stop flipping :P

i get 32000 view distance. nice scenary :)

except the physics seem to be in fast forward mode :P slow down physic calculations ;) (thats to do with ure timings)

12-11-2003, 11:04 AM
Ok I've slowed down the physics a little and I'm trying to lower the centre of gravity.

Do you use a geomtransform? I'm not having much luck with it. Seems to mess up the collision detection of the car body.

12-11-2003, 12:53 PM
// chassis body
Body[0] := dBodyCreate (World);
dBodySetPosition (Body[0], 0-580, cSTARTZ+cWHEEL_OFFSET, Index*5.5-417);
dMassSetBox (M, 1, cWIDTH, cHEIGHT, cLENGTH);
dMassAdjust (M, cCMASS);
dBodySetMass (Body[0], M);
Box[0] := dCreateBox (nil, cWIDTH, cHEIGHT, cLENGTH);
dGeomSetBody (Box[0], Body[0]);

thats how mines done. doesnt have senter of gravity atm tho :roll:

14-11-2003, 09:32 AM
Thanks, I've used dmasstranslate to lower the centre of gravity. It's hard to balance it just right, too high and the car still falls over, too low and it kind of swings ;) Much better results than with geomtransforms though even though I'm pretty sure I read that they are the best way to do it.

You can get the latest versionhere (http://terraqueous.f2o.org/downloads/dgdevtest3.zip).

And now by holding down 'T' you can flip the car back over if it rolls :P

14-11-2003, 01:38 PM
what are ure results of putting it on flat ground and letting the wheels reach a rotational velocity of 100?

does it stay stable or bendy wheels? :D

14-11-2003, 01:48 PM
I don't really have any problems (yet), maybe that's because I'm using zero CFM on the hinge2 suspension!!!

I'm using a slider AND a hinge2 and it seems to work fine. Have you seen the wheels go bendy? :?

The only problem I do have is that if the car turns a corner really fast it pushes the 'outside' wheels towards the car and slightly into the car body. It's pretty obvious there's a strong sideways force but I'd hoped ODE would handle this better. It doesn't make the car any less driveable and will hopefully not be noticeable when I get a nice car model into the game.

What model format/loader do you use dUmAsS, that car looks nice :)

14-11-2003, 02:03 PM
the sideways force is what u call "g forces" lol :):)

mines converted from a gp4 car into pure opengl vertices lol

the only thing i have aproblem with in ure is the hills. there way too bumpy :)

14-11-2003, 02:09 PM
Yeah I know :)

The bumpiness is much worse when the car is accelerating. I'm checking my code now, might be a problem with the surface normal function.

I just tried taking the speed limiter off the car and managed a top speed of 386(mph?) before it finally flipped and crashed :twisted: At that speed it's hard to avoid mountains as they fly past, you just aim for a flat bit of the horizon :lol:

14-11-2003, 02:51 PM
i think the hills could be smoother if you decrease the space between checking the hight? depends how your doing it tho :)

and how come it takes about 20 seconds to load :shock:

12-12-2003, 06:12 AM
Can't check out your demo, having an access violation apon starting the application. The Error is as follows.

Access Violation at address XXX in module 'nvopenal.dll' Read of Adress 00000000.

I am using an NForce2 Chipset motherboard, an Abit NF7-S to be exact.
and for video I'm running a PNY GeForce4 Ti4400.


12-12-2003, 10:26 AM
Hi Thazul, welcome to DGDev!! :)

Thanks for trying it, I'm going to upload a newer version soon(ish) without OpenAL (which seems to be causing your problem). When I get a reliable demo with the graphics and physics working I'll go back to working on the sound :roll:


12-12-2003, 10:32 AM
can i have the demo now :) :P

12-12-2003, 12:04 PM
Hey dUmA.. err I mean tux, you can wait a couple more days, can't you? :twisted:

12-12-2003, 12:21 PM
Hey dUmA.. err I mean tux

lol :)

a couple of days wont kill me :P im so impatiant :)

12-12-2003, 04:34 PM
Until then here's some Screeny McScreenersons :salute:




12-12-2003, 05:42 PM

*runs off crying*

13-12-2003, 01:30 PM
Very nice, can't wait. :)


19-12-2003, 12:44 PM
its been days, weeks, even years since u said you were going to post a update :) :P