My snake movement seems laging, what to do?

0 favourites
  • 6 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Here's the file

    https://www.dropbox.com/s/8g4tib5b41jix ... .capx?dl=0

    After a couple of days of trials and errors I figure out how to create a simple snake movement. But something is not correct with the snake bodies. Something is lagging.

    Anyone can figure out why?

  • It seem when the frame rate goes lower from 45, this lagging movement start to show. Giving the effect of the bodies are left behind.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • @ekajuan Hm, try to pin them, position only, maybe that helps... there are somme issues similar to that here:

    might be related to my issue, the second on. Ashley noted already, that there is an issue with the rounding engine. Try to take that out.

  • Also I would put the origin points not in the center, but where you want to have the joint between the body-parts. then it rotates around that. Otherwise you rotation, and set the position at the same time, cause the rotation center is off. That might cause the delay too.

    Like a chain, the joints are not in the middle, but at each end of the nods (or always the one in front in your case), thus causing the chain effect. Better to use that as rotation center, I am quite sure!

  • This basic premise of this snake movement design is to leave trail x and y position and the angle.

    Each of the body parts picks the last trail and angle left by of its previous head/body. In this case 15 trails away before the body parts start to pick up.

    The data is recorded in 3D array.

    Each level (z) is assigned for the head and each body part.

    x,y as you may guess to record the x and y position and angle of each instance.

    Since the data is recorded in every tick and the frame rate can go up and down, my guess is, the trail data is not always recorded at the same pace.

    My prediction is if I can insert the data in timely manner and not get influenced by the frame rate I probably could solve the problem.

    But then again, even if I add the wait for x seconds... before inserting the data, it does't help. Or maybe I did it wrongly.

    Round Engine.

    Since I don't use rounding engine, probably the problem is not there.

    Pinning

    I can't still get my head to simulate that. But I have seen the example of chain in the examples file. The movement is a bit different than what I have in mind.

    But I will try it maybe there's a way to utilize it.

  • @ekajuan

    Also I would put the origin points not in the center, but where you want to have the joint between the body-parts. then it rotates around that. Otherwise you rotation, and set the position at the same time, cause the rotation center is off. That might cause the delay too.

    Like a chain, the joints are not in the middle, but at each end of the nods (or always the one in front in your case), thus causing the chain effect. Better to use that as rotation center, I am quite sure!

    Still you can try that, no matter how you model movement itself. Even a snail consists of backbone-joints with this mechanics, def. better, you simulate that right.

    As far as Pinning goes, I meant: You can also pin position only, and detect/calculate the angle for the right behavior. Of course rope style etc. is not what you need. A snake has muscles in each part of its body, producing rather sine-waves when moving, than pulling itself along, like paralyzed. Sure that's not gonna work

    But you got that part right, I'm just saying, you could rework the joint-points, anyhow you solve positioning and angles.

    And yes, you do round: abs(round(Snake.Angle-Snake.old_angle)) and round(Snake.Angle) in your file...

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