Jump to content
  • Advertisement

C# 2.5D Beat 'Em Up Enemy AI Stuttering/Jerking

Recommended Posts

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


Share this post

Link to post
Share on other sites

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.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!