Hey I'm new to C# programming. This is a really great project. I am currently working on something just like this for school and I really need some advice.
My 2D engine runs, but I cant get a constant framerate in my game loop. So the game jumps around. Also how did you implement XNA to get the engine to work.
I would really appreciate it if you could help me out, thank you.
@samirtleal Thanks! To account for your framerate not being constant you should always multiply by passed time since last loop, the parameter called GameTime in a lot of functions in XNA. For example if you have a variable called acceleration which is 3m/s/s then this value is multiplied by the number of seconds since last frame and added to velocity. Velocity is then multiplied by time and added to position. If you handle all variables in such a manner then a non-constant framerate will be ok
Hey I'm new to C# programming. This is a really great project. I am currently working on something just like this for school and I really need some advice.
My 2D engine runs, but I cant get a constant framerate in my game loop. So the game jumps around. Also how did you implement XNA to get the engine to work.
I would really appreciate it if you could help me out, thank you.
samirtleal 3 months ago
@samirtleal Thanks! To account for your framerate not being constant you should always multiply by passed time since last loop, the parameter called GameTime in a lot of functions in XNA. For example if you have a variable called acceleration which is 3m/s/s then this value is multiplied by the number of seconds since last frame and added to velocity. Velocity is then multiplied by time and added to position. If you handle all variables in such a manner then a non-constant framerate will be ok
mikhog 3 months ago