Advertisement

2.5D Beat 'Em Up Enemy AI Stuttering/Jerking

Started by January 16, 2018 04:06 PM
1 comment, last by Kylotan 6 years, 10 months ago

I am a game development student working on a 2.5D beat 'em up brawler game in Unity as my final year project and I've been working on the ai for the enemies in the game. However, I've been unable to get the enemies to working properly as the enemies would be constantly stuttering and jerking while trying to follow the player. I've created a foreach statement and added some conditions that call for the robots to spread out and stay away from the player if it is not in an engaging enum state. This has been an issue plaguing the ai for a while now, analysing the animator, it seems like the robot's movement is instantaneously stopping and going which might be the reason causing this stuttering. But I'm not sure how to prevent the robot's movement from stopping and going. If anyone knows the reason why this is happening to the robots it would be much appreciated as my project is due soon and I'm still unable to fix such a game breaking bug! I've included a few videos below showing what is happening to my robots and also the stuttering shown inside the animator. I've also included the full script for my robots.

 

Robots Stuttering

Robots Stuttering Animator

Robot.cs

There's only 1 video linked above.

You need to get into the habit of using debug output to track down what is happening. There should be no doubt over whether the robot is repeatedly stopping and starting - you need to be able to prove that. Adding Debug.Log calls which are output when you start or stop the animation or change its values would help here. You can also have animation events call back into your code.

You can also try running the game at a slower speed to help you debug it. Setting Time.timeScale to a small value like 0.1 or 0.25 makes it easier to see when things are happening and to watch log messages as they go by.

 

This topic is closed to new replies.

Advertisement