Cannot get simple block/ball system working consistently?

Topics: User Forum
Apr 20, 2011 at 6:45 AM
Edited Apr 20, 2011 at 7:50 AM

Hello, I have been working on a breakout-style game but I want to know how to utilize this engine better.  It seems everything I try to change and make "better" just breaks more.

So the basic setup is one or more balls (circle shapes, dynamic) bounce around a world of square blocks.  Some blocks can be moved with the user's controls, creating a paddle to guide the balls.  Every frame I manually set the position and angle of every paddle-block according to some code (it can be moved along a "track" and has some freedom of angle, but this movement needs not be physically-based).  From what I can tell it doesn't really matter if I use static or kinematic bodies for this, but kinematic appears to resolve a little bit faster after calling SetTransform

At first, just to get the concept up and running all my values were pixel-based (so the ball's radius was about 3.0), but for playability this meant the ball had to move at ~200 pixels/second.  I now know that the engine is supposed to slow down something that fast (to 2.0 I think), but I got around it by resetting the speed every frame.

For whatever reason this was working relatively well.  However, it became apparent that my hacks were doing too much damage when I tried changing the game's framerate and found the ball slowed down proportionally (I believe because I didn't get to speed up the ball as many times per second).

I thought a simple solution would be to scale all my values - I started with 100px=1 fpe-unit, but now I'm closer to 50.  Ever since changing this however, I get weird effects on my ball/block bounces.  I believe it is the same as described in this topic - http://farseerphysics.codeplex.com/discussions/254146 - but since I was using my broken system before upgrading to 3.3, I can't be sure. 

Basically all I want is for the ball to bounce forever, even if that means I speed it up manually, but also I need to scale my values down so my balls don't overrun the hard-coded limit of "2".  As I scale the values down the physics seem to be "stickier" (as in referenced topic), and when I'm around 120-140 the ball begins stopping altogether (not sure why, possibly the velocity just becomes too small?)

EDIT: just looked at it again, and since it is a max movement of 2 units per update I can have higher velocities, as long as I maintain a high fps.  Now I'm working around 10 px : 1 unit right now - anyone know if this sounds reasonable? Blocks are ~25x25 px and the balls' radius is ~4px Ball density is 1 and block density shouldn't matter I think (since its not dynamic)

I hope anyone can help, and I apologize for asking so many disparate questions - one of my main problems right now is even knowing what is causing me the issues...  thanks in advance!!

Apr 20, 2011 at 5:42 PM

Hey how can I start using this... Sorry man, I am a dummy on this. I tried to find the .exe file but there seems none. What shall I do? I would love to check this out... I think its a great program...  thanks

 

--

florida health insurance