  Multiplayer games on graphs are at the heart of theoretical descriptions of
key evolutionary processes that govern vital social and natural systems.
However, a comprehensive theoretical framework for solving multiplayer games
with an arbitrary number of strategies on graphs is still missing. Here, we
solve this by drawing an analogy with the Ball-and-Box problem, based on which
we show that the local configuration of multiplayer games on graphs is
equivalent to distributing $k$ identical co-players among $n$ distinct
strategies. We use this to derive the replicator equation for any $n$-strategy
multiplayer game under weak selection, which can be solved in polynomial time.
As an example, we revisit the second-order free-riding problem, where costly
punishment cannot truly resolve social dilemmas in a well-mixed population.
Yet, in structured populations, we derive an accurate threshold for the
punishment strength, beyond which punishment can either lead to the extinction
of defection or transform the system into a rock-paper-scissors-like cycle. The
analytical solution also qualitatively agrees with the phase diagrams that were
previously obtained for non-marginal selection strengths. Our framework thus
allows an exploration of any multi-strategy multiplayer game on regular graphs.
