help! problems with Everytick and FPS

  • hello I hope the experts can help me

    I have this game of worms and I have problems with its tail, the tail is updated with an array, Everytick

    but when there are screen frame jumps, the queue of the gusando separates doing this ..

    this is easy to see when you change the window and come back

    I have created a red sprite "Everytick" to be noticed also when it fails

    the question is .. how could you solve this?

    I leave the link to try it

    wormgametest0315.netlify.com

    and capx link

    drive.google.com/open

    Thank you!

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes every tick affected by framerate, check dis link to see how to use dt and modify your events so not affected by framerate : construct.net/en/tutorials/delta-time-and-framerate-independence-71

  • Yep, I tried modifying your example to use dt, but I couldn't figure out how your array thing works.

    There are ways to make worm/snake easier, see these posts:

    construct.net/en/forum/construct-2/how-do-i-18/how-do-i-sprite-follo-wsprite-129668

    construct.net/en/tutorials/chain-of-sprites-with-pin-behavior-multi-sprite-snake-dragon-993

  • Isaske

    first of all, I think it works really well. that worm is pretty creepy! :)

    I had major trouble getting it to break apart, and it corrects itself so fast that I don't think it is much of a problem.

    There are only two things you can do to minimize the issue:

    1) each time you update the position of a body segment, check to see if it is more than the actual segment width from the previous segment (or head) - which is 33 pixels (but then shrinks as the segments get smaller). And if it is too far away, then calculate a position that wont leave a gap.

    2) or, make the segments twice as wide so there is more overlap. that way, if there is a glitch in frame rate, the worm can stretch out without showing a gap.

    I made a quick test to see what that would look like (you will obviously have to make your artwork look nicer). I also slightly changed the way the array works so you don't have to do so much overhead combining and then breaking apart the values you want to store (I made the array 2 dimensional instead of 1). I also pre-calculate the max array length. Anything you can do to reduce the work-load each tick makes things run smoother (and reduces the chance that you might drop a frame or two and get a gap).

    you can see my version here: https://www.rieperts.com/games/forum/worms.capx

  • plinkie and dop2000 thanks for answering

    AllanR thanks for optimizing my array!

    what you have done with the worm looks good, I think I can work with that thanks!

    although I would have liked to do it with maths like option 1, but I do not understand well how to do it

  • Isaske

    I took another look to see how I would do option 1 above... and it was easier than I first thought. I added a BodyWidth instance variable to the body segment so that we can compare the distance a segment is from the previous one, and if the distance is greater than the BodyWidth variable then we move up the array until we find a position that wont leave a gap.

    so download the file from the link above and give it a try! I couldn't make show a gap in the worm.

    another change I made was to move each body segment to the bottom as they were being created, so that the head is on top and the tail is on the bottom. I think it works and looks better that way. If you don't like it, just remove the "Move to bottom of layer" action in event 5.

    good luck with your game!

  • Excellent AllanR Now when the fps come down there are no big separations! just a few small movements that are not notorious, Thank you!

    I discovered that these jumps are the fault of the deltaTime, the head uses the bullet behavior and this uses the DT to move, and makes small jumps so as not to make the worm slow, and this is affected in the array, which captures the jumps too!

    if I eliminate bullet behavior and move my head with

    EveryTick -

    "movet a angle" = head.angle

    "distance" = 5

    then the jumps are eliminated!

    but it makes the worm slow when there are 40.50 fps

    Not all can be perfect!

    capx

    drive.google.com/open

    I also have another .. just add the behavior bullet in the body and each of them sige what lies ahead, does not pass exactly the same place as the head, that's why the trail of the hole appears in the last sprite of the body then it gives a feeling that if he does

    capx

    drive.google.com/open

    I don't know which one to choose XD

  • Isaske

    I definitely like the way body wiggles in your original version. it is very bug like! and feels more alive. I also like the tapered body.

    I would stick with the bullet behavior... the advantage of using dt is that you get the same game play on all devices. If someone has a high-end monitor with a really high fps rate, your worm would zoom around way too fast without dt. (or on mobile with low fps it will go way too slow)

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