PDA

View Full Version : Game Blender 2.42 Vehicle Simulation preview



erwin
31-Jan-06, 18:41
Bullet physics is still early stages. Here is the first preview for upcoming vehicle support.
After vehicles, character control will follow.
Next to bugfixes and performance improvements, those are the plans for the Game Engine physics.

http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=vehicle_fun.zip

(previous runtime: http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=vehicletest.zip)


Can we gather some blend files/links with game-engine friendly (and GLSL?) car models and tracks/environments to drive around?

Basically Chassis + 4 wheels.

Thanks,
Erwin Coumans

z3r0 d
31-Jan-06, 21:36
Can we gather some blend files/links with game-engine friendly (and GLSL?) car models and tracks/environments to drive around?
it doesn't look pretty, but talk to ton about the driving demo in the gamekit

I'll see can I put something together.



Umm, are you not doing any torque to try to prevent the vehicle from rolling in turns? is this in cvs to play with?


cvs server: Updating source/gameengine/Physics/common
P source/gameengine/Physics/common/PHY_DynamicTypes.h
P source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
U source/gameengine/Physics/common/PHY_IVehicle.cpp
U source/gameengine/Physics/common/PHY_IVehicle.h
sure looks like it...

should I extract the python code from your exe?
[darn, can't compile because of openexr... I'll play with this later]

ZanQdo
01-Feb-06, 00:42
Cool, Gran Turismo in Blender! XD Ha realy good erwin thank you, runs very well for me! XD

scabootssca
01-Feb-06, 01:38
the demo runs well but is the car supposted to flip over that easily?
and you want car models?

OTO
01-Feb-06, 01:45
Hello

here's one model if you want:

http://otothecleaner.free.fr/downloads/tt.jpg

http://otothecleaner.free.fr/downloads/tt-model.blend

Bye

JD-multi
01-Feb-06, 06:07
A really cool car physics demo. Indeed a lot better then the sumo physics in the old game engine. Although I checked out the console when running the test. And it was printing something about instability or something when the cars turns on his side.
Also I saw afther a few times running the demo, that the wheels were stuck in the ground or in the body of the vehicle itself, but that might be the problem of the test, it's more made to show what it actually does.

It's indeed awesome. Keep the good work up Erwin, it's great. :D

LetterRip
01-Feb-06, 06:43
lots of fun erwin,

thanks for the demo.

LetterRip

jrt
01-Feb-06, 08:18
Loved the demo erwin. This is going to make such a difference to way Blender games play. Thanks for all your work.

jrt.

Al_Capone
01-Feb-06, 08:31
Yes, great example, but it does flip over too easy, perhaps a little more damping ? Will bullet also be able to do softbody collision as well ?

iconjunky
01-Feb-06, 08:40
What jrt said. :)

goldentaiji
01-Feb-06, 08:58
Really nice car physics. Hmm... remember GertWheels? http://www.elysiun.com/forum/viewtopic.php?t=348&highlight=gertwheels Faked car physics, but that one looked really nice. There was a newer .blend around someplace.

:D Great work Erwin. Hehe, great physics possibilities is what makes a game good.

Jason Lin

bigkahuna
01-Feb-06, 13:08
Great demo! Can't wait to see this integrated into Blender!

scabootssca
01-Feb-06, 13:11
heres a car i made

Lamborghini (http://www.freewebs.com/scabootssca/Files/Lamborghini%20Diablo.blend)

you likie

erwin
01-Feb-06, 17:40
still very preliminary but, here is some more vehicle fun:


http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=vehicle_fun.zip

Koba
01-Feb-06, 18:59
erwin,

This looks really cool for the gameblender people out there.

Seeing you are the man behind bullet in Blender, could you tell me why bullet sends objects flying apart (if close but not touching) if they are anything other than perfect boxes?

I know this is slightly off topic but you are the man to ask and collision detection is pretty important for both games and physics simulation for animation.

Other than that, the demo is pretty fun.

Thanks.

erwin
01-Feb-06, 19:34
Bullet shapes are static mesh, sphere, box, convex hull, cylinder, cone.
Most of those shapes have a default extra collision margin.

Some cases:
A its a bug
B they start off too close (either closer then the margins or penetrating.)
C) some heavy object puts them into penetration (which results in explosion). The car is heavy, this easily results in penetration.

