11-13-2022, 07:29 PM
(11-12-2022, 10:29 PM)TerryRitchie Wrote: I believe DSMan has solved the riddle of how the programmers did it. I started writing patterns down to see if I could store the frame counters into integers and lo and behold this pattern emerged:
Code: (Select All)123456789012345678901234567890123456789012345678901234567890
------------------------------------------------------------
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -24FPS(40%) 10010100101001010010 = 608850 = 94A52
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -27FPS(45%) 10101001010100101010 = 693546 = A952A
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -30FPS(50%) 10101010101010101010 = 699050 = AAAAA
1 1 11 1 1 1 11 1 1 1 1 11 1 1 1 11 1 1 1 1 11 1 1 1 11 1 1 -33FPS(55%) 10101101010101101010 = 709994 = AD56A
11 1 1 11 11 1 1 11 11 1 1 11 11 1 1 11 11 1 1 11 11 1 1 11 -36FPS(60%) 11010101101101010110 = 875350 = D5B56
11 11 11 1 11 11 11 11 11 11 1 11 11 11 11 11 11 1 11 11 11 -39FPS(65%) 11011011010110110110 = 898486 = DB5B6
11 111 11 11 111 11 11 111 11 11 111 11 11 111 11 11 111 11 -42FPS(70%) 11011101101101110110 = 908150 = DDB76
111 111 111 111 111 111 111 111 111 111 111 111 111 111 111 -45FPS(75%) 11101110111011101110 = 978670 = EEEEE
1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 -48FPS(80%) 11110111101111011110 = 1014750 = F7BDE
111111 11111 111111 111111 11111 111111 111111 11111 111111 -51FPS(85%) 11111101111101111110 = 1040254 = FDF7E
111111111 111111111 111111111 111111111 111111111 111111111 -54FPS(90%) 11111111101111111110 = 1047550 = FFBFE
1111111111111111111 1111111111111111111 1111111111111111111 -57FPS(95%) 11111111111111111110 = 1048574 = FFFFE
111111111111111111111111111111111111111111111111111111111111 -60FPS(100%) 11111111111111111111 = 1048575 = FFFFF
The patterns repeat three times over a 60 frame span meaning I can store the patterns in 20bit integers. Not sure how the Pac-Man coders got them into even smaller 16bit integers?
Now its a simple task of counting frames and ANDing the counter to the desired frame rate value. Easy peasy.
Thanks DSMan for your work and help with this.
This works fantastically! This is what I'm going to use from now on when assigning lower frame rates. This method gives me 5% of accuracy from 60FPS downward without using modulus division. Just simple ANDing is all that's needed. Much cleaner and faster.