Are you trying to squeeze more points out of Donkey Kong? Are you willing to start doing silly things like timing your completion of the barrel screen with the flashing 1up in the upper left? If so, then this topic is for YOU!
So I was reading some DK code recently and I learned some pretty interesting things about pie factory. Firstly, here's some background on how fireball spawning at the start of the screen works on pie factory. Note that his applies to L5+ pie factory, I haven't looked into how this stuff works for L3 or L4 pie factory yet. Fireballs are spawned from two different places in the code that act independently at the start of pie factory. The first place spawns fireballs at regular intervals, specifically it spawns a fireball every 32 frames (On L4 it is 64 frames and on L3 it is 128 frames). The second place spawns one fireball after a certain amount of time on the screen has passed. The time that it spawns is fixed and never changes for different screens and ends up being around the time that the 4th fireball of the first code area is spawned. So in summary, 4 fireballs get spawned at regular intervals from the first code area and 1 fireball gets spawned from the second code area around the time of the 4th fireball from the first code area. This is why you sometimes see two fireballs spawn nearly together; it's because they were spawned from separate areas of the code.
Now, the time at which the first fireball of the 4 intervaled fireballs spawns can vary, and since the time of the next 3 intervaled fireballs depends on the time of the first, the point in time of all 4 intervaled fireballs can vary. In fact, there are a total of 32 different alignments in time for these 4 fireballs because of the fact that the fireballs spawn 32 frames apart. You may have noticed that very rarely on pie factory the final fireball appears to be delayed. This happens when the 4 intervaled fireballs are aligned in time such that the 4th fireball is spawned on the same frame that the second code are wants to spawn a fireball. Instead of spawning two fireballs on the same frame, what happens is only 1 fireball gets spawned and so the second code area essentially does nothing and all 5 fireballs end up getting spawned at regular intervals from the first code area. This will happen with probability 1/32 if you don't try to time things to avoid it, which I will show is possible to do.
So it turns out that it is possible to control to a certain degree which of the 32 possible alignments in time the 4 intervaled fireballs have. This is where the flashing 1up in the upper left of the screen comes in. This flashing 1up actually uses the same frame counter to flash itself that the fireballs use to spawn. It will appear for 16 frames, then disappear for 16 frames, so in total it has a period of 32 frames, which conveniently is the same as the interval between fireballs. This means that there will be a one-to-one correspondence between the frame in the flashing 1up cycle in which you finish the previous barrel board and the alignment in time of the 4 intervaled fireballs.
To make things more precise, I will number the 32 frames of the 1up cycle in hexadecimal as follows: The first frame in which the 1up appears will be frame 0x0, the frame number will count downwards modulo 32 so that the next frame will be 0x1f, then 0x1e all the way down to 0x11, which will be the last frame that the 1up is on screen. Frame 0x10 will be the first frame in which the 1up is off screen and will count down all the way down to 0x1 which is the last frame that the 1up is off screen at which point the 1up will appear again and we end up back at frame 0x0. I am using this numbering so that the lowest 5 bits of the frame counter, which has RAM address 0x601A, is equal to the frame number in the 1up cycle. So you can always tell which frame you are on if you look at address 0x601A in RAM watch.
As mentioned before, the frame number in the 1up cycle on which you finish the previous barrel board determines which of the 32 possible alignments in time the 4 intervaled fireballs will have. For reference, here are a few frame numbers on which you can finish the screen and resulting fireball timing on the next screen:
0x19 - This will cause the 4 fireballs to spawn at the latest possible time
0x1A - This will cause the 4 fireballs to spawn at the earliest possible time
0x14 - This is the special case described above where the two code areas both want to spawn a fireball on the same frame which causes the last fireball to be delayed
So an example of a way that you can use this to your advantage is to finish the previous barrel screen somewhere during frames 0x1 to 0x10, or in other words, while the 1up is off screen. This would avoid finishing on frame 0x17 hitting the special case where the last fireball gets delayed. Now, this may not seem too important since you are avoiding something that only would happen with probability 1/32 anyway, and isn't even that bad if it does happen either, but there are actually more significant consequences of the timing of the 4 intervaled fireballs.
The time at which the first pie comes on screen is determined by the time at which the first fireball spawns. So by controlling when the first fireball comes on screen you are also controlling when the first pie comes on screen, and in fact you are controlling the timing of all remaining pies as well since after the first pie, the rest of them spawn at regular intervals. The timing of the pies is actually important. The 5th pie to spawn on the screen spawns around the time that the lower conveyor reverses direction. This pie is actually a very common pie to smash with the bottom hammer. If it spawns to early, while the lower conveyor is still moving left, then you will never be able to smash it. Actually, my current pie factory strategy involves getting that pie to spawn while the middle conveyor is moving outwards so that the pie is guaranteed to spawn on the bottom and give me smash (read
this post and a few others I made after for more details on this). So, if the pie spawns before the lower conveyor reverses direction it is costing what would be a 525 point (on average) smash.
After some testing I found that if you finish the previous barrel screen on 1up frames 0x1a to 0x1f or 0x0 to 0x2 the first pie will spawn too early and you will get screwed out the pie smash. This is a total of 9 out of 32 frames which will happen with probability 28% if you don't actively try to time the completion of the barrel screen. So timing your completion with the flashing 1up can actually amount to a difference of a fair amount of points throughout an entire game (I estimate around maybe 2k point difference on average, considering I go for the bottom hammer quite frequently).
Besides that, I also looked into other ways to exploit your ability to control the pie timings. One thing I looked for is methods of setting up the timing so that you can get a guaranteed 4 smashes with the bottom hammer while the middle conveyor is moving outwards instead of the typical 3 (again, read through some posts
here or none of this will make any sense). I found that if you finish the barrel screen on 1up frames 0x8 to 0x10 (not sure if these bounds are totally right) and then you jump exactly 4 times on the lower conveyor before grabbing the bottom hammer the timing will work out so that you will get 4 guaranteed smashes with the bottom hammer while the middle conveyor is moving outwards, plus a possible 5th smash. I'm not sure how useful this is since it's very hard to execute (not to mention dangerous if there are fireball threats) unless there are no pies on the bottom conveyor (the major problem with pies being there is that they can waste your time and cause you to grab the bottom hammer too late, after the middle conveyor has already reversed direction).
As far as timing the completion of the barrel screen with the flashing 1up, it may be easier to get the timing right if you instead try to time the moment you mount the final ladder instead of trying to time your completion of the screen. If you do this you will have to convert the frames I talked about above on screen completion to frames at the time of mounting the final ladder.
Anyway, I'm curious if other people can come up with any pie techniques involving manipulating the pie timings and the middle conveyor direction to maximize the smashes with the bottom hammer.