Generally speaking it's the CPU with the highest clockspeed in the series. Core counts stop mattering after a certain point eg. usually around 6 cores/12 threads, so the higher core count chips on the HEDT platforms like X299 and X399 can actually be detrimental to gaming performance.
For AMD the best gaming CPUs in each series would be R3 1300x, R5 2600x, R7 2700x, Threadripper TR2920x or possibly 2950x depending on how the Turbo behaviour on it works. Buying Threadripper for solely gaming is kind of stupid though, as games simply don't scale across that many cores.
For Intel most of their best gaming CPUs just released and are mostly not available in stores right now. The older 8th gen products are more available and are quite...