Speed vs. collision

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Speed vs. collision

Post by kohaar »

How come, that when I turn up the speed of my graphics card, I get stuck in my level?

If i turn it down, and the game runs at about 50 fps, everything works (somewhat) fine, however if I turn it up and run at about 140 fps, i get stuck almost everywhere?


This is the parts having to do with collision. If anyone has a better method of doing this, please let me know.

Code: Select all

 // Load Ground mesh
    groundmesh = GameMain::getSceneManager()->getMesh("./GameData/Ground/ground.b3d");
	groundnode = CGameMain::getSceneManager()->addOctTreeSceneNode(groundmesh,0,-1,256,false);
	groundnode->setMaterialFlag(video::EMF_LIGHTING, true);
	groundnode->setMaterialFlag(video::EMF_GOURAUD_SHADING, true);

// Add Triangle selector
	selector = CGameMain::getSceneManager()->createOctTreeTriangleSelector(CEnvironment::getGroundMesh()->getMesh(0), CEnvironment::getGroundNode(), 256);
	CEnvironment::getGroundNode()->setTriangleSelector(selector);
	triselector->addTriangleSelector(selector);
	selector->drop();

// Add Collision Responce Animator
	scene::ISceneNodeAnimator* anim = CGameMain::getSceneManager()->createCollisionResponseAnimator(triselector, 
		camera,vector3df(50,80,50),vector3df(0,-0.9f,0),vector3df(0,35,0),0.05f);
	camera->addAnimator(anim);
	anim->drop();

// Add Camera
camera = CGameMain::getSceneManager()->addCameraSceneNodeFPS(0, 100, 300, -1, keyMap, 8);


download http://harme.dk/dead/dead.rar (36MB)

edit: using irrlicht 1.2
Last edited by kohaar on Sun Jan 14, 2007 1:13 am, edited 1 time in total.
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

Anyone?
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

