How I can using the physics and DT correctly?

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I am trying to create a game with physic, but I have seen que there's a problem with the frame rate and that I should to use the dt variable. So I am trying some like this:

    Force:200*dt

    Impulse:200*dt

    but I do not sure, if is the correct way.

    could you help me?

  • I would first do some searching in the manual and tutorials. Or if you want, post your capx and maybe some physics gurus can assist.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • shimo

    While developing my main game, where have a simple and old (dusted) sample on my signature, I has many problems dealing with DT.

    So, what I had as problem, with my full custom movement system, was the player going into walls, because the frame rate update can variable and the system check the collision on each frame update, but if your sprite is in the eminence of a collision, and the frame rate drop down fast, the sprite can jump a large space in a short time, and when the system check it up, the sprite will be inside a wall...

    After things like this, I started to use the platform behavior and work around all the other situations by attaching invisible sprites over the player, where I did custom movement system for each sprite, selecting them to be the main movement system as desired.

    Another situation where the DT make my brain burn was while doing a simple car race. I did all the rotation of the AI using the DT as a multiplier, like you did, and I got low frame rates while playing on my smartphone (because of the physics), so, the AI started to miss the direction and go through turns, was hilarious, but serious sufficient to force myself to abandon the DT system.

    Now, I just make it without DT and the system update right, but when the frame rate come down, the screen will show the AI doing a teleportation..

  • Physics doesn't and can't use dt effectivly

    The nature of Box2D is that it's performance is dependent on the binary it's running on. Which means that the amount of CPU cycles spent on the physics determine the results.(cough why cutting down the fps to a desired level can influence our logic time cough)

    However Box2D has a had a few tutorials to fix the timestep for it to work across different cpu/binaries

    gafferongames.com/game-physics/fix-your-timestep

    unfortunantly C2 implementation lacks enough functionality exposed to be able to manually do this in an event sheet. From what I can tell :|

  • Physics will use dt if you use the 'Set stepping mode' action and choose 'framerate independent' (which means uses dt). By common request it is not the default because it adds random variation to games which can make them act differently each time from the same set up.

    You don't need to use dt on impulses. I don't think you need to use dt on forces either, but I'm not sure...

  • Ok thank you everybody, jayderyu and TELLES0808 your advice and experience will be useful me. BluePhaze this is the cap, You say me if works in your computer :).

    dl.dropbox.com/u/60873147/ExampleDtandPhysics.capx

    Ashley your advice is just that I need. Thank you so much

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)