im_pro_viz's Forum Posts

  • this code is a bit complicated for me. I will need some time to analyze it. But it looks very cool. Thank you very much!

  • you're fundamentally doing the wrong calculation.

    Maybe. I don't argue. But let me explain my logic. Maybe you can tell me how to do it better.

    With a simple example.

    The sprite moves every tick by 1 pixel along the X axis, and stops when there is a collision. Usually, we multiply this number by dt, right? Now, I need to calculate the movement and write to a variable the time after which the sprite collides with an obstacle. I use a loop, and instead of ticks, I use a loopindex. If I didn't use the tajectory forecast, I would multiply the movement by dt. So, I need the object to move inside the loop exactly as it would move outside the loop, i.e. in real time. How else can this be implemented?

  • I think the problem in this thread may be that you've jumped to conclusions. The object you showed wobbling is not actually moving. So why is it using delta-time? This appears to be a logic problem with your events. I don't think you should be using delta-time at all there.

    in my case, it is very important to use dt in object positioning, because I calculate not only the final location, but also the speed of its movement. I have many obstacles, at different angles, and there should be many bounces. If I do not use dt, then I get different trajectories, with different bounce strength, at different fps. I do not know how well I managed to explain. But I tried to do it in different ways. And only with dt I get an accurate calculation.

  • To smoothen the dt you could store the last n delta times and average them.

    ]

    I don't see much difference

    Subscribe to Construct videos now
  • A question : is the red circle position calculated from the curve? Or is the curve calculated from the red circle position?

    They are calculated separately..Independently of each other

  • > So far, I have found this method: dividing time by tickCount. It seems much more stable.

    For what purpose? Where do you use this value?

    I use delta time in loops to determine the movement trajectory. The loop runs until the object collides with an obstacle.

    As you can see, the red ball is shaking. This happens because delta time is used for its positioning.

    Subscribe to Construct videos now
  • Thank you very much for your response! The issue is not that I’m afraid of FPS drops. Even in very simple projects, delta time is extremely unstable. I tried averaging values using an array, with both 100 and 300 values, but the result was still unsatisfactory.

    So far, I have found this method: dividing time by tickCount. It seems much more stable. I tested it on different monitors with different refresh rates. However, I’m not sure how resource-intensive this process is.

    What do you think?

    Subscribe to Construct videos now
  • is it possible to somehow stabilize dt? How do you deal with this? In my project it is very noticeable, as it requires high precision. And in "loops" where dt is used, objects shake. I tried to set the dt to a variable. But in this case it will not change when fps changes.

    youtu.be/YwMu_JnUIr0

    Subscribe to Construct videos now

    Tagged:

  • thank you all for your help. I think I should prepare a more detailed question.

  • Replace event 2 with:

    + System: For "" from 1 to int(distance(Sprite.X, Sprite.Y, Sprite2.X, Sprite.Y)÷Sprite.Width)

    + System: Pick last created Sprite

    + Sprite: [X] Is contact

    -> System: Create object Sprite on layer 0 at (Sprite(-1).X+Sprite.Width÷2×LoopIndex, Sprite.Y), create hierarchy: False, template: ""

    the thing is that my trajectory will not be straight. That's why I can't use distance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • could you guys look at this example?

    When I start the layout, I can see the process of creating of the sprites. But I'd like to create them instantly.

    Maybe you can advise how else I can make such an example?

    green sprites will be trajectory prediction points. And when they hit the obstacle, then stop creating, and the trajectory have to become shorter when the obstacle moves.

    The construction of the trajectory is very complicated, so I made a simplified version.

    drive.google.com/file/d/1234QoHW_sLxo-d2NV6qVSBtiX1ltYdtg/view

  • thank you very much. I have never used "while loop" before, I will study further.

  • Yes! I know. This is just a simple example. I want to understand, why a subevent doesn't work with "while" loop?

  • Hi. I can't understand, why does it work in the first case, but not in the second

  • you can just use "move forward" with "sine" behavior on the angle, with adjusted random parameters on it . And you can use "bound to layout" behavior, to keep the sprite inside the layout.