Irrlicht's collision is rudimentary. I wouldn't use it. Use a collision library instead, for example OPCODE ( http://www.codercorner.com/Opcode.htm ).
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

I'm not sure I have the time to incorporate a collision engine I know nothing about, and which isn't that well documented with irrlicht. Also I couldn't see gravity on the camera somewhere, and since I need a fps camera that is a must. Otherwise thanks for the suggestion.

I have looked into IPhysics and IrrNewt, but their camera classes seem somewhat unfinished and buggy. I guess I will have to deliver the project with the build in camera, and then I can limit the framerate using vsync.

What I was really hoping for was a solution to the build in camera and collision, but for further projects I will defiantly look into and external engine (collision or physics). I wonder why no one else has these problems, or does everybody just use an external engine? I have only found 2 posts about getting stuck, and they were quite old, with no solutions.
harukiblue
Posts: 49
Joined: Sun Dec 10, 2006 6:23 pm

Hmm

Post by harukiblue »

I have not been able to reproduce this problem, and have not come across it either . . . How is it you are "turning up" your video card? I dont over clock my card or box . . . so that may be why I have not come across it. I guess if it is due to some sort of over clocking of some kind I could leave you with some advice my doctor gave me when I was suffereing from a sprained ankle last summer. "If it hurts, then stop doing it."

I hope this helps, If I miss understood your problem then I am sorry if this post was useles! :roll:
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

It's an ATI x1600 Mobility and the driver can throttle down the speed to save battery power, so it is not overclocked.

I have tested this on other computers, and the faster the graphics card, the more you get stuck. :-( You can still get stuck at a low framerate, even though not as frequent. However if you have a framerate at above 100 it is almost impossible to move. Characters in the game also seem to be affected by this.

If you want to test it, I have uploaded it here: http://harme.dk/dead/dead.rar (43 MB)

It's a debug version and may not work on all computers. Also it requires at least a 128mb graphics card. If it doesn't work, try and switch to opengl render in dead.ini (untested)
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Nice work! Ditch standard collision and use something like Newton. Your project deserves it. :wink:

I got stuck in the sand. I couldn't move unless I looked "up". This is because the new collision box isn't "hitting" anything when you look up (gravity pulls it straight down though). Collision is working "correctly" but isn't right, if you see what I mean. :?

I took the liberty of loading your b3d files using Irrlicht's MeshViewer app. Looks like you are building some good stuff.

The City b3d mesh is quite large. When you load it do you make an octree from it? If not, this should help your frame rate.
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

Thanks for the nice comment

I would like to use newton, but I have to turn the project in before the 23, and there is a lot to be done, so I don't have the time to figure out newton. :-( This is also the reason I tried irrnewt, event though the resoult wasn't as good as expected.

No. I don't use octree on the city yet, but i'll try it. Thanks.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Why does camera have gravity?
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

I'm not sure I understand your question?
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

kohaar wrote:Thanks for the nice comment

I would like to use newton, but I have to turn the project in before the 23, and there is a lot to be done, so I don't have the time to figure out newton. :-( This is also the reason I tried irrnewt, event though the resoult wasn't as good as expected.
Have you tried tweaking your elipsoid radius in createCollisionResponseAnimator()?

Also, have you looked at IPhysics? If you're short of time you may not have time to add a physics engine, though.

BTW You could also try creating your Irrlicht device with vsync on. This may help by giving you a consistent frame rate. Worth a try!
No. I don't use octree on the city yet, but i'll try it. Thanks.
You app should run just fine without, but the issue is that if any part of the City's bounding box is visible the whole city mesh will be rendered. If you make an Irrlicht octree scenenode from it you may get a lot better performance.
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

I just played around with the CollisionResponseAnimator, and it is a bit better now

Code: Select all

createCollisionResponseAnimator(triselector,camera,vector3df(6,4,6),vector3df(0,-4.3f,0),vector3df(0,75,0),0.02f);

I have tried both IPhysics and IrrNewt, but both their camera classes had some problems. IPhysics (1.2) behaved very strange when I moved forward, and when I applied gravity to IrrNewts camera, the camera felt like a sphere moving in the environment.
Maybe they could work, but I don't know much about physics engines and what settings to adjust/add.

The city is set to visible(false) when you are in the desert and vice versa, I have however now made it an octree scene node, and also turned vsync on.

edit:
Can some one please tell me why the CollisionResponseAnimator changes my cameras position on other than the Y axis?

With Collision (first two printouts in the game)
-4500.000000,999.995728,0.000000
-5759.126465,603.143982,736.641052

Without Collision (removed camera->addAnimator(anim)
-4500.00000,1000.00000,0.000000
-4500.00000,1000.00000,0.000000

If I set the camera's position closer to the ground, like -4500,350,0 the X and Z axis are not effected

edit2:
uploaded a new version. http://harme.dk/dead/dead.rar (36 MB)
IrrNewt is just out in a v 0.2 and it seems promising. Maybe I can get that version to work.
Binky
Posts: 1
Joined: Mon Jan 15, 2007 4:16 am

Post by Binky »

I just downloaded Irrlicht and started to play around with the tutorials and demo. I noticed the same problem in the Demo.exe after turning vertical synchronization off. After you get control of the character, turn around and go up the stairs. At the top of the stairs there is a slight slope to the ground and the character gets stuck about 50% of the time. I'm unable to see this problem with vsync turned on. With vsync turned on the FPS is 60 and turned off it is over 200 FPS. The Collision.exe uses the same map and I'm unable to ever climb this slope.

It seems like this is a rather serious bug. Should this be reported in the "Bug Reports" section?

BTW, nice work!
kohaar
Posts: 61
Joined: Tue Oct 17, 2006 12:15 am
Contact:

Post by kohaar »

Thanks :-)

Never noticed it in the demo, but I didn't try it more than once.

Your right about the bug section, but since irrlicht is a graphics engine, I doubt that they will prioritize it :-(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, I finally found some time to test it. Started the Demo, ran with and without vsync both with DX9 and OpenGL. I got 150-200 FPS without vsync, but never got stuck anywhere. I could climb the ramp over the stairs down to the statue and even on the small wall to the left and right of it. No problems anywhere. All this tested under Windows, compiled with mingw.
It could be a problem with calculation errors which will vary between different versions of the library. I think the MSVC version uses high optimization settings, while my mingw version does full IEEE accuracy with floats. Maybe try a debug version with all optimizations disabled. If this helps we have to add some better float handling.
Post Reply