There are definately still bugs, but a lot of non-box cases work fine.
I haven't seen problems with sphere-sphere for example :)

Can you give some specific easy to reproduce examples (not in category 3)?

Please report all such Bullet / Blender bugs here:
http://www.continuousphysics.com/Bullet/phpBB2/viewforum.php?f=11

Erwin

Koba
02-Feb-06, 03:04
Thanks for the reply,

Here is an example of simple low mass objects, outside of each others bounds and not penetrating to begin with (even though rather close to each other). Sphere's work fine and perfect boxes do too...but these aren't very complex shapes either.

I realise I haven't assigned any dynamic materials - mainly because I experimented with the settings and it never seemed to help.

Here is the file,

http://users.ox.ac.uk/~scat2889/physics.blend

As you can see, they explode initially (I expected them to fall straight down under gravity) and their subsequent motion is also rather strange. I would be really happy if you could get this working for me - I am trying to make a glass shattering animation.

Thanks again,

Koba

erwin
02-Feb-06, 10:21
1) first of all, there was ipo data on the dynamic objects, need to be removed.
2) the centers need to be inside each objects:
select all -> menu Transform -> Center New
3) convex hull object need to keep a distance. I'll try to fix this for later release, but this is tricky.
One fix is to add an extra duplicate mesh, that is bigger, and with all faces switched off collision detection. So a graphics mesh which is bigger.

See a working version here (with gaps):
http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=physics1.blend

Koba
02-Feb-06, 11:43
Thanks for your help.

I missed point 1) - the IPO was some remnant of previous fiddling. As for point 2) about the object centers, I had tried it and gotten a mess for some reason. As for point 3), the gaps have become too large for what I wanted. I'm not quite sure I understand your fix but I won't bother you anymore with my off-topic problems. :|

I think I'll fiddle a bit more then give up.

Thanks again,

Koba

erwin
02-Feb-06, 14:41
I'll try to give you a gap-free blender version within 1 week!
Do you use windows?
Will you make some nice glass breaking demo ?

(Basically 2 steps in solving this: adjust the tolerance to be smaller, and then move the tolerance to be 'internal', rather then outside of the object.)

Koba
02-Feb-06, 14:57
Great!

I came up with an idea of having a wine glass get shattered realistically in slow motion by a bullet (no pun intended). I've figured out how to get a mesh such as a glass into loads of solid interlocking crystals. Using various shader tricks, I think I've figured out how to make the actual cracks in the glass propagate (in slow motion) before your very eyes. If it all works, I was then going to fill the wine glass with wine and use the fluid sim.

Essentially, this was to be a sort of ultimate tech demo of Blender physics - bullet interacting with glass, glass fragments interacting with each other, bullet interacting with wine and wine interacting with glass fragments - all
in slow motion.

I was hoping to show off Blender's fluid sim, physics engine (baked to IPO) and rendering capabilities in a short animation.

So if you can show me how to make gap free version in a reliable manner - I'll push ahead and get animating. :D

I'm using Windows but have access to Linux if needs be. Thanks for putting your time into this (though I am sure it is for the benefit of all!)

Koba

LetterRip
02-Feb-06, 15:04
koba,

for the fluid part - I suspect you'd need to wait for Nils to commit his animated obstacle patch for it to work right. Or are you thinking to bake the physics and then import the baked blend into his fluids testing build.

LetterRip

Koba
02-Feb-06, 15:11
Or are you thinking to bake the physics and then import the baked blend into his fluids testing build.

Exactly that. :D

Koba

LetterRip
02-Feb-06, 15:25
Okay that will probably give you similar results, to the integrated - a point though is that neither method will likely give you realistic results since the bullet and the glass won't be interacting with the fluid. In reality the pressure from the fluid would prevent the glass particles from going towards the glass center significantly probably forcing the glass particles sideways and outward.

