Hi,
I published a game based on bepu physics engine in the windows phone 7 marketplace. The game runs smoothly in the emulator, but in the real device, some "strange" things happen: the ball changes its direction suddenly, the performance decreases a lot when the ball hits the first pin, even sometimes the ball crosses the ground and falls under it... I feel frustrate because I can't debug this behaviour in the emulator. Any idea?
http://www.youtube.com/watch?v=_76CCogvxDk
Problems with BEPU in windows phone
Problems with BEPU in windows phone
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
XNA BLOG: http://geeks.ms/blogs/jbosch
-
- Posts: 136
- Joined: Sun Jan 17, 2010 11:35 am
Re: Problems with BEPU in windows phone
Well the first problem is that you need to test it on a device as the emulator can be up to 25 times faster than a device.
Re: Problems with BEPU in windows phone
You might want to verify that the vertices and indices that the collision mesh is being made from matches between platforms. Strange behavior with the content loading has been reported before on the device that doesn't appear in the emulator, although I have no idea what would cause it.
The BEPUphysicsDrawer can draw the TriangleMesh object used to construct your model. It will draw whatever the collision mesh is; this might reveal something wonky.
The BEPUphysicsDrawer can draw the TriangleMesh object used to construct your model. It will draw whatever the collision mesh is; this might reveal something wonky.
Re: Problems with BEPU in windows phone
I can't find any way to speed up the game when the ball hits the pins. Any idea?
thanks
thanks
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Re: Problems with BEPU in windows phone
Is it a performance problem, or are you just trying to make the actual simulation appear to move faster? If it's the latter, you could try increasing the gravity some until it feels right (careful, if you go too high, you can introduce instability which may require more iterations or a smaller timestep to fix).
For performance, you can try messing with the collision response setting's iteration count. Very low counts (1-4) will be quicker than the default (10), but you'll have to test to see how low you can go before the lack of accuracy becomes apparent.
If I remember right, you're using cylinders for the pins, which should be fine. If I remember wrong and you're actually using ConvexHulls, you might try simplifying the collision mesh some or using cylinders.
However, 10 pins and a ball should really run fine, even on a phone. If there are performance problems, it's probably something less obvious.
For performance, you can try messing with the collision response setting's iteration count. Very low counts (1-4) will be quicker than the default (10), but you'll have to test to see how low you can go before the lack of accuracy becomes apparent.
If I remember right, you're using cylinders for the pins, which should be fine. If I remember wrong and you're actually using ConvexHulls, you might try simplifying the collision mesh some or using cylinders.
However, 10 pins and a ball should really run fine, even on a phone. If there are performance problems, it's probably something less obvious.
Re: Problems with BEPU in windows phone
Hi, after many tests with the device, I've seen two main things:
-I cant undersrand the differences in the behavior.
-My pins are set to kynematic before each launch.When the ball is in a short distance, I make them dynamic, and it seems that causes problems. But if I dont do this, some pins start dancing and some fall. Is there a better solution for this?
-I also create new instances of ball and pins each turn. This probably generates garbage, but I need to do so because if not I cant find the way to "reset" the physical properties of the entities.
Can you sugest something better? Thanks.
-I cant undersrand the differences in the behavior.
-My pins are set to kynematic before each launch.When the ball is in a short distance, I make them dynamic, and it seems that causes problems. But if I dont do this, some pins start dancing and some fall. Is there a better solution for this?
-I also create new instances of ball and pins each turn. This probably generates garbage, but I need to do so because if not I cant find the way to "reset" the physical properties of the entities.
Can you sugest something better? Thanks.
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Re: Problems with BEPU in windows phone
By the way, how do we change the collision detection settings? ThanksNorbo wrote:Is it a performance problem, or are you just trying to make the actual simulation appear to move faster? If it's the latter, you could try increasing the gravity some until it feels right (careful, if you go too high, you can introduce instability which may require more iterations or a smaller timestep to fix).
For performance, you can try messing with the collision response setting's iteration count. Very low counts (1-4) will be quicker than the default (10), but you'll have to test to see how low you can go before the lack of accuracy becomes apparent.
If I remember right, you're using cylinders for the pins, which should be fine. If I remember wrong and you're actually using ConvexHulls, you might try simplifying the collision mesh some or using cylinders.
However, 10 pins and a ball should really run fine, even on a phone. If there are performance problems, it's probably something less obvious.
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Re: Problems with BEPU in windows phone
That does create garbage, but it's 'rare' (once every several seconds) and a pretty small amount of garbage so it might not even be something to be worried about. If you do want to get rid of it, the only thing you should have to do to reset them is set the position, orientation, linear velocity, and angular velocity back to their starting values. Linear/angular velocity's initial values are both zero vectors.I also create new instances of ball and pins each turn. This probably generates garbage, but I need to do so because if not I cant find the way to "reset" the physical properties of the entities.
Does the dancing happen on Windows/WP7 emulator? If it's only happening on an actual device, the best solution (and the only one guaranteed to work, unfortunately) is to try and figure out what's up with the device. Making them dynamic shouldn't really cause issues either.My pins are set to kynematic before each launch.When the ball is in a short distance, I make them dynamic, and it seems that causes problems. But if I dont do this, some pins start dancing and some fall. Is there a better solution for this?
If the dancing happens on the emulator as well, then it's more likely related to the size ratios of cylinders/triangles involved. I'd have to see the exact behavior in action to know, but the size ratio issue is pretty common.
Collision detection settings can be found in the space.SimulationSettings.CollisionDetection class. Collision response settings (including the iteration count) can be found in the space.SimulationSettings.CollisionResponse class.By the way, how do we change the collision detection settings? Thanks
Re: Problems with BEPU in windows phone
Hi there,
I followed your recommendations,and the performance has improved a 300%
Now I created a new problem, and it is that the ball does not move very reallistically. It seems like it is not being affected by the gravity or something similar. Please have a look at this video:
http://www.easy-share.com/1913001082/Sc ... 17-11-2010 18.49.49.wmv
Do you know which could be the reason for that behaviour and how to solve it?
Thanks in advance.
I followed your recommendations,and the performance has improved a 300%
Now I created a new problem, and it is that the ball does not move very reallistically. It seems like it is not being affected by the gravity or something similar. Please have a look at this video:
http://www.easy-share.com/1913001082/Sc ... 17-11-2010 18.49.49.wmv
Do you know which could be the reason for that behaviour and how to solve it?
Thanks in advance.
Jesús Bosch
XNA BLOG: http://geeks.ms/blogs/jbosch
XNA BLOG: http://geeks.ms/blogs/jbosch
Re: Problems with BEPU in windows phone
I can't really tell for sure, but it almost looks like the ball is kinematic.
By the way, are you using a content processor to collect collision mesh data? If not, I would recommend it.
By the way, are you using a content processor to collect collision mesh data? If not, I would recommend it.