It's a made up number to illustrate a point.Robin wrote:You know, if dt is 1.5, you have an FPS of 0.67. Skipping frames is not your worst problem then.MarekkPie wrote:Depending on his system speed, just flooring dt might skip or repeat frames and whatnot. For example, an average dt of 1.5 would give him:
Frame Rate Questions
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Frame Rate Questions
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Frame Rate Questions
And I used math to show the point is moot.
Help us help you: attach a .love.
Re: Frame Rate Questions
Well, flooring a number less than 1 would also give you a problem as an index. That is unless we really like the first frame.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Frame Rate Questions
Not really, look at what I wrote earlier:
It is not stored as an integer, this works. Everyone uses this, all the time.Robin wrote:You could use dt.
See math.floor for more information.Code: Select all
function A() return array[math.floor(index)] -- this is the trick that makes it work -- it rounds index to the nearest smaller-or-equal integer. end function love.update(dt) index = index + dt * speed end
Help us help you: attach a .love.
Re: Frame Rate Questions
From my understanding of his initial question, he has an array that represents the images of his jump animation (either as individual images or quads for spritesheets). He needs to cycle through that array in numerical order, and he needs to have the index change every time dt appears (aka once every call of love.update(dt)).
Clearly this doesn't update the array after every update call. It will update the array, it may even do it in numerical order, but it doesn't do every time love.update(dt) is called.
Again, like I said in another post, my brains hurting due to RL issues, so I may have misunderstood the question, or maybe your method of calculating the jump frames is better. But I think that method won't work for my understanding of his question.
Code: Select all
index = 0
speed = -- whatever
function love.update(dt)
index = index + speed * dt
print(math.floor(index))
end
Again, like I said in another post, my brains hurting due to RL issues, so I may have misunderstood the question, or maybe your method of calculating the jump frames is better. But I think that method won't work for my understanding of his question.
Re: Frame Rate Questions
I think you have understood the question, but if someone on a fast PC plays this without dt, he may not see the animation or see it too quick, and I may see it veeeery slow; that's why delta has to be called, and that's why LÖVE developers put delta in LÖVE
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Frame Rate Questions
You don't have to hide , he asked how to do it without dt
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Frame Rate Questions
I'm hiding because I made a very similar point on these forums to someone else and I fall into the same trap.
Re: Frame Rate Questions
Hey guys,
Thanks for your posts; the matter is looking much clearer to me now. However, I’ve one final question. If I lock the FPS speed, wouldn’t that set a fixed execution speed for the game regardless of the user's CPU speed?
Thanks for your posts; the matter is looking much clearer to me now. However, I’ve one final question. If I lock the FPS speed, wouldn’t that set a fixed execution speed for the game regardless of the user's CPU speed?
Who is online
Users browsing this forum: No registered users and 173 guests