@Nixola: Wow. OK, Love is starting to annoy me now; the reason I chose it was for its simplicity and portability. What you should see is a pixelated character on a grey background standing on a green wireframe rectangle with one at the bottom of the screen as well. I have no clue what I could be doing wrong.
Has anyone looked through the code itself yet to see if I'm making a serious mistake?
Physics Issues
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Physics Issues
It was the best of times, it was the worst of times . . .
Re: Physics Issues
Ok, I donwloaded it again, and (wut?) the background is grey in the last one, but I can't see anything but the player
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
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Physics Issues
Here's one thing you're doing wrong:
You need to get dt involved in that. I have a very fast CPU, so when I touch the arrow keys, the camera shoots over several thousand pixels per second.
Code: Select all
camera.y = camera.y - 12
Kurosuke needs beta testers
Re: Physics Issues
@tentus: Wierd, in love.update I put:
I thought capping the framerate like this would eliminate the need to write a delta time factor into everything . . .
Code: Select all
dt = math.min(dt, 1 / 60)
It was the best of times, it was the worst of times . . .
Re: Physics Issues
dt is the result of the timespan between two frames, not the factor by which frames are run. As far as I understand, modifying dt doesn't so anything to the frame rate, since nothing every reads dt.
https://love2d.org/wiki/love.timer.sleep
The example here seems to show a way to cap frame rates. I assume the only difference between 0.8.0 and everything else is the elimination of (* 1000).
Where that fixes the super speed issue is beyond me. I just always scale with dt for things that I want to be scaled.
https://love2d.org/wiki/love.timer.sleep
The example here seems to show a way to cap frame rates. I assume the only difference between 0.8.0 and everything else is the elimination of (* 1000).
Where that fixes the super speed issue is beyond me. I just always scale with dt for things that I want to be scaled.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Physics Issues
Hundreds per second is still alarmingly fast, that's nearly your entire window in one second. Generally speaking you should ALWAYS account for dt, because there is no assurance that every PC will always be performing at max framerate (quite the opposite in fact). A player with a framerate of 55 may run into weird bugs because some parts of your game aren't factoring the difference.Refpeuk wrote:@tentus: Wierd, in love.update I put:
I thought capping the framerate like this would eliminate the need to write a delta time factor into everything . . .Code: Select all
dt = math.min(dt, 1 / 60)
Kurosuke needs beta testers
Re: Physics Issues
If I use the sleep to make sure I call the whole routine a maximum of 60 times per second it should work fine? That's what I was meaning to do. I'm trying to keep the game as lightweight as possible, so hopefully only those still on ancient computers wouldn't be able to achieve that. Even so, they shouldn't experience any bugs, only slowdown, as everything is contained in the love.update and thus run the same number of times per second as everything else.
I'm interested why mine was capped at 60 automatically, then. It wouldn't go beyond that. Sometimes if I made a mistake the cap would change to 30, but I would never get a framerate other than 30 or 60, with my cpu barely idling, so its not a speed issue with my comp.
I'm interested why mine was capped at 60 automatically, then. It wouldn't go beyond that. Sometimes if I made a mistake the cap would change to 30, but I would never get a framerate other than 30 or 60, with my cpu barely idling, so its not a speed issue with my comp.
It was the best of times, it was the worst of times . . .
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Physics Issues
Vsync. It's pretty common for better computers to have it enabled, leading to the perplexing situation where a weaker machine will run a game at a higher FPS rate.Refpeuk wrote: I'm interested why mine was capped at 60 automatically, then. It wouldn't go beyond that. Sometimes if I made a mistake the cap would change to 30, but I would never get a framerate other than 30 or 60, with my cpu barely idling, so its not a speed issue with my comp.
Kurosuke needs beta testers
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Physics Issues
No. You can't really rely on sleep or vsync or something else. Computers are complex machines that do other things than run your game (and setting vsync to true or false only really sets a preference, which not all computers follow) and they are non-deterministic in the aspect of timing. If you want your game not to have weird glitches and not run way to fast for some and way to slow for others, use dt.Refpeuk wrote:If I use the sleep to make sure I call the whole routine a maximum of 60 times per second it should work fine?
Help us help you: attach a .love.
Re: Physics Issues
I would still love to know why my fps is capped without me writing any code to do so, but it isn't for others.
Also, should I write dt into all the physics stuff, or does that happen automatically with world:update(dt)?
Thanks again
Also, should I write dt into all the physics stuff, or does that happen automatically with world:update(dt)?
Thanks again
It was the best of times, it was the worst of times . . .
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 14 guests