Troubleshooting this TutorialSometimes, even though you try hard to understand the information in a tutorial, things don't work out quite like you want it to. This page is here to help you resolve any problems you might be having with the tutorial on fixed and variable time steps. The Common Mistakes section describes common problems that people have when doing the things in this tutorial, and how to resolve them. The Frequently Asked Questions section describes questions that people have that aren't related to mistakes, but rather, trying to understand the stuff better or exploring how it can be used. If your problem or concern isn't addressed here, feel free to add a comment below, so that I know where you're having trouble. I like to keep these pages fairly clean, so I may remove comments that I felt like have been addressed. If I remove your comment and you don't feel like the problem has been fixed, repost the question and we'll take another look at it. If a tutorial has a mistake in it, I will fix the mistake and reply to the comment with a brief explanation. However, after a couple of weeks I'll likely go back and remove the original comment as well as my reply, because, hopefully, the problem will have been fixed, and it won't be a concern any more. |
Common MistakesNone listed yet… |
Frequently Asked QuestionsNone listed yet… |
Hey, I love your site. It's been useful to me for many years. However, there is one major problem with your time steps tutorial (rbwhitaker.wikidot/time-steps). I'm not sure if it is explicitly your tutorial or something I'm doing wrong.
Here is the line of code I've been using (direction is normalized):
position += direction * (float)(TotalSpeed * gt.ElapsedGameTime.TotalSeconds);
I started to notice that whenever my FPS was at 30, my projectiles (in this case, arrows) would move slower than when at full speed. Turning V-Sync to false above unlocked the frame rate so then I'm going around 120 FPS. Projectiles are going much faster.
Unfortunately, this applies to everything else.
Am I doing something wrong, or is TotalSeconds just that unreliable/broken? I plan to switch over to Monogame eventually, but I'm not sure if that would fix the issue.
An additional note that may or may not be related: changing 'IsFixedTimeStep' to true causes my game not to run — no errors, just a blank window-colored (beige-ish) screen.
If you ever see this (unsure how often you go to your site), any help is appreciated.
Thanks.
I am not sure for your first problem (the speed issue), but as for the second one, I am using MonoGame and had no problem with IsFixedTimeStep set to either true or false. We would probably need to take a look at the whole code to have an idea of what went wrong; in case you still have it, maybe you can share it, or at least the parts that may be relevant.
I am not sure for your first problem (the speed issue), but as for the second one, I am using MonoGame and had no problem with IsFixedTimeStep set to either true or false. We would probably need to take a look at the whole code to have an idea of what went wrong; in case you still have it, maybe you can share it, or at least the parts that may be relevant.
Post preview:
Close preview