Hey everyone, I am adding 12 stacks of 20 boxes each in their own dynamic physics node to my scene to my scene, and a ball to topple them over. I keep getting the following crash:
SEVERE: Exception in game loop
java.lang.StackOverflowError: The ODE step function could not allocate enough stack memory to compute the time step!
This is usually caused by low stack size or by too many applied contacts respectively (number of contacts in this step was 830).
Note, the stack size of threads other than the "main" thread can be raised with the VM paremeter -Xss.
at com.jmex.physics.impl.ode.OdePhysicsSpace.computeTimeStep(OdePhysicsSpace.java:810)
at com.jmex.physics.impl.ode.OdePhysicsSpace.update(OdePhysicsSpace.java:593)
at com.jmex.physics.util.SimplePhysicsGame.update(SimplePhysicsGame.java:141)
at com.jme.app.BaseGame.start(BaseGame.java:79)
at game.TestGame$1.run(TestGame.java:141)
at java.lang.Thread.run(Unknown Source)
Now, in browsing this forum, I found that I should be able to up my VM stack size by sending the -Xss1024m (for example) argument to the VM (I did this in eclipse by entering it in the "VM Arguments" box in the launch configuration properties), then I replaced my new TestGame().start(); call with:
new Thread(new Runnable(){
public void run()
{
new TestGame().start();
}}).start();
However, regardless of whether I set the -Xss value to (10m, 256m, 1024m), I always seem to crash with 12 towers (10 always works). So it seems like my argument isnt working. Any thoughts on how to make this work in eclipse?
Also, does 241 (mostly stacked) dynamic objects and 5 statics seem like about where the memory limit should be breached? I would like to get 1000 dynamics in there if possible. (i have 1.6 core2 duo, 2g mem).
10m should work, not sure if 1024m is a valid size for the stack. No idea why it doesnot make a difference on your side. But even if you get it to work, it will be really slow - ODE is simply not suited for resolving more than 500 collisions at the same time…
It gets about critical with 200 and more (colliding) dynamic nodes with the default java settings.
The number of DynamicNodes isn't that important but number of contacts at a given time.
Try to create them with a little offset (0.01) so, that they are not colliding right away when you create the stacks.
Yea, I notice that it runs really slow when we get up there, I didn't know if up-ing the memory would help there too. So I am setting this argument in the correct area within Eclipse right?
The speed issue is in the ODE natives i assume? Are there alternatives or is this mostly PC speed issues (so in 5 years a 500 block wall will be doable with current code)? I would like to make a 1000 block wall. Just say that its not going to happen if such is the case.
I guess what I am getting at is that I want to recreate this, but bigger http://www.youtube.com/watch?v=LwhQFwAPxCA
Am I screwed or are there some tricks that can be done to make it workable? I have NO optimization in place, I guess I just didn't expect to hit a brick wall (pun intended) so soon
Even if it runs at 1 fps, I would like to figure out the memory thing because the default is just too small.
I think your only option is to use a different physics engine. ODE won't get you there. JOODE will not as well. It seems PhysX can do it (used in that video). You can try with the PhysX implementation of jME Physics 2, but be aware that it still lacks a lot of features and I won't continue to implement it myself. jBullet could also be an option, as it seems handling lots of contacts is at least better than in ODE. But there is no jME Physics 2 implementation for it yet (though there are some people after it, I believe).
Do you probably use ea version of the consumer jre6? It does not support -Xss…
great, thanks for the info there. Not too sure if I want to do something like moving to a "not so well implemented" engine since my real game won't require more than 500 collisions I'm sure. One reason I choose JME was that it was mature, so I will stick with ODE.
I do have JRE6 from sun, is that what you are asking? not sure what ea release is (early alpha?)
ea = early access
Standard JDK/JRE 1.6.0 will work with -Xss (The "consumer jre" is a very small jre and was not yet released)
maybe your stack values were too high, try a value of -Xss2m
i think default is like 64 or 128k
edit:
with 2m stack size i can easily create 6 walls with 20 blocks.
but the performance suffers badly. 
I have Java1.6.04 I believe. (also 1.6.05, but I think update 4 is what eclipse is using). Is there any way in code to output the max stack size so I can see what it is using? something like System.out.println( System.getStackSize() ); ?
And I thought 64 Meg was the default, not 64k :? I'll try a smaller setting when I get home
The memory setting is working now. I was setting it on my "game" run settings, but it needed to be set on my "testGame" settings.
Thanks for the info on the engines