Also I would think the bullet forcing its way through the water would force fluid to escape faster thus resulting in fluid being displace upward and forcing an exit through the already shattered glass.

We probably need to come up with a good way for objects, particles etc. to transfer their properties between each other. See this paper for one approach

http://www.cs.tamu.edu/academics/tr/tamu-cs-tr-2005-1-1

LetterRip

LetterRip
02-Feb-06, 15:31
Upon checking slow mo collisions,

http://www.highspeedimaging.com/slow_motion_video_archive.cfm

it would appear that a collision would likely completely shatter the glass with significant momentum transfer before the water could escape...

LetterRip

strangeland
02-Feb-06, 15:48
This link may be useful:
http://elysiun.com/forum/posting.php?mode=newtopic&f=6
;)

erwin
02-Feb-06, 16:17
hey, wait. you are spoiling the vehicle thread with general physics for rendering :-)

Back to vehicles, I need some nice GLSL shaded models, and interesting environments to drive around ! Can someone help ?

http://www.continuousphysics.com/ftp/pub/test/index.php?dir=blender/&file=vehicle_fun.zip

Koba
02-Feb-06, 18:08
My little question seems to have taken a life of its own.. :|

In my defence, I did try to stop going off-topic quite a few posts back.

Anyway, I've started a new topic here:

http://elysiun.com/forum/viewtopic.php?p=558057#558057

I've answered LetterRip's comments there and thanks again erwin!

So...back to vehicles... :D

Koba

pildanovak
03-Feb-06, 04:43
I'm willing to help, started to work on some car
plant.ffa.vutbr.cz/~novak/dwnflz/car01.jpg
I already tried to hack a car somehow with constraints, so this is good news :)

pildanovak
03-Feb-06, 14:02
made some progress since the morning(replaced the original image), but cannot get over 1 bug - pieces of terrain which have the coordinates not 0,0,0(or near to that) have wrong collision - the cars wheels fall through, although the car itself not...

erwin
03-Feb-06, 14:43
will look into this, probably some bug.

pildanovak
03-Feb-06, 15:16
erwin, here's the file by now. The car could use some texturing, and the physics a lot of tuning. I've done a level from tiles I've done 1 year ago for anoter project(dynamic generated landscapes). feel free to use it as a demo, and I would be happy if you could help with physics.
The terrain is now merged, but orriginaly was completely made of tiles(which could be faster?), but there was that bug which i wrote about...

there are no shader by now, my attemts with them weren't much succesfull, But I would like to make the car look better...

http://plant.ffa.vutbr.cz/~novak/dwnflz/baked.blend

http://plant.ffa.vutbr.cz/~novak/dwnflz/car01.jpg

erwin
03-Feb-06, 16:37
The city and car look great!

But drivability of the environment needs some work... :)
Vehicles need a lot of room for driving. Check out San Andreas Need for Speed. Cities need wide roads, Race tracks are long with very few sharp turns. Also curbs make life difficult for navigating at the moment, so they need to be much lower probably.

Is it possible to make the curbs much lower, and the streets much wider, and less 90 degree turns? The current environment is more for a slow walk, rather then fast vehicle action :)

The ability to tune physic will be added, but it this only works if above points are in place.

Thanks for all the effort!
Erwin

Rangel
03-Feb-06, 16:47
Very good work, Erwin! Thank you a lot for this great effort to improve Blenderīs game engine.

Iīm really looking foward to put this behaviour to work on my Brasilia 3D project. Iīm only waiting for Blender to get a more robust way of dealing with large quantity of objects, culling and LOD.

pildanovak
03-Feb-06, 17:20
In fact, these tiles were originally designed for a slow walk :), it was all made for an RPG game. I know there has been a racing project here, maybe someone else can do the track, because I won't probably have the time now to make a completely new track. But I hope to finish the car tomorrow.

ChicOrtiz
03-Feb-06, 17:28
:-| Looks like erwin have chalenged us guys!
That's awesome!

What we are going to do now? I guess we have the following tasks over here:

