math & physics
codemonger at October 15th, 2004 11:40 — #1
I was playing starwars battlefront the other day, and noticed that input is fixed to framerate. I haven't really thought this through, but when I play the game and the frame rate is high, everything is pretty smooth, when the frame rate drops, naturally everythin slows down. To compensate for this the physics is tweened between what the frame rate is and should be. But it seems the tweening is only applied to the physics of the game and not the user input. I only say this because in the menu, selecting your character, the game may chug, but so does the input. The mouse drags across the screen really, really slow. I haven't put much thought into this but wouldn't it seem much better if the input was frame independent and seem smoother even at low framerates. I mean, if framerate is 10fps, it doesn't mean my mouse should travel really slow, and take 1 second to travel 100 pixels. It should be the same to get from point A to point B in 1 second regardless of framerate, just the same way physics are tweened. Or are games already doing this and I'm missing something, maybe it just seems this way to me?
BTW I put this in the physics section as I thought it's more related to how physics are dealt with.
nomadrock at October 15th, 2004 12:58 — #2
That is the way I think games should work as well, and this is how I deal with input. I find it increadibly annoying at extremely low frame rates when it takes you forever to get back to the button that changes the detail back down, or what not. I only poll the input once per frame, but I move the cursor by the ammount that the mouse was moved during that time. This can be kind of annoying as well, because the cursor appears to jump around the screen if you move it very fast at low frame rates, but I dont know any better way.
codemonger at October 15th, 2004 13:22 — #3
Yeah I was thinking about the jumping too ... what if the cursor was drawn independant of the buffers flipping ? any thoughts on that. It would only be a small portion of the screen being updated so it would be very quick, or would the flipping of the buffers cause the mouse to flicker ?
codemonger at October 15th, 2004 13:25 — #4
I guess this would cause sync issues though, if your mouse moves over a button it should glow, but the buffer hasn't flipped yet so it would look strange, out of sync. hmmm, I guess they way you suggest would be the most viable solution.
nomadrock at October 15th, 2004 14:07 — #5
You could have a lack of hover changes, and that would not be much of an issue. The problem I see is that you would have to redraw under then cursor when you move it, if you move it manually appart from the back buffer. I dont think this kind of pipe stalling would help out your framerate any.
Perhaps one could draw a faded trail behind the mouse that went half way toward the last position of the mouse. At high frame rates you woul not notice it at all, but at low frame rates it would make it easier to not loose the mouse. I am not sure how effective it would be. Windows has mouse trails but this is just a buch of copies of the cursor pasted in the trail, and is very confusing to the eyes. A smooth trail would be better, but I cannot be sure how helpful it would really be without trying it out.