Falling through floor/Speed issue

So I wrote some code where I place cubes randomly on the floor and they randomly pick locations,walk to them, pick new locations, walk, repeat.

When I have 50 cubes, things start running pretty slowly. When i increase the floor area say from 50x50 to 100x100 i have a problem where the boxes fall through the floor (this problem only happens when i increase the floors size, not from increasing cube numbers). Anyone know why? Im guessing this is an issue where collision calculations are not being performed in time.

I have a separate thread that manages the AI actions by giving different operations so much time to perform. The AIManager gets 10 miliseconds to perform all operations. If all opperations finish within this time, it yields() then sleeps for the remaining time. Even with 500 cubes it finishes in time,

Based on this im guessing the problem is with drawing all the cubes. Do I need to manage the time i get to draw, or is the problem just that I am drawing to many objects?

Sorry if this sounds like jiberish, my brain is just hurting at the moment.

So i sorta figured out part of my problem, when I give my AIManager 5 seconds (and therfore it sleeps 5 seconds) i realized things walk in the current set direction for 5 seconds until they are updated next go around of the manager.

So now im realizing I am just drawing to many objects on the screen at once, but is there a way to micro manage the display such as collision detection verse updating the screen?

See PhysicsSpace.setDeterministic()

I changed code as so:

[java] bulletAppState = new BulletAppState();


I get the following error:

Jan 25, 2011 8:50:13 PM com.jme3.system.JmeSystem initialize

SEVERE: Error while copying native libraries

java.io.FileNotFoundException: C:UsersJasonDocumentsNetBeansProjects3rdPersonlwjgl64.dll (The process cannot access the file because it is being used by another process)

at java.io.FileOutputStream.open(Native Method)

at java.io.FileOutputStream.(FileOutputStream.java:179)

at java.io.FileOutputStream.(FileOutputStream.java:131)

at com.jme3.system.Natives.extractNativeLib(Natives.java:72)

at com.jme3.system.Natives.extractNativeLibs(Natives.java:144)

at com.jme3.system.JmeSystem.initialize(JmeSystem.java:347)

at com.jme3.system.JmeSystem.newContext(JmeSystem.java:267)

at com.jme3.app.Application.start(Application.java:322)

at com.jme3.app.Application.start(Application.java:305)

at com.jme3.app.SimpleApplication.start(SimpleApplication.java:122)

at mygame.Main.main(Main.java:39)

Uh, these two should not be correlated.

Not sure why but when i move the setDeterministic line to the bottom of simpleinitapp i dont get the error anymore.

*EDIT: I can do it right after stateManager.attach(bulletAppState); but not right before that line (which is what i was doing at first).

But even with that my objects still fall through when the floor is too large.

Should I just break up the floor into smaller sized quads? I know the terrain tutorial recommended patch sizes of 65x65.

I think tomorrow ill modify the code to use my heightmap instead of huge cube for the floor and see if i get a different outcome.

Oh, yeah, huge cube is probably not good, especially when you use it like a mesh and not with a box collision shape. When using meshes the quad size should not be too big in relation to the objects. HeightMap with Terrain should be best, yeah. Adding objects to the physics space is expensive, you might want to spread that operation over multiple frames.