mysterious bouncing umlauts

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
refill
Prole
Posts: 2
Joined: Fri Apr 24, 2009 6:00 am

mysterious bouncing umlauts

Post by refill »

Hello masses. Making a first post to (somewhat predictably) ask some noob physics questions.
First I should say I'm amazed at how easy love is to use. I'm someone who's failed gloriously on every attempt to learn a language more complex than javascript, and in less than 3 days poking around with love I have something recognizably game-like.Which I've attached. It has Gravity! It has Collisions! It has Umlauts! What more could you ask? Up, Left, and Right are the only inputs. Sadly the tutorials seem to end before physics so on to the noob questions:

You'll notice it bounces. This is on purpose. Mysteriously though it doesn't lose any energy doing so, and bounces forever. I don't fully understand the collision function yet but is there a way to make it react more realistically?

On a related note, if I drag the window up or down while it's bouncing, it occasionally either teleports the character into the air or superbounces it (it's hard to tell). Also mysterious.

Increasing my impulseModifier variable increases the speed, but only up to a point. Nothing I've been able to do will make the character move faster than he is now. Mass and Inertia also only affect it to a certain point. Made all the more frustrating by the fact that it's moving almost fast enough for my liking.

Also, if anyone feels like poking around the code (it's small!), could you tell me if anything is redundant/inefficient/ugly? It would be nice to not develop bad habits right away. Sorry about the question barrage :death: . Any help or links to help is appreciated :nyu: .
Attachments
umlot_alpha002.love
(28.15 KiB) Downloaded 247 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: mysterious bouncing umlauts

Post by bartbes »

refill wrote:On a related note, if I drag the window up or down while it's bouncing, it occasionally either teleports the character into the air or superbounces it (it's hard to tell). Also mysterious.
Most likely because you experience a huge framedrop while doing so, thus making it skip a few frames.
refill wrote: Increasing my impulseModifier variable increases the speed, but only up to a point. Nothing I've been able to do will make the character move faster than he is now. Mass and Inertia also only affect it to a certain point. Made all the more frustrating by the fact that it's moving almost fast enough for my liking.
Known bug: Movement is capped at 200 units/second, note I used units/second, not pixels/second, this is because Box2D isn't designed for use with pixels. Solution: Scale (CAMERA is nice for that purpose) or multiply the dt value that your physics update gets, if you multiply it by two, the entire physics go twice as fast.
User avatar
refill
Prole
Posts: 2
Joined: Fri Apr 24, 2009 6:00 am

Re: mysterious bouncing umlauts

Post by refill »

Thanks bartbes, dt = dt*2 worked like a charm, but it almost seems too easy. And the old version now looks hilariously slow in comparison.
The infinite bouncing problem was me setting Restitution > 1 while I was wrecking the physics trying to make it go faster. :megagrin: I am smrt. I can use much more reasonable values now and everything is running much nicer.
The superbouncing bug maybe I didn't explain very well, dragging the window would cause the FPS drop, yeah, but when I release it the ball is way higher that it would have been able to get using the forces available to it. If y is the max bounce height, the ball would be at y+50. Probably caused by the restitution thing too though, so I think that's the last I've seen of it.
Attachments
umlot_alpha003.love
(28.57 KiB) Downloaded 250 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: mysterious bouncing umlauts

Post by bartbes »

If it isn't it might still be that framedrop, where the code isn't slowing down fast enough. (so the ball already is too high before the code recognizes and applies the correct gravity setting) Don't know if it's the case, or if it's possible, but I thought it was worth saying.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests