I am talking bout real old skool games here, like early 80’s arcade stuff and old 8 bit computer games, but on a lot of them if you had a guy on the screen and you ran straight up, down, left or right you’d move slower than if you moved diagonally.
The issue sounds pretty odd but it’s easily answered and can be proved using Pythagoras Theorem.
If you push the left button, your guy on the screen moves 1 pixel to the left say, and if you push the up button your guy moves 1 pixel up the screen. Pretty straight forward yes.
Now if you push left and up at the same time then your guy moves up-left diagonally. This means he’s moved one pixel left and one pixel up in one move. The actual diagonal distance he’s travelled isn’t 1 pixel though, it’s actually just over 1.4 pixels, just like if you had a right angled triangle and the two shorter sides were 1 metre each then the hypotenuse would be just over 1.4 metres.
This means distance wise that every three straight the guy has travelled 3 pixels, but every three diagonal movements the guy has travelled over 4 pixels, hence why running diagonally gives you an advantage in old computer and arcade games, although usually the enemies had the same diagonal advantage too.
How to fix it? Well when you move diagonally, instead of shifting the guy one to the left and one up, shift him 0.7 to the left and 0.7 up and this will make the hypotenuse about 1. Of course ths screen itself can only display in whole pixels and will round up but as long as you don’t round up the actual x and y co-ordinates of the guy then he’ll skip a move every so often which slows him down to normal pace.
So why wasn’t this built into old arcade and computer games….Well there are three possible reasons:
1. It just wasn’t noticed to start with. (Unlikely)
2. It was noticed but people couldn’t be arsed to add the extra code to make it right.
3. Due to limited memory, there wasn’t enough space to add the additional code so programers just lived with it.