Geometry:

-Smooth and large tracks (maybe it is better to make it low poly)
- "High" poly cars.


Textures:

-LSCM uv mapping
-Glsl shaders

For me, "the guys" fast enough for this job are TorQ, Oto and Doc Holyday. I can work as a slave buying potato chips and sending it via email or whatever you need to. (Maybe i can also steal a bank for you or something...).

-Doc: maybe you could send your "dream car packed" to erwin and make your gorgeous tiles and level design for him.

-Oto: you can help Doc whith texturing and send some "extra" cars. (Those from your tuts)

-TorQ: please don't leave us alone and teach how to use all this FREAKING $#@^$^4 GLSL shaders and materials. And your geometry ROCKS!

Also Rangel! Brasilia is a nice city for speed cars!

Ok,

This are some of our masters. Just talking about geometry and tex not to mention all the python thing. They have a lot of things ready, i guess the longest task are to make track stuff if this guys agree to share their work. Google earth will help us here for level design...

BTW this are only sugestions! Don't take this post as a "boss thing" or something ok? ;)

erwin
03-Feb-06, 18:20
more FUN then Challenge I hope...

I hope you can come up with some fun vehicles, and fun to drive environments.

ChicOrtiz
03-Feb-06, 18:29
more FUN then Challenge I hope...

I hope you can come up with some fun vehicles, and fun to drive environments.

Hey everibody! Do you Remember this one? http://www.the-underdogs.org/game.php?id=2162

Imagine something like that whith bullet physics!

Doc Holiday
04-Feb-06, 03:26
Hehe! You read my Thoughts. :D
I'm on the Way. :D Currently i do some cleanup to my DreamCar Model. First Tests work well with it.

JD-multi
04-Feb-06, 06:19
I've tried to play around with the car physics scripts. I modeled a Monstertruck and wanted to see if it could drive over high things, crash cars and such, but I came up with a several problems before I got that far.

The monster truck is high on his wheels and that's the first problem I got. I found out how to raise it higher on his wheels, but not to lower it a little (1 unit)
Also I found out that when you drive from face to another face, the truck got stuck on the edge of those faces. It drive and suddenly Boem got stuck, but when you drive backwards and try again, no problem.
The last big problem I got was, when I drove over the hill, it got stuck on the edge before it went down. And when it went down, the wheels stay on there position but the car itself rotates forwards and gets up side down as well that the wheel when going up the slope, don't align anymore with the place they should be.

I'm not sure if I have to set that in the scripts, but I couldn't figure it out.
I also found some more problem, like the place where the car got drop in the game, return to that when you have drove around and you'll see that the cars stops moving when you're on the same place as where is started, like it got stuck against a invisible something. The wheels refuse to rotate sometimes, no idea how to fix that.

The reason why I made this test was basicly to help finding problem, but I'm not sure if these are problems which I made or problems I can't change.

Anyways here is the blend file: http://86.82.211.33/blender/blender_problems/monstertruck.blend
Feel free to play around with it, I found it relly fun to drive around that little plane, but when yuo drive forwards/backwards in sideview, you'll see those problems.
Btw Erwin, the scripts are really cool, thanks for your support doing all this. :P

Doc Holiday
04-Feb-06, 07:45
I did some fixings to that horrifying steering of the Cars. The Vehicle Script is always running, so i did the fixings there.
Just add this Code directly behind the else: Command. (Line 51)
# steering
# ~~~~~~~~
MaxSteer = 0.6 # in left and right
SteerStep = 0.06 # steer faster with higher Values
KeyR = cont.getSensor("R").isPositive() # Name of the right Key Sensor
KeyL = cont.getSensor("L").isPositive() # Name of the left Key Sensor

if KeyR:
if chassis.steer > -MaxSteer: chassis.steer -= SteerStep
else: chassis.steer = -MaxSteer

if KeyL:
if chassis.steer < MaxSteer&#58; chassis.steer += SteerStep
else&#58; chassis.steer = MaxSteer

