Page 3 of 3
Re: information on creating a platform game
Posted: Fri Jan 14, 2011 2:12 am
by TechnoCat
BlackBulletIV wrote:I'm guessing that means that there's two conflicting variables in different scopes?
Another thing I've found that both these methods do is make time faster, though not as fast as it would be without them. It's all very confusing.
EDIT: Oh yeah, here's my latest code:
<CODE SNIP>
Code: Select all
if dt > maxDelta then
local left = dt --Might as well move this in here
while left > maxDelta do
world:update(maxDelta)
left = left - maxDelta
end
world:update(left) --ONLY WHAT IS LEFT
else
world:update(dt)
end
Re: information on creating a platform game
Posted: Fri Jan 14, 2011 2:21 am
by BlackBulletIV
I realise what you're saying, but your code still causes explosions. When I used maxDelta those explosions don't occur; I've stated that already.
Anyway, I think this is the problem. Some minor explosions occur when left gets down to a low value, not sure why. But a huge explosion occurred when left when left was equal to 3.5762786898541e-09. I'm assuming that means 0. I for the most part fixed the explosions by using this code:
Code: Select all
if dt > Grace.maxDelta then
local left = dt
while left > Grace.maxDelta do
_update(Grace.maxDelta)
left = left - Grace.maxDelta
end
if left > 0.005 then _update(left) end
else
_update(dt)
end
It's not perfect, as there are weird time rate increases and decreases... but it's a bit better. Maybe I just need to up the 0.005 number or something?
EDIT: In case you're wondering, Grace.maxDelta is where maxDelta is coming from and _update() calls world:update().
EDIT2: No actually it work. Explosions are back... I just don't know.
Re: information on creating a platform game
Posted: Fri Jan 14, 2011 7:52 am
by bartbes
Woah, what's wrong with the plain and simple:
Code: Select all
while dt > 0 do
local t = math.min(dt, maxDelta)
world:update(t)
dt = dt - t
end
?
Re: information on creating a platform game
Posted: Fri Jan 14, 2011 9:47 am
by BlackBulletIV
I had the same old physics explosions and then, not only Love, but my computer, froze and crashed. It doesn't work for me.
Re: information on creating a platform game
Posted: Fri Jan 14, 2011 12:04 pm
by Robin
BlackBulletIV wrote:I had the same old physics explosions and then, not only Love, but my computer, froze and crashed. It doesn't work for me.
… are you sure you don't have a problem with your computer?
Re: information on creating a platform game
Posted: Sat Jan 15, 2011 9:55 am
by BlackBulletIV
Unfortunately I do, it only happens around Love when Love has to do heavy processing (for example, in my 4KB explosions entry, if I create a tonne of explosions when on pause mode and then releasing the time control the same thing will happen). My computer crashing would most likely be my computer's fault, I don't know about Love crashing though. Using that code the physics system was freaking out with random explosions (like it always does when I use the amount left over to update the world) before that anyway.