Jump to content
  • Advertisement

ArtLem

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

139 Neutral

About ArtLem

  • Rank
    Newbie

Personal Information

  • Interests
    |artist|programmer|
  1. Interesting approach! Is your article still valid? I don't see the accumulator here. Thanks. I've never personally experienced the problems you cite here, with dropped frames? I regularly test by putting something like Sleep(500) or whatever in my main loop and, while things obviously get a bit jerky, everything still runs at the same speed. Could you clarify exactly what problem you are solving here? I'd be interested in making it manifest in my game so that I can understand better. How would one force your problem to appear? Thanks.   Hi, you are probably right. I was worried thinking in a scenario where a large amount of objects needs to be interpolated, but this is not my case anyways.
  2. This is a slightly different problem, however. If the object is moving straight, then you could test the region the object is moving through rather than attempting to test a fixed position. Time to test some code, many thanks!
  3. Thanks for the reply, probably I'll try the first option, but I'm curious about how second way works, if I understood correctly, you say that I can duplicate, quadruplicate, etc the update loop matching the render rate. So, for example, for a draw call, call twice to update method?
  4. Hi, thanks for the reply. I've tried a variable time step too, but I've got some strange behaviours with the collisions (I'm moving the objects forward to check if they collide, but with variable delta time I don't know their future positions).
  5. I'm trying to fix the time of my engine to do proper collision detections. I have read this article Fix Your Timestep! (I think I misunderstood some concepts) and this good response http://gamedev.stackexchange.com/a/12760 , but I don't really want to keep two copies of my world state, so I've tryied to do a forced update with the remaining accumulator time. This is a resume of my game loop: ... float accumulator = 0.0f; Timer::ELAPSED = 0; // Uint32 Timer::LAST = SDL_GetTicks(); // Uint32 Timer::deltaTime = 0.01f; while (state != SceneState::EXIT) { updateInput(); Timer::NOW = SDL_GetTicks(); Timer::ELAPSED = Timer::NOW - Timer::LAST; Timer::LAST = Timer::NOW; accumulator += (Timer::ELAPSED / 1000.0f); while (accumulator >= Timer::deltaTime) { update(); accumulator -= Timer::deltaTime; } /* The forced update part */ Timer::deltaTime = accumulator; // Changing the delta time to a value < 0.01f update(); accumulator = 0.0f; Timer::deltaTime = 0.01f; /**** ****/ draw(); ... While this seems to work (now there are no flickering effect because there is a guaranteed update call with the remaining time) I think this breaks the concept of fixed time step (now Timer::deltaTime vary in the forced update). Have you got some ideas of how to do it properly?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!