If you want a thing done well, do it yourself. Part 3

So since my last post, I've done the following:

  •  Implemented
    • Swipe to Boost system
    • Simple HUD colours
    • Linear Dampening into the Movement system
  • Cleaned up the spaghetti code
  • Fixed the following bugs:
    • Double tap for break isn't not working correctly in all circumstances
    • Player can move while break is held
  • Decided to ignore for now:
    • Fixing the PC controls
    • The 1-2 second hitches (caused by garbage collection)
  • Discovered a bug with the way UE4 handles touch input.

Games development is inherently illogical.

If you hold down the virtual joystick on one area of the screen (Touch 1) and then begin tapping on the other side of the screen (Touch 2) infrequently the InputTouch Released event will trigger for both the Touch 1 and Touch 2 event.

This occurs even though Touch 1 is still held down, causing the virtual joystick I created to "cease functioning as intended" dev speak for break.

Logically, that print should never fire. "Logically"

Lets work through this, we get the InputTouch - Released event. This only triggers when we stop touching the screen with any one of our fingers, we then check to see if the finger that was released was Touch 1, if it was we then check to see if Touch 1 is still pressed down.

You can see that Touch 2 (Blue) occurs and as I physically release Touch 2. The game triggers a release on Touch 1 (Green), which triggers the illogical print to fire and then releases Touch 2.

Fortunately we can work around a bug once we know what the bug is, all we need to do is add an extra bool and check to see if Touch 1 is still held.

The mind boggles.

No comments: