Article Update: Jittering


《Drifting : Weight of Feathers》

Steam - Steam Page
Itch.IO - Jittering
IndieDB - Jittering
UE4 Forum - Jittering

Jittering

Konpeko~

Character jittering is a common issue I've been dealing with since the beginning of my game development journey. If the jittering occurs persistently, it is usually easy to pinpoint the cause of the jitter and resolves it, however, there are times when the jittering occurs randomly and there is no stable way to reproduce it. The only way I can think of to deal with the latter issue is to place logs in every line of suspicious code that may cause the problem and hope the log will show up and give me further insight into the issue the next time it happens.

Besides the aforementioned brute force approach, as I encounter (and solved) lots of jittering issues in the past 2 years, over time, I noticed there are only 2 types of jittering in my game: tick sensitive and logic sensitive. Although knowing this could not help me solve the issue, or reproduce the issue, it often hinted at the right direction for me to continue the search, narrowing my bug targeting list to a manageable scale.

jittering comparison

(on the left side, the log on the top left corner literally prints out character entering and leaving wall sliding in a few frames - a symptom of tick sensitive jittering)

Tick sensitive jittering is a common issue in my project. The game provides an additional dimension for players to traverse (in multiple ways), meaning additional movement states and its transition in and out of other states need to be handled properly - jittering will likely occur if any 2 transition conditions happen to be true at the same time. From my past experience, if the 2 conditions are established due to geometry layout and not faulty game logic ex: jumping off a ledge could be rightfully interpreted as either falling down or wall sliding down, the jittering could be solved by delaying the check of one of the conditions - ie: delay the wall sliding condition check and let the player fall down for a short period then try to wall slide down.

wall-run jittering

(jittering only happens when the camera has a near-perfect alignment with wall-normal - I could reproduce the issue maybe 1 out of 30 trials, however, it is not an efficient way of solving the issue)

Although I use the word "faulty" in my previous statement, to be more specific, game-logic-induced jitterings are introduced by codes that do not respond very well with edge cases - it could produce the correct result 99% of the time and failed to do so in the 1% extreme case (that 1% usually occurs when you let other people try out your game for the first time). 

I wrote a wall running logic where the yaw rotation of the player is determined by the dot product of the camera forward vector and the wall actor's right vector - the algorithm performs as expected until a test-player found out my character is jittering while wall running vertically. I cannot find a stable way to reproduce the issue no matter how hard I tried, then it occurred to me - what if the player's camera is looking directly at the wall with near-perfect alignment? A near-zero number might fluctuate between positive and negative signs which might be the cause of the jittering. I proceed to add a buffer in the logic before determining the yaw rotation of the character - the jittering never happen again since then.

Character jittering like many other bugs is an issue that developers need to deal with continuously, there are no (as far as I know) general programming guidelines for us to prevent that from occurring, however, by solving each jittering issue, hopefully, we gain more knowledge on how logic work in our game and honed our skills for solving these type of issues in the future.

I hope you enjoy this short article, feel free to share your thoughts or story on this matter, have a superb weekend! (゚∀゚〃)

Get 《Drifting : Weight of Feathers》

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.