[Bf-committers] Gameengine - ODE and Python

Kester Maddock bf-committers@blender.org
Tue, 5 Aug 2003 23:18:13 +1200


Hi all,

Progress report:

I gave up on the gamekit games - in ODE, objects are solid, whereas in SOLID, 
objects are hollow.  eg if you are trying to use a cube as a room, anything 
you put in the room will be ejected, at high speed.  That means, to use the 
game engine you need polygon collisions. :)

So I wrote those.  The mesh collision code is different between SOLID & ODE, 
in SOLID you send the vertices OpenGL glVertex style, while ODE uses 
glVertexPointer style.  Currently, I'm extracting them from the mesh class 
and creating my own vertex arrays, but this could be rolled into the mesh 
class and also used to fuel GL vertex arrays.
Currently, only sphere - mesh collisions work, but they appear to work pretty 
well.
So, back to the game kit.  I am using the bounding box type in edit buttons to 
define collision geometry - currently box, sphere or polyhedra. To get 
existing games to work, you need to set a lot of objects to polyhedra, and 
set ODE as the physics engine in world buttons.
Also, you need to watch polygon normals.  The collision restitution happens 
along the normal, so if it's backwards, it doesn't work too good.

On performance:  according to the debug properties, I'm spending 50% of my 
time in 'overhead.'  The major performance killer here is mipmaps - turning 
them off helps quite a bit.
Some performance stats (Ctrl-Alt-T):
Under Valgrind:
	2924
	6509
Software Rendering
	316
	865
Accelerated:
	35
	88

With respect to viewport culling:  I think it would be easier to attach a 
collision sensor to the camera, and record every object that collides with 
it.  Then you just step through and render.  Since ODE has no cone geometric 
primitive, you could do a proof of concept using a cube or cylinder as the 
culling object, or write a cone primitive. :)  A cone primitive needs to be 
written anyway, to deal with the radar sensor.

A couple of other ideas:

It would be possible to build a scenegraph from the parent relationship.  This 
could be used to cull objects from the collision candidates and the view 
candidates.

It would be good for Blender to be able to more accurately define the 
collision primitives, eg for armatures.  This would be cheaper for most 
things than a full triangle mesh, and accurate enough for a game world.  Hey, 
wait, there is already a bone deformation distance, and weight.  Maybe I 
could use those. :) It would also be good if the joints between armature 
bones could be specified, that way elbows would always bend the right way 
etc.  They could also model eg the suspension in a car etc.

Later for now.

Kester

On Tue, 29 Jul 2003 11:20, Kester Maddock wrote:
> Did anyone try to compile this?  I think I missed a file. ;)
> http://mysite.reblended.com/alien-xmp/bl-game-patch.tar.gz (124k)
>
> OdeSensors.* go in source/gameengine/Physics/BlOde
> KX_ICollisionSensor.h goes in source/gameengine/Ketsji
> patch -p0 < path/to/bl-game.patch
> in source/gameengine and
> patch -p0 < path/to/bl-game-soundsystem.patch
> in intern/SoundSystem.
>
> Today I tried running the Blender Gamekit through it.  Segfaults all over
> the place :)  Currently, physics are not generated for objects without
> actor in gameproperties enabled.  If you add a collision sensor to an
> object without actor, blender will crash.
>
> I fixed this hopefully in my local tree - games tend to crash in the render
> code now.  I'll look closer at this on the weekend.
>
> Kester
>
> On Tue, 29 Jul 2003 12:17, Kester Maddock wrote:
> > Here is what I've got so far:
> > http://mysite.reblended.com/alien-xmp/bl-game-patch.tar.gz (124k)
> >
> > The tarball contains two new source files, two patches and my testing
> > .blends.
> >
> > The OdeSensors.* files go in source/gameengine/Physics/BlOde - cvs isn't
> > picking up new files and I have to get up for work tomorrow :(
> >
> > Good Luck!
> >
> > Kester
> >
> > On Mon, 28 Jul 2003 11:32, Alexander Ewering wrote:
> > > Hi Kester,
> > >
> > > could you hand me the files you modified in your tree?
> > >
> > > It would certainly be more interesting to continue with
> > > what you've achieved so far :)
> > >
> > > | alexander ewering           instinctive new media
> > > | ae@instinctive.de       http://www.instinctive.de
> > > |
> > > | fon: +49-2393-220558         fax: +49-2393-220559
> > >
> > > _______________________________________________
> > > Bf-committers mailing list
> > > Bf-committers@blender.org
> > > http://www.blender.org/mailman/listinfo/bf-committers
> >
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers@blender.org
> > http://www.blender.org/mailman/listinfo/bf-committers
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers@blender.org
> http://www.blender.org/mailman/listinfo/bf-committers