if chassis.steer and not KeyR|KeyL&#58;
if abs&#40;chassis.steer&#41; < SteerStep&#58; chassis.steer = 0.0
else&#58;
if chassis.steer > 0&#58; chassis.steer -= SteerStep
else&#58; chassis.steer += SteerStep
Now connect the Left and right Keyboard Sensor directly to the Scipt. (You can disable the PulseModes for this Sensor and delete the connected LogicBricks.) At last, rename the Sensors to "R"/"L", or change them in the Script. (new Lines 56/57). Thats it.

Now, Your front Wheels have a rotation constraint and they come back to middle Position at releasing the Keys. You can adjust this Settings in the new Script Lines 54/55.


@JD-multi
Nice Truck! :D I think the scaled Empty (or what ever it is), Your Truck is connected to, is the Problem. I don't think these Empty-Construct is necessary. There is a attachHeightLocal Attribut in Line 20. Maybe this helps, but i don't know.
But there is still the Problem if the Wheels stuck in the Chassis.

Keep on! I wanna see Carmageddon 4 made in Blender! :D
Doc

pildanovak
04-Feb-06, 08:49
doc - in fact, I made the same changes to the code yesterday in my file. But maybe if you have experience with this, you could add also some break?

Doc Holiday
04-Feb-06, 12:47
:o I didn't see your File above, i swear! But now i did. You've gone an other Way to do this. And i've to say, Your's is much smoother and more elegant solved as mine. %| It took some Minutes to find out what you did. Very clever! :D

Doc

bigkahuna
04-Feb-06, 22:45
Is it possible to adapt "bullet" physics to a boat simulator?

Doc Holiday
05-Feb-06, 09:26
There is a Breaking-Function in the Vehicle-Object.
I've connected a KeyBd Sensor named "Spc" with the Script and addet this Lines:
HandBr = cont.getSensor&#40;"Spc"&#41;
if HandBr.isPositive&#40;&#41;&#58;
vehicle.applyBraking&#40;100.0,2&#41;
vehicle.applyBraking&#40;100.0,3&#41;
This should apply a Break to Wheel 2 and 3, i think. But maybe i don't use it right, or it is not working now. (Or it's something completely Different! :D)

@JD-multi
The Setting suspensionRestLength seems to have also influence of the Car-Hight. But i dont know what the Difference between this and attachHeightLocal.
Doc

erwin
05-Feb-06, 23:33
A monster truck can be best made using real hinge-constraint wheels. However those are not included in Bullet yet. Reason is that monster trucks typically rely on very detailed (high quality) wheel-collision detection.

The new raycast-vehicle simulation is best suited for vehicles with not too many collisions. Preferably NOT driving over other dynamic objects. Raycast vehicles work best for regular vehicles like cars in San Andreas and Need for Speed. The actual wheel collision detection is simplified into a ray (for several reasons outside the scope here).

Hope this helps. I'll try to add hinge constraint (better then 2 seperate point to point constraints) and its application to a monster truck demo soon ;-)

Erwin

Doc Holiday
06-Feb-06, 09:50
@erwin
Can You say something about the Braking i've tried? Did i do it right?

BtW:
All Vehicles have the same Problem. They act like ToyCars. Because the Speed has no Influence to the Steering. As more Speed, as harder the Steering has to go.

The Speed can be calculated with Python, right, but i hope the Bullet Engine can do this faster. Maybe: with vehicle.getLocalSpeed(), or something? :D Do You think this is possible?

Other Question:
Has the Polycount of an Object Influence of it's Physics-Calculation if Bounding is set to Box or Shere? If so, would it be better, to use an VeryLowPoly Model as Collision-Box and use it as Parent to the HighPoly Model? Can you give me a Hint here?

Thanks, Doc

OTO
06-Feb-06, 10:48
Hi

while the "gurus" are working cool in the scripts and stuff
me I'm in the outside, perspiring, building a level, with my little hands.....
As the BOSS have ORDERED!! :)

http://otothecleaner.free.fr/downloads/LisboaGTR-screenshot.jpg

Return to the job... but I lack potatos...where's the damn servant??

