First-Person Shooter movements

Started by Thomas., September 11, 2010, 11:12:14 AM

Previous topic - Next topic

Thomas.

Have you any idea how to do fast FPS movements? I tried some ways, but frames went down to 13 from 56... thanks

EgonOlsen

That's a bit too vague...what exactly is causing the slowdowns?

Thomas.

How can I find object3D under camera and determine distance between them?

EgonOlsen

World.calcMinDistance(...) is meant for that. It may not be the best way to do collision detection though...it depends on the scene. More information about collision detection can be found in the wiki: http://www.jpct.net/wiki/index.php/Collision_detection

On Android, collision detection can be quite a bottleneck, because floating point performance can be pretty bad and Dalvik is also pretty bad in doing more intense calculations. Using an OcTree *might* help in that case.

Thomas.

#4
Can you give me advice, how to do it more efective? :) ... Do you have any simple source of game, where can I find code with it? ... if you look at nova game, you have to say, it must somehow work, but how :) ... I try ocTree ...

EgonOlsen

That's a native application, you can't really compare that to the performance that you'll get with the Dalvik VM. However, it should be possible to get this reasonable fast even with Dalvik. Giving an advice is difficult, because i've no idea how your level/game/code looks like. But i can give some general hints:

1.) When using calcMinDistance, watch the threshold value. When using "normal" collision detection, watch Config.collideOffset. Choose reasonable values depending on your level but don't use unnecessary high values, as this will slow down the calculations.

2.) set Object3D.setCollisionOptimization(true) on your objects

3.) Consider using an OcTree. By default, the OcTree will be used for rendering AND collision detection. You might want to limit it to collision detection...just see the JavaDOC of the class for more information

4.) Consider to use an alternate collision mesh, i.e. when rendering, you are using a high detailed mesh of the level, but when doing the collision detection, you us a simplified version with less polygons. You can achieve this by switching visiblity of these meshes before and after rendering for example.