information on creating a platform game

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.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: information on creating a platform game

Post 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
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: information on creating a platform game

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: information on creating a platform game

Post 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
?
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: information on creating a platform game

Post 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. :P
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: information on creating a platform game

Post 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. :P
… are you sure you don't have a problem with your computer?
Help us help you: attach a .love.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: information on creating a platform game

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 14 guests