erwin
06-Feb-06, 20:45
Doc: good idea: I will add a 'getLocalSpeed' to the vehicle.

As long as the objects bounds is set to 'box', it doesn't matter how many triangles the graphics mesh has. For 'convex' it does.
Some more options will be added to allow for more 'smooth' collisions, as well as suspension control, and wheel sizes.

ineedanewbi
06-Feb-06, 23:34
hey,

you can get a local velocity script here, very easy to use

http://www.geocities.com/ineedanewbike/LocVel.zip

i'm currently making a race game starting file too, using sumo physics though

http://www.geocities.com/ineedanewbike/race3/race3SS.jpg

Doc Holiday
07-Feb-06, 13:20
Yo erwin. That are great News. Thank You! :D

@OTO
That's a nice Duck! This a 2CV right? Looks great. Is it also swinging as the real Cars? :D

@ineedanewbi
Thanks for the Script. That does exactly what i need. I think it do the right Job in the meanwhile.

Doc

blenderage
07-Feb-06, 16:33
Ive got a low poly version of my avatar lamborghini, its untextured so someone would have to skin it. (Id do it myself but im short of time). But if you want it let me know.

http://img.photobucket.com/albums/v224/elbazo/car2.jpg

http://img.photobucket.com/albums/v224/elbazo/car1.jpg

Good luck on getting all this to work, i cant wait to see the glut super cool racing games that will shurley follow.

Doc Holiday
07-Feb-06, 20:03
Ok, here's my 1957 Chevy. :D The Mesh still needs some Fixings. The Reflections are just simple RevMaps. Maybe this will be replaced with some Shader Stuff. It's a high Poly Model with ca. 5500 Tri-Faces. Running soft an smooth. (And purr like a Pussycat!) ;)
http://www.neewo.de/Misc/Bullet_Chevy1.jpg
Doc

Ps. Does anybody else have the Problem with to inside flipped Wheels?

OTO
08-Feb-06, 01:01
Woahhh Doc

you'll look like the Mob Boss :)
Great
But I'm sure that my 2CV with it's gigantic 26 hp will "eat"
easily your fat 5500 ?? polys

pildanovak
08-Feb-06, 08:13
I finished my car, the same link like before. It uses standard blender materials, and there's a problem with light - the faces don't get lit at all.

http://plant.ffa.vutbr.cz/~novak/dwnflz/baked.blend

I also added splitscreen to this file, and the cars can shoot, which crashes the build :)

There's also a start of another track, but what i have to say, I really don't have time for making a good track, so it will be good if someone else does it...

Erwin, take the model and use it, if you want.

blenderage
08-Feb-06, 15:42
Nice chevy Doc! You've upped the ante with that, so i decided to find time to texture my lambo


http://img.photobucket.com/albums/v224/elbazo/lambolow.jpg

If anyone wants this just pm me with your email. Ive got hi res versions of a new mini and a porsche 911 that i might get round to doing.

JD-multi
08-Feb-06, 16:35
Whoow, some amazing car models here. I'm really curious how that vehicle demo turns out. :D

NeOmega
15-Feb-06, 15:52
hey, wait. you are spoiling the vehicle thread with general physics for rendering :-)

Back to vehicles, I need some nice GLSL shaded models, and interesting environments to drive around ! Can someone help ?

What does this mean? If you want a tangent space normal mapped model, I can get you one in 4 days (it would be a futuristic supply truck though) .... if you mean you want a model with shading baked into it... I can do that too.

Danny
16-Feb-06, 09:44
I am currently thinking to make a speedboat racing game. is it possible to use vehicle physics on 2.42 for that? Like making the wheels transparent? As it is "vehicle physics" not "auto physics" maybe boat physics could be included, if it isnt already.

Regards,
-Daniel

Fred_Pyo
18-Feb-06, 21:18
A simple question, what's the poly limit you recommend, for vehicles AND for tracks?

slyfox249
18-Feb-06, 22:54
im working on a racing game project for school. Me and the teacher cant figure out how to get the car to act right could or do you know anyone that did this that could help me