{'fraction_non_alphanumeric': 0.030390277594542787, 'fraction_numerical': 0.011307107879277028, 'mean_word_length': 4.9548962521373445, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
From Motor Control to Team Play in Simulated Humanoid Football

Intelligent behaviour in the physical world exhibits structure at multiple spatial and temporal scales. Although movements are ultimately executed at the level of instantaneous muscle tensions or joint torques, they must be selected to serve goals defined on much longer timescales, and in terms of relations that extend far beyond the body itself, ultimately involving coordination with other agents. Recent research in artificial intelligence has shown the promise of learning-based approaches to the respective problems of complex movement, longer-term planning and multi-agent coordination. However, there is limited research aimed at their integration. We study this problem by training teams of physically simulated humanoid avatars to play football in a realistic virtual environment. We develop a method that combines imitation learning, single- and multi-agent reinforcement learning and population-based training, and makes use of transferable representations of behaviour for decision making at different levels of abstraction. In a sequence of stages, players first learn to control a fully articulated body to perform realistic, human-like movements such as running and turning; they then acquire mid-level football skills such as dribbling and shooting; finally, they develop awareness of others and play as a team, bridging the gap between low-level motor control at a timescale of milliseconds, and coordinated goal-directed behaviour as a team at the timescale of tens of seconds. We investigate the emergence of behaviours at different levels of abstraction, as well as the representations that underlie these behaviours using several analysis techniques, including statistics from real-world sports analytics. Our work constitutes a complete demonstration of integrated decision-making at multiple scales in a physically embodied multi-agent setting. See project video at https://youtu.be/KHMwq9pv7mg.


Introduction
Allen Newell, in his classic remarks describing the foundations of both cognitive science and AI (1), pointed out that human behaviour can be understood at multiple levels of organisation, ranging from millisecond-level muscle twitches, to cognitive-level decisions occurring on the order of hundreds of milliseconds or seconds, to longer-term socially informed goal-directed sequences, playing out over minutes, hours or days. To illustrate this, consider three friends carrying a sofa up a flight of stairs to their new apartment: Although they are aiming at a goal which persists over many minutes, their actions will also be shaped by shorter-term considerations (get the sofa around a corner), and those actions are ultimately executed as muscle contractions on a much finer time-scale. Furthermore, although the impact of each muscle contraction is most immediately on the body itself, each must be chosen to result in outcomes defined in terms of a much larger dynamic context, including both inanimate objects (the stairs, the sofa), as well as other agents (the friends) who are executing actions of their own. As Newell observed, the ability to coordinate across all these levels of abstraction is one of the most remarkable aspects of human behaviour, and it raises the question of how low-level motor commands are organised to support cognitive-level decisions, and ultimately high-level goals and social coordination.
In the years since Newell's writing, remarkable progress has been made in understanding how intelligent behaviour can be generated, primarily through a research strategy that focuses on individual levels of abstraction at a time. Entire disciplines have dedicated themselves to understanding particular aspects of the full problem individually, studying motor control and goal-directed behaviour, (e.g. [2][3][4][5][6], the origins of cooperative behaviour (e.g. 7), or the mechanisms underlying movement coordination in groups of animals and humans (e.g. 8). In a similar vein, enabling machines to produce agile, animal-like movement has long been a goal of robotics research (e.g. 9, 10); and the naturalistic movement of physically simulated characters has been studied in the computer graphics community since the early days of animation (e.g. [11][12][13][14][15]. Recently, learning-based approaches have successfully tackled a number of challenges in artificial intelligence, including problems requiring hierarchically structured behaviour and long-horizon planning (e.g. 16,17) and multi-agent coordination (e.g. 18,19). They have also shown promise generating complex movement strategies for simulated (e.g. [20][21][22][23] and real-world embodied systems (e.g. [24][25][26]. However, the multi-scale organization of behaviour, highlighted by Newell and inherent to many real-world scenarios, continues to pose a problem for designers of embodied artificial intelligence systems. Although it has long been acknowledged that intelligent embodied systems require the integration of multiple levels of control (e.g. 27,28), the principles that underlie the design of such systems remain poorly understood (e.g. 6), and successful examples are limited (e.g. 25,[29][30][31]. For instance, a divide-and-conquer approach would suggest a decomposition into a hierarchy of modules with welldefined interfaces. But for many scenarios, including the example above, a "natural" decomposition is often non-obvious, and an unsuitable one can significantly impair the performance of the system. Similarly, for learning-based approaches, the specification of a single objective function that would allow efficient learning of complex, multi-level behaviour can be difficult, as will its optimisation. And while a decomposition into multiple smaller learning problems may facilitate specification, credit assignment and exploration, it raises the question how such sub-problems should be integrated. In this paper, we build on prior work on learning intelligent humanoid control (22,23,(31)(32)(33) and investigate this problem through a case study of football with simulated humanoid players. We develop a framework based on deep reinforcement learning (Deep-RL) (34)(35)(36)(37)(38)(39) that addresses several of the challenges associated with the acquisition of coordinated long-horizon behaviours and leads to the emergence of coordinated 2v2 humanoid football play.
Modern team sports highlight many of the challenges for integrated and coordinated decision making and motor control present in ethologically important activities. This has long been recognised in the robotics community where football, in particular, has been a grand challenge since 1996, with the aim of the RoboCup community to beat a human football team by 2050 (40,41). Playing competitively in a game of football requires decisions at different levels of spatial and temporal abstraction -"low-level" fast timescale control of the complex human body produces "mid-level" skills such as kicking and dribbling in the service of "high-level", long-term, goal-directed behaviour such as scoring as a team. Importantly, these levels of decision making are intimately coupled: for instance, the success or failure of a pass depends as much on a shared understanding of the situation and the players' ability to agree on a joint course of action as it depends on their ability to precisely control their movements. We introduce a simulated football environment that reflects a subset of the challenges of the full game of football, focusing especially on the problem of movement coordination. It extends the environment suite of (23,31,33,42) and comprises teams of fully articulated humanoid football players, capable of agile, naturalistic movements, while realistically simulated physics and the presence of other players allow complex coordinated strategies to emerge. The richness of possible behaviours, the need to coordinate movement with respect to a dynamic context including ball, goals, and other players, and the fact that low-level movement and high-level coordination are tightly coupled, without any obvious well-defined behavioural abstractions, make this setting a suitable testbed to study multi-scale decision making for embodied AI. While prior work has studied motor control, long-horizon behaviour, and multi-agent coordination in isolation, the football environment combines them into a single challenge.
Our training framework consists of a three-stage procedure during which learning progresses gradually from imitation learning for low-level movement skills, to reinforcement learning of training drills for the acquisition of mid-level skills, to multi-agent reinforcement learning for full game play. This makes use of prior knowledge from imitation where available, while the auto-curriculum that emerges from self-play in populations of learning agents allows the discovery of complex solutions that would be difficult to specify through reward or learn from imitation. With the gradual acquisition of skills of increasing complexity, the mix of different forms of learning that lie on a spectrum between imitation and deliberate practice as well as the repurposing of existing skills, our framework bears some loose similarity to human learning (e.g. [43][44][45][46]. In particular, it provides a practical solution to challenges including behaviour specification, credit assignment, and exploration. Importantly, the framework exploits the modularity of the learning problem, and relies on explicit representations of low-and mid-level skills, but it still allows for seamless integration of the final behaviour across all levels of abstraction. Although we instantiate our framework for football, the underlying principles are general and should be applicable in other domains, including other team sports or collaborative work scenarios (e.g. 23).
We demonstrate that the training framework results in the emergence of sophisticated movement, football skills and team-level coordination. The players exhibit human-like, agile, and robust contextdependent movement and ball-handling skills such as getting up from the ground, rapid changes of direction, or dribbling around opponents to make accurate shots. These movement skills enable cooperative play, that progresses from individualistic behaviour to more coordinated team tactics such as moving into space, defensive positioning, and passing. We develop several techniques for the quantitative analysis of the players' performance as well as their behavioural strategies and internal representations. We combine techniques previously employed in AI research (e.g. 18,47) with techniques from real world sports analytics (e.g. 48,49). Game performance is positively correlated with robust movement skills, but also with coordination and team-level tactics as well as the ability to predict the behaviour of opponents and teammates. The players show an understanding of the value of teammates possessing the ball, and their intention to score or move the ball up-field, similar to observations made for human football players (e.g. 50,51).
The supplementary video provides an overview of the environment, training framework and agent behaviours. 2 The paper is structured as follows: in Section 2 we introduce our novel multiagent environment and in Section 3 we discuss our training framework. In Section 4 we outline the experimental procedure. In Section 5 we present results and provide a quantitative analysis of the evolution of individual players' movement skills and team-level strategies. In Section 6 we analyse the players' learned representations and "understanding" of the game. We provide an ablation of different components of our framework in Section 7. In Section 8 we review different lines of research that are brought together in our work. We conclude with a discussion in Section 9.

Environment
For this study we extend the suite of simulated humanoid environments of (23,31,33,42) with a multi-agent football environment. It is designed to embed sophisticated motor control in a task that requires context dependent behaviour, multi-scale decision making, and multi-agent coordination in a setting suitable for end-to-end learning. We build on the environment of (47), and replace the 3 degrees of freedom player body with a fully articulated, 56 degrees of freedom humanoid used in studies of humanoid control (23,31,33). 3 Figure 1 provides an overview of the environment.
The environment adheres to a standardized environment interface (42) and is simulated by the MuJoCo physics engine (52), which is used extensively in the machine learning and robotics research community (20,21,(53)(54)(55)(56). The standardized environment interface makes it easy to use in reinforcement learning experiments, and it can be said to be realistic in the following sense: we make no simplifications of the rigid body dynamics; players bodies have realistic masses and joint force limits, and must locomote using torques applied at the joints, causing foot contact and friction forces with the pitch. That said, there are many aspects which are unrealistic with respect to human or robot football. Most notably, there are no neural delays, muscle dynamics, tendon-driven actuation or fatigue. However the principle of locomotion via controlled torques and friction remains intact. Embodiment 56 degrees of freedom. Fully actuated. Physically realistic.

Rules
Two teams of two players. Ball enclosed in field of play and is reflected. Players can travel outside field of play up to walls.

Scoring
Agents rewarded when ball travels across goal line. Players and ball reset across field upon scoring.  We study 2v2 football. The ball reflects from the touchlines and goal lines (i.e. no throw-ins), however players can travel beyond, up to the physical hoardings. Contacts between all players, walls, goals and the ball are simulated. (C) Both agents on a team receive reward when the ball travels through their opponents' goal, at which point all players and the ball are reset in random locations and the episode continues. We show that with an appropriate learning scheme in this setting, agents can be trained that exhibit proficiencies at multiple scales: (D) Body control: moving their highly articulated bodies to stand, run, get up from falls and to jostle with opponents; (E) Ball control: using their bodies to manipulate the position of the ball, moving it across the pitch, passing with teammates, and shooting towards the goal; (F) Pitch control: using the aforementioned skills to pressure the opposing team, to take advantage of open space, and to gain situational advantages in order to score goals. radius of the ball as well as the goal sizes follow the FIFA regulation sizes adjusted in proportion to the humanoid body height. 5 The pitch size is sampled within a range at the start of each episode, scaled proportionally to the number of players. 6 To emulate the football rules, the players can travel outside of the boundaries of the pitch (but cannot travel outside of the gradient-coloured physical hoardings), whereas the ball "bounces off " of the pitch boundary. This simplification removes the need for a throw-in mechanism, and leaves the physics simulation to determine the range of strategies that players can execute (including deliberately bouncing the ball off the pitch boundary). Within an episode, if either team scores, the game resets with the same initialization logic as executed at the start of an episode and continues to the next timestep. Episodes can consist of multiple scoring events and training matches last 45 seconds.

Environment
Observation and Actuation Each agent observes their own physical state through a set of proprioceptive measurements: joint angles, joint velocities, root orientation with respect to the world vertical axes, as well as sensory readings including accelerometer, velocimeter, and gyroscope. Exteroceptively, an agent observes other players and physical objects in the scene such as the ball and goal posts via a narrower set of physical observations: position, velocities, and orientation projected onto their own egocentric coordinate frame. 7  In this section we describe our three-stage learning framework, during which agents acquire increasingly complex competencies. In Section 3.2 we describe the acquisition of low-level movement skills via imitation learning from human motion capture data. The result is a general-purpose motor module that controls the players' movements and translates a motor intention into joint actuation that leads to realistic human-like movements. We use this motor module as part of the agents that we train in the second and third stage. In the second stage (Section 3.3) we train agents to solve a suite of football-specific training drills. The resulting behaviours are compressed into reusable skill policies, or drill priors that capture general locomotion and ball-handling skills. Finally, in the third stage 5 We use FIFA 5-vs-5 regulation ball radius of 11cm, goal length of 3.66m scaled by the ratio of simulated humanoid body height of 1.5m to the average human body height of 1.75m. 6 For each episode, we randomly sample a per-player area between 100sqm and 350sqm, or 40% of the 5-vs-5 FIFA regulation pitch sizes. 7 Observations are such that the position of the ball, goal posts and pitch boundaries can be precisely determined, but other players are only partially observed via positions of hands, feet and pelvis.

Low-level skills
Mid-level skills High-level skills  an example frame of the motion capture behaviour (grey) and the low-level controller optimized to reproduce matching behaviours (beige). (B-E, H-I) illustrations of the four mid-level drill tasks and their corresponding training procedures to obtain per-task expert policy and subsequently per-task, uninformed drill prior. (F, J-K) an example frame of a 2v2 football match with the two teams sampled from the population of agents. The agents are optimized end-to-end by RL, reusing the low-level controller while regularized towards pre-trained drill priors.
(Section 3.4), agents acquire long-horizon coordinated football play. This is achieved by training them in the full game of football while guiding exploration with mid-level drill priors. The final stage takes advantage of explicit representations of low-and mid-level skills to speed up training and avoid local optima but circumvents common issues where such representations restrict the final solution in undesirable ways.
An overview of the three stages of the learning procedure is provided in Figure 2. In stage 2 and 3 we train populations of players by reinforcement learning using a hybrid, two-timescale optimization scheme similar to that employed in (18). We describe the general problem definition for this training setup, the agent architecture, and the meta-optimization scheme in Section 3.1.

General Training Setup
We model each of the tasks (the football game and the training drills) as a multi-agent reinforcement learning (MARL) problem using the framework of -player Stochastic Games (58) (see Appendix B.1 for more detail). For the football task = 4, but our training drills are single-agent tasks with = 1. In game G , at each timestep , each player ∈ {1, . . . , } observes = ( ), which are features extracted from the game state , by the players observation function , as described in Section 2. Each player then independently selects a 56-dimensional continuous action ∈ A to control the humanoid (see Section 2). Actions are sampled from the player's (stochastic) policy, ∼ (·|ℎ ), as a function of their observation-action history ℎ := ( 0 , 0 , 1 , . . . , ). These interactions give rise to a trajectory = ( , 1 , . . . , , ,1 , . . . , , ) ∈ [ ] , over a horizon , where the game state transitions according to the system dynamics +1 ∼ (·| , 1 , . . . , ), and the player receives reward as a function of state , = ( ). Action sets are consistent across tasks, and observation and dynamics are partially consistent, which enables skill transfer across the family of tasks.
The objective for a policy in task G is to maximize expected cumulative reward, where expectation is over the system dynamics, the sampling of player index to be controlled by policy , and coplayer policies \ := ( 1 , . . . , −1 , +1 , . . . , ), and the sampling of actions from the appropriate player policies { : ∈ [ ]}. 8 In the football task, denoted by G 0 , players receive a reward of +1 (-1) on the terminal state when their team wins (loses) the match, or 0 if the match ends in a tie.

Outer-Loop Optimization with Population-Based Training
For task G , we train a population of reinforcement learning agents, W = { : ∈ [|W|]}, which learn the task, as described in Section 3.1.2. In practice, each agent is a collection, = ( , , ℎ ), of policy network parameters , network parameters of an auxiliary action-value function , and hyper-parameters of the learning process ℎ . In the multi-agent football task the population of agents play against each other as opponents but, otherwise, the agents are deployed independently in the single-agent drills.
For several tasks Equation 1 is difficult to optimize with RL. This is particularly true for the football task where the reward is sparse and has high variance. The reward also provides no direct information Algorithm 1 Meta-Optimization with Population-based Training.
1: procedure P B T 2: Let { } denote independent agents forming a population W, optimizing for a task . 3: for agent in W do 4: Initialize agent network parameters and agent fitness to fixed initial fitness .

5:
Sample initial hyper-parameters ℎ from the initial hyper-parameter distribution. for agent with opponent \ , states ( 0 , . . . , ) ∈ Episodes do 10: on how to play football well, or which behaviours may be useful, resulting in a challenging longhorizon exploration problem. We therefore define parameterized surrogate objectives {J : ∈ [ ]} which are easier to optimize by reinforcement learning. The surrogate objective for agent is denoted by J ( ; ℎ ), with ℎ including parameters of the surrogate objective. In the inner loop, J is optimized with respect to via RL as described in Section 3.1.2.
For each task, we use population-based training (PBT, (59)) as an optimizer over the population W to perform several functions: • Optimize the hyper-parameters ℎ of the surrogate objective J to provide a well-shaped learning signal for individual learning agents such that by optimizing J , with RL, the agents effectively optimize the original objective of the task (Equation 1). • Optimize other hyper-parameters that control the learning dynamics, such as learning rates.
• Implement a mechanism that increases the proportion of high-performing agents in the population, resulting in an automatic curriculum over the strength of coplayers in the football task.
In Algorithm 1 we specify the implementation of the outer loop in terms of several subroutines: Eligible controls the frequency of evolution events based on the number of environment interactions that took place since the last evolution. Select samples a pair of agents for evolution, where the child agent corresponds to the agent with the minimum fitness and the parent selected uniformly at random. Mutate and Crossover define the exploration strategy for the inherited hyper-parameters ℎ . UpdateFitness implements the rules for population fitness updates, based on the resulting episodic returns following interactions between population members. Concrete implementations of Updat-eFitness depend on the task, and specific hyper-parameters and are provided in Section 3.3.1 and Appendix B.7.

Inner-Loop Optimization with Reinforcement Learning
For each task G we introduce a set of shaping rewards {ˆ( , ) : ∈ [ ]} each associated with a discount factor , and a coefficient , , which enable adjusting the relative importance and horizon of each reward component individually. The surrogate objective for an agent with policy parameter and hyper-parameters ℎ , is a discounted infinite horizon sum of the form where expectation is over the system dynamics, sampling of actions from player policies, and, in the multi-agent football task, the assignment of policy to control player and sampling of coplayers \ . 9 Given fixed hyper-parameters , ∈ ℎ , determined by the outer-loop optimization, the network parameters , are optimized by RL using Maximum a Posteriori Policy Optimization (39) as described in Appendix B.2. The precise reward functions optimized by J depend on the specific task and are described in Sections 3.3 and 3.4.

Agent Architecture
The agent first processes proprioceptive and task-specific observations using feature encoders parameterized using multi-layer perceptrons (MLP). An order-invariant attention module is used to further process observations of coplayers. Since optimal policies in multi-agent environments are, in general, a function of the interaction history, LSTM modules (60) then process history in the policy and action value functions. See Appendix B.4 for more details.

Stage 1: Learning Low Level Motor Control Using Human Data
To play football well, dynamic movements are required. To bias our agent's behaviour towards realistic and useful movements, we learn a motor primitive module by imitation of football motion capture data. We used roughly 1 hour and 45 minutes of football motion capture data collected from "vignettes" of semi-natural scripted scenes of football gameplay. Although the data contains ball interactions, the ball was not part of the tracked data. We registered all of the point-cloud data onto the humanoid model. For more details see Appendix B.3. To build the low-level controller (see Figure 2G) we used a two-stage pipeline consisting of tracking motion capture clips with individual policies, followed by distillation of the tracked behaviours into a single low-level controller. This approach follows previous work (23,33); the architecture is referred to as a neural probabilistic motor primitive (NPMP) model. In particular, these previous works have demonstrated that distilling trajectories into an inverse model with a latent bottleneck that is trained to reconstruct the action as a function of the current state and the future-state trajectory produces a reusable motor controller. To achieve this, we first cut the motion capture data into 4-8s snippets and trained separate time-indexed "tracking" policies by reinforcement learning to imitate each snippet. The reward function for tracking was the same as that used in (61).
In the second step, we sampled multiple trajectories from each tracking policy, with noise added to the actions to induce variations and witness the corrective behaviour of the tracking policy; we then used a supervised training approach to distil these sampled trajectories into a single neural network controller. More specifically, each training trajectory was obtained from a tracking policy by starting the episode at a random time within the corresponding reference motion snippet and performing a rollout until the end of the reference clip, acting according to the tracking policy in the presence of action noise. Given a set of T trajectories {(( ( ) , ( ) )) ∈ {0,..., } } ∈ [ T ] , consisting of proprioceptive state features ∈ X and noiseless actions ∈ A from the tracking policies, we can train the motor module, , according to the supervised objective where is a latent variable that represents the future trajectory and the distribution ( | −1 , +1: + ), which is optimized, corresponds to an encoder that produces these latents, given short look-aheads into the future. As a result of the training on expert motor behaviour, and specifically by encoding the future lookaheads, the latent variable can be interpreted as a motor intention, because the latent variable determines what behaviour the low-level controller will generate for a short horizon into the future. See Appendix B.3 for specific network details. The relevant part of the model that is subsequently used as a low-level controller is the decoder ( | , ), which produces actions in response to both the current state and a latent variable.
The above training procedure yields a plug-and-play low-level controller, used, without further training, in the remainder of the present work. For football and drill training, instead of producing behaviours by operating at the level of raw per-joint actions, football agents are trained to produce 60-dimension continuous latent motor intentions, , that are fed into the fixed low-level policy, together with the proprioception input ∈ X. Reinforcement learning is performed in the latent motor-intention space. This approach effectively reconfigures the control space so that random exploration in the latent motor intention space is more likely to produce realistically correlated actions and useful humanoid motion.

Stage 2: Acquiring Transferable Mid Level Skills
By design, the motor module from Section 3.2 constrains the space of low level movements but does not directly produce temporally extended movement patterns. The motor module does not directly encourage interaction with the ball or any other goal directed behaviour relevant for football. To learn mid-level skills including running, turning and balance, as well as football-specific dribbling and kicking skills, we train players to learn a syllabus of training drills, listed in Table 2. These prelearned skills are then used to accelerate learning of the full football task.

Learning Task-Specific Expert Drill Policies by PBT-RL
For each drill G we train a population of task-specific expert policies (see Figure 2H). We use the general setup of Section 3.1. We reuse the low-level motor primitives developed in Section 3.2: drill experts output motor intentions to the fixed NPMP module, and RL is effectively performed in the latent motor intention space.

Fitness Measure and Expert Selection
The drill objectives are defined in terms of reward functions that characterize the desired behaviour, yielding a fitness F ( ) = =1 ( ) , recalling Section 3.1.1 (Equation 1). Specifically, we choose the reward function for shoot to be the binary indicator function of the ball reaching the goal; and for dribble we choose a measure of closeness between ball

Follow
The agent must follow a moving target that moves at fixed velocity for a short episode and in variable directions. The target velocity is randomized at the start of the episode. The agent observes the current target and the future position of the target, so that the agent can anticipate where the target will move and prepare accordingly.

Dribble
The environment is similar to the follow drill but the agent must keep the ball close to the moving target.

Shoot
The ball is initialized randomly on the pitch and the agent has a budget of three ball contacts with which to score a goal. 10 Kick-to-target The agent has a small window of time (randomized between two and six seconds) in which to manoeuvre the ball and kick it to a distant fixed target. . For instance, the kick-to-target drill introduces a reward for maximizing ball-to-target velocity, while the shoot drill rewards positive player-to-ball velocity to encourage ball interaction early in the training. We provide further details in Appendix B.5.

Distilling Expert Drill Policies into Transferable Behaviour Priors
Each drill utilizes task-specific context which the expert policies observe. For instance, in the follow and dribble drills the agent is required to follow a virtual target. To obtain transferable skill representations that are target-agnostic and can be reused in the football task we distil the expert policies into drill priors { : ∈ [4]} (see Figure 2I). The priors are trained to mimic the drill expert policies {¯: ∈ [4]} but only observe features that are available in the football task. These include proprioception, and in the case of dribble, shoot and kick-to-target, the ball. In the case of shoot we exclude the goal position from the drill prior observations so that the prior learns a general kicking policy. See Appendix A.3 for details.
The priors are trained by minimizing the KL-divergence with the expert in the latent motor intention space: where expectation is over the distribution over trajectories, sampled from a replay buffer, encountered when acting with the expert policy¯in a sampled instantiation of task ; ℎ = ( 1 , 1 , 2 , . . . , ) is the observation-action history at time from the perspective of the drill expert¯; andh is the observation-action history in terms of the prior's reduced observation set. The resulting drill priors reproduce the behaviour of the experts (dribbling the ball, turning and speeding-up and slowing down, for example) but do so without being prompted by a specific target. For instance, the dribble prior will favour behaviour patterns that involve dribbling the ball, independently of the direction and speed. 11

Stage 3: Achieving Long-Horizon Coordinated Football Play
In the final stage of training, players learn the full football task using the general two-timescale optimization setup of Section 3.1 to train a population W of football players (see Figure 2J-K). We describe the fitness measure which drives PBT in the outer-loop and then describe the inner-loop optimization using Multi-Agent Reinforcement Learning. We make use of behaviour shaping, using the low-and mid-level skills acquired in the first two stages as well as additional shaping rewards.

Outer-Loop Optimization for Football
We use the outer-loop optimization procedure described in Section 3.1.1. In contrast to Stage 2 (cf. Section 3.3), agents play against each other in multi-agent games. Competitive play within a population, combined with a mechanism to propagate high-performing policies through the population, induces an autocurriculum in which environment difficulty (determined by the strength of opponents in the population) is effectively calibrated to a practical but challenging level to learn from (64). Next, we specify the matchmaking and fitness measure used.
Matchmaking We concurrently optimize the population W of agents, individually learning from their first-person experience, in football matches, in a decentralized fashion. To form a match, we sample a pair of agents uniformly with replacement from the population W. At the start of an episode, we make two separate instantiations of each agent's policy (clones) which are paired to form a team of two players, and the two teams then compete. During execution, agents act independently, without access to other agents' actions, observations or other privileged information -agents must observe their opponents and also their teammate from a third-person perspective while deciding on their optimal course of actions.

Fitness Measure for Football
In the multi-agent football task we use Nash Averaging (65) as the fitness measure to drive our PBT mechanism. This measures the performance of each agent against the distribution of agents in the Nash equilibrium, the definition and implementation details of which are provided in Appendix B.7.

Behaviour Shaping with Mid-level Skills
To assist exploration and the discovery of mid-level behaviours useful for soccer, we bias the behaviour of the players towards the mid-level skills described in Section 3.3. This leads to sparse rewards being encountered sooner and can help avoid poor local optima in locomotion and ball handling behaviour. We define a loss L priors , to be used as a regularizer, that penalizes the KL-divergence, in the latent motor intention space, between the players' football policy and a mixture distribution constructed from the four prelearned transferable drill priors. The loss for agent ∈ W, with policy , is defined as: 11 This is a consequence of the loss in Equation 4 which trains the drill priors to match the mixture distribution that arises from executing the drill expert for different target choices (see 62, 63, for details).
where expectation is over the sampling of trajectories from a replay buffer (Section 4.3 for more details) of recent football training matches involving agent ; ℎ andh denote the observation-action history at time from the perspective of the football policy and prior , respectively; the mixture weights { } ( 4 =1 = 1 and ≥ 0) are hyper-parameters of the objective that control the relative importance of the different drill priors.
Regularizing towards a mixture of drill priors accounts for the fact that the different priors characterize different types of behaviours and that the player will have to switch between different behavioural modes depending on the game state. The KL-divergence to a mixture is bounded from above by the divergence to any individual mixture component up to a constant defined in terms of the mixture weights (see Appendix B.6). Thus, if a player's behaviour is close to one of the drill priors it will not pay a large cost for deviating from the remaining ones.
The use of drill priors bears some similarity to the use of shaping rewards. Yet, defining appropriate shaping rewards for complex behaviours such as dribbling or kicking that integrate well with the overall objective can be difficult. This probabilistic formulation in terms of drill priors provides extra flexibility since it allows context-dependent prioritization and de-prioritization of individual shaping terms, an effect which does not naturally emerge with the naive use of shaping rewards. We will discuss specific examples of this in our analyses of agent behaviour in Section 6.
This setting resembles and is inspired by the Distral framework (63,66), but rather than simultaneously co-learn all tasks, we wish to reuse the skills learned during the drills in the more challenging football environment. Hence we pre-train the simpler drill priors and, once learned, fix the prior policies (as in 62).

Behaviour Shaping with Shaping Rewards
We use a surrogate reinforcement learning objective for football, J 0 ( ; ℎ ), as described in Section 3.1.2 Equation 2, specialized using shaping rewards for football. These include sparse rewards for scoring or conceding a goal, as well as dense shaping rewards for maximizing the magnitude of player-to-ball and ball-to-goal velocities. These dense rewards are intentionally myopic and thus relatively easy to optimize but do not encourage coordination directly. We provide detailed descriptions of the shaping rewards in Table 5 in Appendix B.5.

Parameterized MARL Objectives
Rather than optimize J 0 ( ; ℎ ) directly to learn football, we additionally regularize football behaviour towards drill priors, using the loss L priors Equation 5, and optimize the regularized reinforcement learning objective, where and ℎ denotes the set of hyper-parameters optimized in the outer loop, including and hyper-parameters of the learning process. As in stage 2, we restrict the behaviour of the football players to human-like movements, using the low-level motor module derived from human motion capture (see Section 3.2). The football policies are trained to produce control outputs in terms of the latent motor intention space defined by the low-level controller (see Section 3.1.3).

Experiments
We study our learning framework with a series of experiments that highlight the capabilities that players can acquire and analyze the contributions of different components of the framework. In this section we describe the experimental setup as well as the evaluation framework.

Experimental Setup
For experiments with the full framework we first trained an NPMP as described in Section 3.2. We then trained populations of drill teachers and football players as described in Sections 3.3 and 3.4. To assess the reliability of the framework we performed three independent experiments. For each experiment we trained an independent population of 16 football players, with distinct random initializations of the weights and hyper-parameters. We used the same NPMP across all experiments, but trained a separate set of drill experts and priors for each experiment. 12 We trained each population of drill experts for 5 × 10 9 environment steps (with the exception of the easiest follow drill which was trained for 2.5 × 10 9 environment steps). We then selected the best expert from each population (in terms of maximal final fitness on each drill). The selected expert was then distilled into a prior as described in Section 3.3. We distilled each expert using four separate seeds to randomize initial optimization hyper-parameters, and selected the prior achieving the lowest distillation loss (i.e., KL-divergence to the expert) after 10 6 gradient steps. Once the drill priors were trained we proceeded with training of the populations of the football players as described in Section 3.4.
We trained the football players for 8 × 10 10 environment steps, corresponding to six weeks of training in wallclock time. The evolution of the performance of our full agent is shown in Figure 8. After about two weeks of training our best agent decisively beats all evaluation agents (defined below) and improvement begins to slow down although performance does not saturate. Over the course of training agents acquire context-dependent movement and ball-handling skills such as getting up from the ground, fast locomotion, rapid changes of direction, or dribbling around opponents to make accurate shots. Players' locomotion becomes robust to external pushes and they engage in close quarter duels with opponents. Some scenes of gameplay are shown in Figure 3A-D. Players combine these movement skills with cooperative play. The players' behaviour progresses from "individualistic" ball-chasing to more coordinated team strategies involving division of labour, near-term tactics such as passing directed towards long-term team goals. Several of these motifs are repeated reliably across games. Some examples are shown in Figure 3E, and behaviours can be seen in the supplementary video and videos of full episodes. 13 The final agent shown in the videos was trained for two generations, each of 4 × 10 10 environment steps. The second generation agent was trained using regularization towards the best 1st generation agent, as well as the four drill expert priors.

Multi-Agent Evaluation
Evaluation in multi-agent domains can be a challenge since the objective is implicitly defined in terms of the (distribution of) other agents and the optimal behaviour may thus vary significantly. This is true, in particular, in non-transitive domains, where no single dominant strategy exists (67). In the case of some computer games, human performance can be used to establish baselines (16-18, 34, 68), but the nature of the control problem and the lack of a natural interface for controlling the high-dimensional humanoid players renders this unfeasible in our case.
During training we require a meaningful signal of training progress.We create a set of 13 evaluation agents that play at different skill levels but also exhibit different behaviour traits. These evaluation agents differentiate between players in the training population over the course of training and highlight the differences in their behaviours. The set of evaluation agents are "held-out" from the training process: training agents do not optimize their performance against evaluation agents. We provide detailed statistics of the evaluators in Appendix A.1. For consistency, the same set of evaluators are also used as opponents for behaviour analysis in Section 5.
Performance of each agent in the population in the full game of football was measured by playing 64 matches against the evaluation agents, at regular intervals during training, and computing Elo scores (69). For each experiment, and for each measurement we select the top 3 players in the population, in terms of Elo against evaluation agents, and report that Elo score.

Training Infrastructure
RemotePolicy RemotePolicy Actor (agent-4 vs evaluator-1) From a computational perspective our learning framework poses several challenges. Training and evaluation call for variable-throughput, low-latency inference over a large number of heterogeneous models. This includes high-throughput inference on the prior policies (the same prior policies are used for all players in all matches), medium-throughput inference on the training policies (the same agent participates in many matches concurrently) and low-throughput inference for the evaluation policies. Naively implementing the training infrastructure as described in prior work (17,18) incurs significant setup costs since, for instance, the policy inference network needs to be re-created for all players for each match. This limitation has led to prior work fixing the pair of players over hundreds (18) or thousands of games (17) in order to amortize this setup cost.
A schematic of our infrastructure is provided in Figure 4. Learning is performed on a central 16-core TPU-v2 machine where one core is used for each player in the population. Model inference occurs on 128 inference servers, each providing inference-as-a-service initiated by an inbound request identified by a unique model name. Concurrent requests for the same inference model result in automated batched inference, where an additional request incurs negligible marginal cost. Policyenvironment interactions are executed on a large pool of 4,096 CPU actor workers. These connect to a central orchestrator machine which schedules the matches. Contrary to computation patterns commonly observed in the reinforcement learning literature, actors are light-weight workers that do not perform policy inference themselves. Inference is instead performed on the inference servers and experience data is sent directly to the relevant learner's replay buffer. Each learner samples data from its replay buffer to update its agent's policy and value functions (Section 3.1.2). We note that our proposed infrastructure offers greatly improved efficiency over previous systems (18,47) by leveraging efficient batched inference as well as improved flexibility compared to (17) by enabling per-episode re-sampling of players.

How Football Agents Play
Gameplay of trained agents contains distinct and repeatable patterns, including agents' movements, their interactions with the ball and other players, as well as more strategic play and teamwork. We provide footage of the agents' behaviour in the supplementary video for qualitative assessment of their skills. 14 To understand the temporal evolution of different types of skills and behaviours, and to provide a quantitative picture of their occurrence, we perform three analysis techniques over the course of training: (a) we measure properties of the agents' behaviour during naturally occurring gameplay (behaviour statistics); (b) we measure the sensitivity of agents to certain scene properties by selectively varying these properties in a controlled manner (counterfactual policy analysis); and (c) we analyze the players' response to specific game situations under controlled conditions (probe tasks).

Behavioural Statistics
We track statistics that measure the quality of football players' movement skills, ball handling skills, and team work during naturally occurring gameplay. Statistics were collected at regular intervals over the course of training during matches against the set of evaluation agents introduced in Section 4.2. We list the statistics in Table 3 and provide further details in Section C.1 of the appendix.

Type Name Description
Basic Speed Average absolute velocity of player.

Getting up
Reliability of getting up: proportion of falls from which a player recovers before episode ends.

Football
Ball control Proportion of timesteps in which the closest player to the ball is a member of the team.

Pass frequency
Proportion of ball touches which are passes of range 5m or more. 15 Pass range Proportion of passes which are of range 10m or more.

Team work
Division of labour Proportion of timesteps in which one but not multiple players in a team are within 2m the ball. Values near 1 indicate that players coordinate and do not all rush to the ball simultaneously; values close to 0 indicate the opposite.

Territory
Proportion of points on the pitch to which the closest player is a member of the team.

Receiver OBSO
Off-ball scoring opportunity (OBSO) quantifies the quality of an attacking player's positioning and is used in sports analytics for the analysis of human football play (49). An off-ball player creates high scoring opportunity if they control a region of the pitch to which a pass is feasible and and from which a goal is likely. We report the OBSO for the receiver at the point that a pass is received, measured at the time of the pass, averaged over passes of range 15m or more. It is high if the off-ball player positions themselves well and the passing player makes successful passes, hence it is a measure of pass quality and receiver positioning. See Appendix C.4 for details.

Counterfactual Policy Divergence
We use the counterfactual policy divergence (CPD) technique (47) to measure the extent to which the behaviour of a player is influenced by different objectss in the football scene (ball, teammate, opponent). We measure the KL-divergence induced in the policy by repositioning (or changing the velocity) of a single object. For an object we define where is an initial game state and is a state identical to but with the position of object re-sampled and replaced uniformly at random on the pitch, and (recalling Section 3.1) where 0 () is the observation function for football. 16 A large CPD indicates that the action distribution of the player (i.e. the behaviour) would have been very different had the object been in a different position, a small CPD indicates that the object has little influence on the player's behaviour.

Probe Task
We study the agent's behaviour under controlled conditions in a probe task. The probe task is a short football game, lasting 5 seconds, with a specific initial configuration designed such that kicking the ball towards a teammate should be a beneficial strategy. We pitch two player instances as attackers against a team of two defending agents. The defenders are randomly sampled among the evaluation agents. The players are positioned randomly within small prescribed regions according to their respective roles: one of the attacking players takes the role of a "passer" and is initialized deep in its own half with the ball close by; the second player takes the role of "receiver" and is initialized near the centre line but on either wing with equal probability. The two defenders are always initialized near the centre, see Figure 5D. We quantify the results using two statistics which measure (a) whether the passer tends to kick the ball towards the teammate; and (b) whether the passer associates a higher likelihood of scoring with potential passes. We describe the statistics in Table 4 and provide further details in Appendix C.3. For both statistics we report averages over multiple instances of the probe task with different initial conditions.

Name Description
Probe score Measures whether the passer tends to kick the ball in a direction correlated with the receiver's position. We determine whether the velocity of the ball parallel to the goal line points towards the side where the receiver is positioned or not. A score of 1 means the passer always kicks forwards and in the receiver direction, 0 means it never does.
Pass-value-correlation Helps to determine whether the behaviour of the agent is driven by learned knowledge of the value of certain game states. We measure whether the passer's and receiver's value functions (specifically the scoring reward channel) register higher value when the ball travels towards the receiver, rather than away. Intuitively, a value close to 1 suggests that that the agent predicts a higher likelihood of scoring a goal when the ball travels towards the receiver than otherwise; values close to -1 suggest the opposite.

Results
Key results of these analyses are displayed in Figure 5. They suggest that the progression and emergence of behaviours can be divided into two phases during which players first acquire basic locomotion and ball handling skills, and subsequently begin to exhibit coordinated behaviour and team work.

Phase 1
During approximately the first 24 hours of training (1.5 × 10 9 environment steps) the players learn the basics of the game and locomotion and ball possession improve rapidly. As shown in Figure 5B, the players develop a technique of getting up from the ground, and speed and possession score increase rapidly. After six hours of training the agent can recover from 80% of falls. Play in the first phase is characterized by individualistic behaviour as revealed by the division of labour statistic, which initially decreases as players individually optimize ball possession causing both teammates to crowd around the ball often.
Consistent with this, the ball is the object with the most influence on the agent's policy ( Figure 5A). After about five hours of training the counterfactual policy divergence induced by the ball is 40-times greater than that induced by the teammate and 700-times greater than the divergence induced by either opponent. Finally, the score at the probe task decreases and becomes less than 50% indicating that the passer first kicks the ball in a direction opposite to the receiver ( Figure 5A). Pass-value correlation is also negative for roughly the first ten hours of training. 17

Phase 2
In the second phase cooperative behaviour and team work begin to emerge. The division of labour statistic increases and after 8 × 10 10 environment steps reaches values over 0.85 ( Figure 5B). This indicates a more coordinated strategy with only one player aiming to get possession of the ball (while the teammate often heads up-field in anticipation of a pass). Passing frequency and range also increase: after 8 × 10 10 environment steps 6% of touches are passes and approximately 40% of passes travel more than 10m ( Figure 5B). OBSO, which is indicative of good positioning in human football (as detailed in Appendix C.4 and Figure 13), also increases significantly. This indicates that off-ball players learn to position themselves to receive passes in positions likely to result in a goal ( Figure 5B); additionally, Figure 14 provides an overview of the evolution of the OBSO measure throughout training, illustrating that the number of passes with high OBSO consistently increases with training time. Importantly, our training reward does not directly incentivize behaviour that increases this statistic. This suggests that the agents' coordinated behaviour emerges from the competitive pressure to play football well. Consistent with the above, the CPD induced in an agent's policy by the teammates and opponents increases significantly ( Figure 5A) and indicates that football players' policies become more sensitive to the positions of other players: after 8 × 10 10 environment steps the ball induces a CPD less than 5-times greater than the teammate and 10-times greater than either opponent, a significant increase in the relative influence of other agents. In the probe task the pass-value correlation similarly increases significantly ( Figure 5A). After 8 × 10 10 environment steps it has reached values between 0.2 and 0.4 for both receiver and passer. This indicates that both passer and receiver assign higher value to situations in which the ball travels to the receiver's wing and more generally to situations in which the teammate has possession. Performance at the probe task also increases and after 8 × 10 10 environment steps the passer kicks the ball to the receiver's wing 60% of the time. Taken together these observations suggests that agents understand the benefit of kicking toward a teammate and are able to act accordingly. 17 One possible explanation for this is that the agents are not coordinated at this point (as revealed by the division of labour statistic), and so act to avoid obstructing each other. The agent developed a highly localized cluster for agent has fallen, while the internal states of teammate has fallen is more distributed. This suggests that the consequent behaviour after agent has fallen, i.e. trying to get up from the ground, is more deterministic than the action after observing its teammate has fallen; (C2) The major clusters of agent closest to ball being separable from those of teammate closest to ball suggests that the agent is able to discriminate well who is in possession of the ball, which is arguably a prerequisite for dividing labour in team coordination; (C3) Presents the t-SNE embeddings of dribbling and shooting. Specifically, dribbling and shooting are kicking with different consequences, and the fact that the clusters do not intersect suggests that the agent perceives these two types of kicking as different behaviours. (D) Representational efficiency of the agent's internal state for the game features in (C). Each group of bars correspond to the performance of three classifiers on a binary classification task regarding a current game feature, e.g., classifying whether the agent is on the floor with Logistic Regression (LR) on raw observations, LR or an Multi-layer Perceptron (MLP) classifier on the agent's internal state at the same timestep. For agent on the ground, agent closest to ball, and teammate closest to ball, the linear classifier on the agent's internal state performs as well as the MLP classifier. (E) Correlation between the agent's performance in Elo and the predication accuracy of future game features with LR on the agent's internal state. We investigated two cases: within the population of our best agent (E1) and across the populations of different training regimes used in the ablation study Section 7 (E2). In both cases, the prediction accuracy is positively correlated with Elo. (F) Single neuron selectivity for agent shooting (F1) and agent on the ground (F2). For each of these game features, the agent developed a highly discriminating dimension in its internal state.

How Football Agents Work
The analysis in Section 5 has shown that agents acquire a diverse set of movement and football skills, and progress from individualistic play to playing as team.
To better understand what representations support the emergence of these behaviours we conduct multiple analyses. In Section 6.1 we investigate how the agents represent the state of the game internally. In Section 6.2 we study how the representation of mid-level skills in the form of drill teachers is used by the agents.

Internal Representations of the Game State
Studies of human athletes have shown that the ability to interpret game situations and to predict how the game is going to evolve are correlated with good performance (70). Analogously we hypothesize that the simulated players' behaviour is driven by an internal representation that emphasizes important features of the game state and allows predictions about the future.
We perform an analysis of the agents' internal representation similar to (18). We record trajectories of full football games and label each game state with a set of binary features that characterize important high-level properties of that state. A full list of features is provided in Table 7 in Appendix C.5. We further introduce a set of mutually exclusive labels. Each label corresponds to a conjunction of game features as shown in the decision tree in Figure 6, Panel A. The features and labels are chosen such that they are meaningfully related to desirable high-level behaviour. For instance, successful coordination requires awareness of the teammates position; and movement skills such as getting up from the ground require an understanding of the agent's own pose. Similarly, the ability to predict the future occurrence of events such as kick by agent has resulted in goal or kick by agent has resulted in pass suggests that the agent has a representation of the consequences of its own actions.
Qualitative Analysis For each time step of a trajectory we gather two pieces of information: the raw observation of the game state available to the agent, and the internal state of the agent's LSTM. To understand how the agent's internal representation of the game state is organized we perform dimensionality reduction on the agent's recurrent state. To assess whether similar game states are encoded in similar ways we colour code each state with one of the mutually exclusive labels listed in Figure 6 Panel A. Results are shown in Panels B1-B2 and C1-C3. To understand whether the internal representation increases the salience of certain high-level features of the game state we further contrast the resulting picture with a similarly labelled t-SNE embedding of the raw observations in Figure 6 Panel B1.
The t-SNE plots show that the internal agent states do indeed cluster in accordance with conjunctions of the high-level game state features described above. For instance, we find that the t-SNE embeddings of shooting and dribbling form separate clusters (Panel C3) which implies that the agent is able to discriminate these two behaviours through its internal state. We also observe that similar clusters are not present in the t-SNE embedding of the raw observation ( Figure 6 Panel B1), suggesting that the agent's internal representation transforms the raw observation to provide easy access to high-level properties of the game state.

Recognition of Game Features
Next, we identify the key game features that are emphasized by the agent's representation: in Figure 6 (Panel D). We compare two classification methods: 1) linear classification (Logistic Regression) from the agent's LSTM state, 2) linear classification from the agent's raw observation. 18 As in (18), we say that an agent has knowledge of a game feature, if a linear classifier on the agent's internal state accurately models the feature. Similarly, we say that the information about the game feature can be easily accessed from raw observations, if a linear classifier on the raw observation models the feature well. Improved classification accuracy by a linear classifier using the internal state of the agent, compared to using the raw observation, suggests that the agent's representation has been shaped to make the feature easily accessible.
We identify three key patterns: a) Some features are already easily decoded from the raw observation and are preserved in the agent's internal representation. For example, for the feature agent on the ground, the linear classification performance from the raw observation is already high and does not improve when classification is performed from the agent's internal representation (Panel D1, left). b) Other features are de-emphasized in the agent's internal representation. For example, for teammate has fallen, linear classification from the agent's raw observations outperforms linear classification from the agent's internal state (Panel D1, right). This may indicate that the feature is of lower behavioural relevance to the agent. c) Finally, a majority of game features is emphasized by the agent's internal representation. This is the case, for instance, for the features agent is closest to ball, teammate is closest to ball and shooting, for which linear classification from the agent's internal state outperforms classification from the agent's raw observations (Panel D2, D3). We summarize how the agent recognizes different game features in Table 7 in Appendix C.5.

Representational Efficiency
To gain a deeper understanding of the nature of the agent's internal representation we compare two additional decoding schemes. First, we compare linear decoding to nonlinear decoding with a 2-layer Multilayer Perceptron (orange vs. purple in Panel D). A two-sided t-test does not indicate a significant difference between the two schemes with -values > 0.05 for the game features agent on the ground (0.90), agent closest to ball (0.55), teammate closest to ball (0.97), and shooting (0.09). This suggests that the representation is efficient in the sense that it provides access to most information via a simple linear decoding scheme. We summarize the representational efficiency of all game features in Table 7 in Appendix C.5.
We further analyze the activation patterns of individual units (dimensions) of the internal state for different game situations. Results are shown in Figure 6 (Panels F1, F2). We find that several units are highly discriminatory and simply thresholding their activation can provide accurate information about the game state. This suggests that information about some features is localized and can be decoded from the internal state of the agent with particularly simple means and without reference to the full population. This bears some similarity to sparse coding schemes identified in monkey and human brains (71,72).

Prediction of Future Game States
Finally, we investigate how the agent's ability to predict future game state with its internal representation correlates with its performance (Figure 6, Panels E1 and E2). To study this question, given a snapshot of an agent, corresponding to an Elo score, we repeat the analysis above with its internal states as input to the linear classifier and use these to predict a future game feature. We perform two analyses: 1) Intra-population anlaysis ( Figure 6, Panel E1): within the population of our best agent, we first sample five agents with their Elos ranging from 800 to 1250. For each agent, we collect the prediction accuracy of all the game features listed in Table 7, and report the mean and standard deviation. Finally, we correlate the prediction accuracy with Elo with linear regression. 2) Inter-population analysis ( Figure 6, Panel E2): we consider the four populations in the ablation study described in Section 7. For each population we take a snapshot at 40 × 10 9 environment steps and select the top 3 agents (out of 16), and repeat the correlation analysis conducted in the inter-population case. For both cases, we repeat the analysis with different prediction horizons. For the intra-and inter-population analysis we find that the agent's ability to predict future game features is correlated with good performance.

Figure 7 | (A)
Event-triggered analysis: KL-divergence to drill experts during kick events with the left foot. The football agent deviates significantly from the follow expert (red) during the kick and aligns more closely with the shoot (blue) and kick-to-target (purple) and dribble (green) experts. (E) The KL-divergence between the blue number 2 player's policy and the four drill experts during a single specific play, in which the agent kicks the ball twice (B and C) and ultimately scores. There is a typical deviation from the follow expert, and closer alignment with shoot expert immediately prior to the two kick events. (F) We track the separate value function channels to gauge the drivers of the agent's behaviour. The closest-velocity-to-ball shaping reward (green) dominates the agent's internal value function overall. But at the time of the first kick, deep in the agents own half, and with control of the ball, the velocity-ball-to-goal channel makes a significant contribution to the value function. At the time of the second kick (a shot) the score channel is also significant, and rises further after the agent makes an accurate shot (D) before finally dropping when the goal is scored.
As explained in Section 3 the football agents are regularized towards four drill prior policies that represent mid-level skills: follow, dribble, shoot and kick-to-target. Unlike certain hierarchical architectures (e.g. 53,73), the drill priors are not directly reused as part of the policy. This raises the question whether and to what extent they influence the football players' final behaviour. In particular, we are interested to understand whether players make use of all skills and whether they adaptively switch between skills depending on the context. We answer these questions by playing episodes with the trained football policy and simultaneously stepping the four drill experts at states along the trajectory generated by the football agent. By measuring the KL-divergence between the football policy and the drill priors, we can gauge how similar a player's behaviour is to each of the drill priors. Statistics for alignment with the drill experts were collected over one hour of play.
The results of this analysis are shown in Figure 7. The KL-divergence between the agent's policy and the follow prior is lower than that between the football agent's policy and the other three drill priors. But Figure 7A shows results of an event-triggered analysis in which we measure the KLdivergence to the priors before and after kicking events with the left foot, aggregated over one hour of play. Agents tend to deviate significantly from the follow prior during preparation for a kick, and align more closely to shoot, dribble and kick-to-target priors over the course of the kick before returning to the long-term average deviation. In addition to an aggregated analysis, in Figure 7E we investigate the pattern of behaviour, and alignment with the drill priors, during a single play in a specific episode. We track the KL-divergence between one player's policy and the four drill prior policies. We see the typical divergence from the follow prior during kick preparation and alignment with the shoot prior during the two kicks. We also track the contribution of the four reward channels to the value function during the same episode, which shows that the contribution of the scoring channel increases prior to a successful shot.

Ablation Study
In order to assess the importance of the different components of our learning framework, we considered several variations of the training scheme outlined in Section 3: 1. Drill priors and basic shaping rewards: the standard agent described in Section 3 which uses low-level skills, mid-level skill priors, and simple dense shaping rewards. 2. Drill priors and sparse rewards: the agent described in Section 3 with low-level skills, and mid-level skill priors, but without dense shaping rewards. The agent is trained only with sparse rewards for scoring and conceding a goal. 3. Shaping rewards but no drill priors: the agent described in Section 3 with low-level skills, and shaping rewards but no mid-level skill priors. 4. Drill priors; shaping rewards; additional team-level coordination shaping rewards: the agent described in Section 3, with two additional team-level shaping rewards designed to encourage coordinated behaviour in an attempt to improve performance. The first, vel-ball-to-teammateafter-kick, encourages the agent to kick the ball towards a teammate. The second, territory, encourages the teammates to spread out such as to control as large a fraction of the pitch as possible.
For each of the four training schemes we follow the procedure outlined in Section 4 and train three separate populations of 16 agents each. For consistency we use the same low-level skill module and the same three sets of drill priors for each training scheme as explained in Section 4.

Results
We evaluate trained agents by playing matches against the evaluation agents as explained in Section 4. Results are shown in Figure 8. There is a clear separation in performance across training For the follow and shoot drill, performance was roughly equivalent across the three seeds, and these drills were learned quickly. The harder dribble and kick-to-target drills were learned more slowly and with some variance in performance across seeds. (B) Football training progression for the four training methods quantified by Elo against evaluation agents by training environment step. There is a clear separation in performance across training methods. The sparse reward framework (green curve) performed consistently very poorly. The training approach without the use of drill priors (red curve) also performed poorly, but had much higher variance across seed; these agents suffered from getting stuck in several different locomotion or ball-control local optima. Our standard method with two dense shaping rewards reached the highest performance (orange curve). Including additional shaping rewards (blue curve) performed reasonably well but generally worse than the agents with fewer shaping rewards. (C) Comparing behaviours between the best performing agent (in orange), the best agent with additional coordination shaping rewards (in blue) and the best agent without drill prior teachers (in red). We observe that the introduction of coordination rewards does not affect most statistics except that the average velocity of the ball to the goal is approximately 30% lower than the baseline standard agent. Without drill priors, the agent's speed and velocity of the ball to the goal statistics were significantly lower than the other agents learning from drill priors. (D) Poor ball control local optima for an agent trained without drill priors: (top) the agent dives on the ball to manoeuvre it with its hands; (bottom) the agent locomotes along the ground, which is easier to learn than upright locomotion, but is a poor local optima.
methods. Players trained with drill priors and sparse rewards only (green curve) performed very poorly. They learned to score goals, but were unable to get back up after having fallen to the ground and they generally moved slowly (perhaps in an attempt to avoid falling). This suggests that, with mid-level skill priors, it is possible to learn with sparse reward only, but movement skills still benefit from shaping rewards.
Training without the use of drill priors (red curve) also led to poor performance and much higher variance across the independent experiments. In all the three experiments the players learned degenerate movement skills. In two of the three experiments the players did not learn to run but instead moved across the pitch by rolling on the floor. In a third experiment the players did learn to run, but manoeuvred the ball by falling on it and hitting it with their hands. 19 Examples of these movement techniques are shown in Figure 8D. These results suggests that the low-level skill module is insufficient to adequately shape the player's movements and that the mid-level behaviour priors derived from the training drills play an important role in this regard.
The best performing players were produced by the standard training scheme described in Section 3 and analyzed in Sections 4-6. Players from all three independent experiments achieved a similarly high performance (orange curve).
The training scheme that uses additional shaping rewards to encourage more coordinated behaviour performed well (blue curve) but worse, overall, than the standard scheme detailed in Section 3. A comparison of the behaviour statistics of the players obtained with the two schemes reveals that players trained with the additional shaping rewards exhibit similar movement and ball handling skills: getting up, speed and ball control are similar for the two types of players. However, the average velocity of the ball to the goal is approximately 30% lower when training with the additional shaping rewards ( Figure 8C), indicating that players kick less towards the opponents' goal. These results suggest that shaping rewards that reliably encourage coordinated play can be non-trivial to design, and that the need to balance incentives provided by conflicting shaping rewards can negatively affect performance. Furthermore, PBT and evolution appear to struggle to optimize the larger set of hyper-parameters that results from growing the set of shaping rewards. This may be a consequence of the relatively small population size of 16. A possible alternative approach to investigate in future work would be use of behaviour priors for cooperative play.

Related Work
Our work combines a range of problems into a single challenge: multi-scale behaviour; dynamic movement and control of physical embodiments; coordination and teamwork; as well as robustness to a range of adversarial opponents. These are all, separately, fundamental open-problems in AI research, each receiving significant focus. In this section, we will review the prior work on each of these topics.

Humanoid Control
Human motor behaviour and the biological mechanisms that give rise to it have been widely studied in their own right in various disciplines ranging from kinesiology to motor neuroscience. The artificial reproduction of human-like behaviour in humanoid robots and virtual characters are studied predominantly within the computer graphics and robotics communities. For computer graphics researchers, the motivation is to develop humanoid characters that produce realistic movements as well as natural interactions with physical environments, and one route towards solving this involves controlling humanoids in physics simulators (12-15, 22, 74-79). The approaches employed by the graphics community range from classical control approaches through to contemporary deep learning and substantially overlap with methods developed for high-dimensional and humanoid control within the AI literature (20,(80)(81)(82)(83). A major challenge in the control of complex bodies remains the ability to compose diverse movements from a repertoire of behavioural primitives in an adaptive and goal-directed manner (e.g. 32,33), and to achieve object interaction (e.g. 23,75,84). The present work shares motivation most closely with AI research into humanoid control, focusing on performant behaviour in a challenging physical environment but significantly increases the difficulty of the long-horizon, goal-directed nature of the task. While Deep Reinforcement Learning (Deep-RL) has in recent years enabled rapid development of many of the humanoid control approaches for simulated environments, control of real-world humanoid robots remains difficult. Prominently, Boston Dynamics has made impressive advances released as video demonstrations of dynamic "parkour" behaviours (85). Though the efforts by Boston Dynamics are proprietary, they are built from considerable expertise developed by robotics researchers (10). To date, these techniques appear to be rather distinct from the learning-based solutions developed in the AI community in simulation. Yet, recent partial successes transferring results from simulation to real robots (24,26,86,87) suggest that learning based approaches in simulation may, in the future, play a larger role in the control of real world robots. Importantly, most work on simulated humanoid character control, as well as on the control of real robots has so far focused on the production of high-quality movement skills rather than on the production of long-range autonomous behaviour in context rich, dynamic scenarios which is the focus of the present work.

Emergent Coordination
There has been much work applying reinforcement learning to cooperative multi-agent domains (88)(89)(90)(91)(92), and a focus on generalizing RL algorithms to the case of multiple cooperative agents. These algorithms are either limited in their applicability (e.g. (93) which is valid for deterministic systems without function approximation) or rely on some degree of centralization, such as a shared value function during learning (94,95), in contrast to the setting of independent learners which we study in this work. The problem of learning coordination between independent RL agents has not been solved due to a complex joint exploration and optimization problem, which is non-stationary and non-Markovian from the perspective of any individual learner in the presence of other learning agents (96)(97)(98)(99) and is particularly challenging in high-dimensional control problems with sparse, distal reward signals.
Coordinated team strategies emerged in independent RL learners in the Capture-The-Flag video game (18), an environment with discrete control. Emergent cooperative behaviours such as division of labour, have recently been demonstrated in simulated physical environments but only with much simpler embodiments (e.g. 100). Achieving such behaviour in complex, articulated humanoid bodies with continuous control has not been demonstrated previously. Emergent communication between agents is a rich topic in its own right (19,101,102), but in this work we limit agents' abilities to rely exclusively on physically acting themselves and observing others to communicate and understand intents.

Multi-Agent Environments and Competition
Competitive games have been grand challenges for artificial intelligence research since at least the 1950s (17,(103)(104)(105). In recent years, a number of breakthroughs in AI have been made in these domains by combining deep RL with self-play. Pitting learning agents to play against themselves (or a pool of learning agents) has achieved superhuman performance at Go and Poker (68,106). This combination of RL and self-play provides an effective curriculum for environment complexity by automatically calibrating opponent strength to a suitable level to learn from (64), and it has been speculated that intelligent life on earth has emerged during constant competitive co-adaptation (107). In continuous control domains in particular, complex behaviours and strategies have been shown to emerge as a result of competition between agents, rather than due to increasing difficulty of manually designed tasks (11,21,100,108). In this work, we pursue this idea further by incorporating physically complex embodiments with high-dimensional control, allowing richer possibilities for agent behaviours and interactions, grounded in real physics, but otherwise not prescribed. Compared to simpler embodiments (47,100) or games in environments with discrete action spaces (18,68) this greatly increases the difficulty, for instance of the exploration problem, and thus reduces the effectiveness of pure self-play. Some successes have been enabled by initializing agents policies via behaviour cloning from human gameplay (e.g. 17), but the specific embodied nature of our domain entails that similar demonstrations are unavailable for our setting.

Multi-Scale Control
The question of how to learn and reuse hierarchically structured behaviour has a long history in the reinforcement learning (e.g. [109][110][111][112][113][114][115] and robotics (e.g. 27,28,[116][117][118][119] literature. For self-learning systems highly-structured, adaptive, long-horizon behaviours pose a number of challenges including exploration, credit assignment, and model capacity. Solution strategies that have been proposed often rely on hierarchical architectures and a large number of different approaches have been pursued in the motor control and general RL literature. Approaches vary along a number of dimensions. For instance, a separation of concerns between different model components can be achieved either via architectural constraints (e.g. 53,62) or dedicated sub-objectives (e.g. 29,73,109,[120][121][122][123] and different architectures can be employed to model the behaviour of interest, including continuous behaviour embeddings (e.g. 33,53,63,[123][124][125] or discrete options (6,31,114,(126)(127)(128)(129)(130) and enforce temporally correlated behaviour (e.g. 63,73,114,126,130,131) or not (e.g. 33,62,63). Furthermore, the behaviour to be modeled can be copied from demonstrations (33,124,127,131), learned as part of a multi-task framework (e.g. 53,56,62,63), or derived from intrinsic rewards (e.g. 73,109,120,122,123,132); and learning can proceed either online while interacting with an environment or offline from a fixed set of data. One fundamental problem associated with hierarchical architectures and associated training regimes is that they often impose undesirable constraints on the resulting behaviour, for instance, due to poorly chosen subgoal spaces; restrictive architectures such as enforced temporal correlations; or unsuitable decomposition of the learning scenario (e.g. 31,73,121). Recently, there have been attempts to separate the modeling of hierarchical behaviour from the use of hierarchically structured architectures (e.g. 62, 63, 66).
Our agent brings together several of these ideas (33,62,63,66) in a multi-scale learning architecture. The behaviours that our agents exhibit originate from a mix of demonstrations, pre-training tasks and end-to-end training. Architecturally, the agent combines a skill module for low-level motor control, with a non-hierarchical behaviour prior for mid-level skills, to achieve multiple levels of control spanning core locomotion and movement skills, football-specific skills, and team level coordination. The multi-stage training scheme decomposes the learning problem and provides adequate behavioural constraints and shaping without unduly restricting the final behaviour.

RoboCup and Simulated Football
A longstanding grand challenge in AI concerns the development of autonomous robots capable of playing human-level football, as set out in the well-known RoboCup project (40,133). Reinforcement learning is an area that has received attention since the early days of RoboCup to tackle some of the main technical challenges, which emerge in various of its football leagues, in isolation. These works typically focus on the handling of large state-action spaces (134,135), skill learning (136)(137)(138)(139)(140)(141), the keep-away and half-field offense tasks and multi-agent coordination (142)(143)(144)(145)(146)(147)(148)(149)(150), grounded simulation learning for improved skills (151-154) (e.g. in sim-toreal and back), skill learning in 3D humanoid football (155,156), and deep reinforcement learning for parameterised action spaces (157). Yet, despite these examples of applications of reinforcement learning in the RoboCup domain, many successful recent RoboCup competition entries learn or optimize only a subset of the components of the control architecture (e.g. 141,158). One successful RoboCup approach related to our method is Layered Learning (29,159) which uses reinforcement learning at multiple levels of a pre-defined hierarchy of skills, from individual ball interaction to multi-agent behaviours such as pass selection. In Layered Learning a bottom-up hierarchical task decomposition is given and implemented architecturally, with the output of one layer feeding into the next. In contrast, in our system, the pre-learned skills are not transferred as architectural components in a hierarchy; rather, all behaviours are learned at the level of motor intention and the pre-learned skills are transferred as priors to bias soccer behaviour, rather than as parametrized skills to precisely reproduce. The mid-level individual skills and multi-agent behaviours are therefore more tightly coupled. Our NPMP motor primitive module is transferred as a low-level component but the NPMP is not optimized to perform any particular skill, but is rather a reparameterization of the action space.
Several simulated football environments have been proposed in the AI literature. These include, most prominently, the RoboCup 2D and 3D league (40,41), as well as more recent additions including the Google Research Football Environment (57), and the immediate predecessor of this work (47). Both the RoboCup 2D simulation league as well as the Google Research Football Environment use abstracted action spaces and do not focus on motor control for embodied agents. The simulated RoboCup 3D humanoid league is modeled around the NAO robot used in the Standard Platform league and emphasizes alignment with the real-world robotics platform and RoboCup rules. Teams consist of eleven robots, and the game flow can be interrupted for various reasons, such as set pieces, and the environment also allows for some non-physical actions such as blocking opponent players from approaching while a pass is being executed. As discussed in Section 2, our environment attempts to isolate the challenge of emergent complex motor control and movement coordination in an open-ended, long-horizon task in a setting setting suitable for end-to-end learning. We thus focus on the capabilities of the simulated, human-like players and properties of the physical environment but simplify other aspects of the football game. The environment further emphasizes ease of use for learning experiments e.g. in terms of the stability of the underlying physics simulation, and integration with existing simulation infrastructure widely used in the literature. It conforms with a standard environment interface (42) for RL environments, and it allows plug and play in the sense that different walker bodies can be used to play football, while the humanoid body used in this work can also be deployed in a range of other tasks (42).

Discussion
In this work, we have demonstrated end-to-end learning of coordinated 2v2 football gameplay of simulated humanoid players. Players learn to produce natural, human-like movements and coordinate as a team on longer timescales. They achieve integrated control in a setting where movement skills and high-level goal-directed behaviour are tightly coupled; a setting that is reflective of many challenges faced by animals and humans (e.g. 8), and where solutions would be extremely difficult to handcraft. We have assessed the success of our approach through a number of careful analyses of the learned behaviour as well as players' internal representations. We have found, among others, that the players' behaviour improves with respect to a coordination metric from human football analytics (49), and that their behaviour is driven by a representation that emphasises relevant high-level features of the game, and that they learn to make predictions about the future similar to observations in human soccer players (e.g. 50, 51).
The behaviour emerges from a three-stage learning framework that combines low-level motor imitation, training drills for the acquisition of football skills, similar to the training of human football players, and multi-agent training with self-play for learning the full task. The approach implements three core ideas: Firstly, the gradual acquisition of increasingly complex skills and their subsequent reuse addresses challenges related to exploration and credit assignment that are commonly encountered in complex, long-horizon learning scenarios. Secondly, the approach relies on different types of learning signals: for instance, for human-like low-level movements good prior knowledge is available in the form of motion capture data. In contrast, for full game play similar prior knowledge would be hard to come by; the high-level game-strategy emerges from population self-play in multi-agent RL, which also helps to refine and improve the robustness of the movement skills. This provides an effective solution to the important challenge of behaviour specification in complex scenarios. Finally, the approach demonstrates how skills and behaviour priors can be used effectively to model and reuse behaviour at different levels of abstraction. It avoids common problems associated with hierarchical behaviour representations which may unduly constrain the final solution.
Overall, our study has addressed several challenges usually studied in separation: the production of naturalistic and effective human-like behaviour of humanoid players; the production of multi-scale hierarchically structured behaviour; and the emergence of coordination in challenging, multi-agent scenarios. The results demonstrate that artificial agents can indeed learn to coordinate complex movements in order to interact with objects and achieve long-horizon goals in cooperation with other agents. The study has shown that this can be achieved by end-to-end learning methods, and how several techniques for skill transfer and self-play in multi-agent systems can effectively be combined to this end. Although our approach requires a certain level of prior knowledge of the problem, its nature did not prove particularly onerous and is readily available for many other tasks.
Obviously, the results shown in this study constitute only a small step towards human-level motor intelligence in artificial systems. Even though the scenario in the present paper is more challenging than many simulated environments considered in the community, it is lacking in complexity along many dimensions compared to almost all real world scenarios encountered by humans and animals. In particular, our work has not tackled the full football problem which is considered, in more completeness, for instance in RoboCup. In this regard, the results presented in this paper suggest several directions for future work: Firstly, we have focused on competent 2v2 gameplay mostly for computational reasons, but it would be natural to extend to full scale football teams. Larger teams might also lead to the emergence of more sophisticated tactics. Learning in this setting may be supported, for instance, by extending our approach to include additional curricula and multi-player drills. To reduce the complexity of environment design and of the learning problem we also simplified the rules. Integrating penalties, throw-ins, or a dedicated goal-keeper role may lead to the emergence of more complex behaviours and would require a significant step in the difficulty of the movement skills (such as manipulation as in (e.g. 23)). Naturalness of individual players' movements and team tactics as well as the realism of the overall setting may be further improved by switching to egocentric vision, which would render the environment more partially observed and may favour novel movements (e.g. controlling the movement of the head or the need to run backwards) and / or team tactics (e.g. dedicated defensive roles). Successfully tackling these additional challenges might in the medium-term also enable an application of end-to-end learning techniques to full simulated robot football as in the RoboCup 3D league (41).
Our results were obtained in a simulation environment that supports realistic physics. This has made the learning environment more open ended and allowed for the emergence of complex behavioural strategies including agile movements and physical contact between players. Even though there have recently been some successes transferring simulation based behaviour to the real world (e.g. 24-26) this has not been the goal of the present experiments. Our results would currently not be suitable for direct sim-to-real transfer, nor is the developed method suitable for learning directly on robotics hardware (for a large number of reasons including the lack of data efficiency or safety considerations). They do demonstrate, however, the potential of learning-based approaches for generating complex movement strategies. And even though simulation is only a poor substitute for the complexity of the real world we nevertheless believe that simulation-based studies can help us understand aspects of the computational principles that may eventually enable us to generate similar behaviours in the real world. Answering the question whether and how such methods can help to achieve similar levels of sophistication in multi-scale motor intelligence for agile robotics hardware is an exciting direction for future research.

A.1. Evaluators
The set of 13 evaluators that our agents are continually evaluated against exhibit a range of levels of skills as shown in Figure 9. In particular, evaluator_12, the weakest agent acts randomly and does not interact with the ball (resulting in undefined prop_pass_5m).

A.2. Drills
See Figure 10 for visualizations of the drill tasks.

A.3. Drill Expert and Prior Policy Observation
Recall that the observation space for the football task, O 0 , is composed of proprioceptive observations X and the football-specific context observations C 0 . Similarly, the observation spaces O for the drill experts are comprised of X and the drill-specific context observations C . We can then express the relevant contexts for the transferable behaviour priors as the intersection of context observation feature setsC = C ∩ C 0 .

B.1. Task Abstraction Using Stochastic Games
We model each of the tasks using the framework of Stochastic Games (58), which generalizes the concept of a Markov Decision Process (MDP) to ≥ 1 decision makers. The -th task is modelled , and 0 defines the distribution of initial states over S . The embodiment of the humanoid football players is identical in all tasks, and the agents act by providing a 56-dimensional continuous vector to the environment, so that the action set is consistent across tasks and players. The observation sets are consistent across players within each task. Observations are further partially consistent across tasks: proprioceptive observations ∈ X are present for all players in all tasks; task-specific observations ∈ C , including features with information of the ball, goal-posts, the moving target and other players recur in a subset of tasks. This partial consistency enables skill transfer across the family of tasks. . Note that agents do not observe the identity of their opponents and therefore rely upon the history to infer the dependence of the action-value function on the coplayers in any particular episode. For this reason it is important that theˆ are parametrized using recurrent neural networks.

B.2. Policy Optimization with Maximum a Posteriori Policy Optimization
We consider the paradigm of independent-learning and independent-execution and optimize, for each agent its parameters ( 1 , . . . , , ) of the action-value functions {ˆ (ℎ , ; , )} =1 , and policy (·|ℎ ). As described in Section 4.3, policy and value function updates are computed from off-policy data sampled from an agent-specific replay buffer.

Policy Evaluation
We employ the retrace off-policy correction (160) to compute target Q-values {ˆ : ∈ [ ]} and, for each agent in the population, minimize the loss: where expectation is over trajectories sampled from the agent's replay buffer.
Policy Improvement We follow (39) and compute policy updates with a two-step procedure. In the first step we compute an improved policy according to the constrained optimization problem where specifies the maximum allowed change of relative to the current policy . 20 We solve this problem in closed form * ( |ℎ ; , ) ∝ ( |ℎ )exp (ℎ , ; , ) with the temperature computed based on the constraint and the current policy. We represent the optimal * non-parametrically through a set of weighted action samples In the second step we update the parametric policy through a projection step that minimizes the KL-divergence to the non-parametric policy, ( |ℎ ), subject to a constraint which implements a trust region of size and improves stability of learning,

B.3. Motion Capture and NPMP Training Details
Motion capture data of the football vignettes was licensed from Audiomotion Studios, where this football data had been commissioned for an unrelated project by other clients. The football vignettes consisted of different numbers of players per scene, and the motions of each individual player was tracked. For our purposes we treated player motions individually (ignoring the interactions between players). The dataset amounted to 560 player-clips, with this total coming from multiple players in each of a smaller number of vignettes. In total, this was roughly 1 hour and 45 minutes of player-time.
As noted in the main text, we cut the 560 player-clips into snippets that were 4-8 seconds in duration. More specifically, the original 560 player trajectories were cut into 1245 shorter snippets, and these snippets were then imitated by separate tracking policies.
Although most clips did not involve interactions between the humanoid and the ground, excepting foot contacts, a meaningful subset of the data (100/1245 snippets) displayed behaviours such as the goalie diving for the ball, players performing a slide tackle/kick, and players standing back up after aggressive plays. We anticipated that the inclusion of this class of behaviours would enable the low-level motor controller to support richer behaviours including recovery from falls. As noted in the main text, the ball was not tracked and was not included in the motion reconstructions.
As a first processing step, we converted the motion capture point-cloud data into joint angles for our humanoid body model, using an implementation of STAC (161). Since different human subjects had substantially different body proportions, we resized the humanoid body model to the proportions of each unique human subject and performed STAC for these per-subject body variants. Once the joint angles were identified for all clips, we re-targeted the joint angles to our standard proportion body model.
For the tracking stage, the motion capture snippets were resampled to a coarser temporal resolution consistent with the control timestep employed for this domain (30 ms/timestep). Our motion capture tracking infrastructure has been open-sourced at dm_control/locomotion (61).
The second stage, involving sampling trajectories from the tracking policies and distilling them into an NPMP architecture, is detailed in the main text. While many possible specific neural network architectures are possible for the encoder and decoder ( and in Equation 3), in the present work we use an encoder that is a MLP with two hidden layers of 1024 units each, followed by an output (the latent embedding space) of 60 latent variables. The decoder, is also an MLP with three hidden layers of 1024 units each. This was not something we systematically explored for the present work, however this choice was informed by other exploration of network sizes and architectures that we have performed in other work (33,61). The latent prior is a simple auto-regressive process as described in (33).

B.4. Agent Architecture
Scene Embedding Each agent observes the state of the environment through a set of egocentric features. These features always include proprioceptive information ∈ X about the player's pose and velocities. For task the feature set further includes information about objects that are part of the game context ∈ C (including ball, goal posts, moving targets, etc). For the full game of football ( = 0), each agent additionally observes other players (teammates and opponents) with the observation for each player denoted ∈ C 0 . Agents learn a proprioceptive encoder ( ) as well as a task context encoder ( ). In the football game observations of each teammate and opponent are processed by teammate and opponent encoders ( ) and ( ) respectively. All feature encoders are implemented as 2-layer MLP networks.

Player-Player Relationship Representation
For the football task, the structure of the observations offers an opportunity to introduce inductive biases that facilitate representation learning. Recognizing that teammates and opponents have no natural order, we use an order-invariant representation that treats observations of teammates and opponents as unordered sets, so that the number of learned parameters is independent of the number of players. We first compute pairwise encodings for all 2 pairs of players. These are then processed by a multi-headed attention module that uses the proprioceptive and context encodings as input to compute queries.
The multi-headed attention module consists of a query encoder taking as its input the concatenation of one's proprioceptive encoding ( ) and the context encoding ( 0 ). The encoded query is then concatenated with all 3+2−1 2 pairwise peer encodings chosen with replacement and fed to the value encoder . The combination is with replacement which allows for the representation of relationships between an agent itself and any one of its peers (the diagonal of the pairwise player embeddings matrix in Figure 11). Given separately parameterized attention heads, we compute 6 attention masks over the resulting value encodings, resulting in 6 weighted pairwise relationship embeddings. The representation of players is therefore order-invariant thanks to the unordered sum via the attention mechanism and decouples the number of parameters from the number of peers. The number of attention heads can be loosely interpreted as the number of different pairwise relationships that could be relevant for downstream decision making.

Environment State Embedding
The final state representation is obtained as the concatenation of the proprioceptive encoding and the context encoding and, in the case of the football task, further concatenated with player-player interaction encodings.

Policy/Action-Value Function Parameterization
Many multi-agent environments are inherently partially observed, for instance because the identity or internal state of the opponent is unknown (47). In this case, the optimal policy is a function of the interaction history. Following the state embedding, LSTM modules (60) process history in the policy and action value functions. The agent samples latent actions from a Gaussian policy which are translated to actions ∈ A using the fixed low-level motor controller described in Section 3.2. Reinforcement learning is performed over the latent motor intention space. Thus action-value functions are defined over the motor intention space. Similar to (47), the action-value function outputs a vectorised return estimates where each dimension corresponds to a reward component.

B.5. Shaping Rewards
We describe the shaping rewards introduced to each task, including the full task of football and the mid-level drills in Table 5.

Task Reward Description
Football Scoring Returns +1.0 when the home team scores a goal and 0.0 otherwise.

Conceding
Returns -1.0 when the away team scores a goal and 0.0 otherwise. Closest Velocity to Ball Returns the magnitude of the player's velocity to ball if the player is the closest player to the ball in its team.

Velocity Ball to Goal
Returns the magnitude of the velocity of the ball towards the center of the opposing team's goal.

Dribble
Ball Close to Target denote the cordinates of the ball and the target. This defines the environment reward and fitness measure for the task.
Velocity Player to Ball Returns the magnitude of the player's velocity to ball.
Velocity Ball to Target Returns the magnitude of the velocity of the ball towards the target.

Follow
Close to Target denote the coordinates of the player and the target. This defines the environment reward and fitness measure for the task.

Velocity Ball to Goal
See above. This is included in the environment reward and fitness measure for the task.

Scoring
See above. This is included in the environment reward and fitness measure for the task.
Velocity Player to Ball Returns the magnitude of the player's velocity to ball.
Kick-to-target Ball Close to Target denote the coordinates of the ball and the target. This defines the environment reward and fitness measure for the task.
Velocity Player to Ball Returns the magnitude of the player's velocity to ball.
Velocity Ball to Target Returns the magnitude of the velocity of the ball towards the target.

B.6. Behaviour Shaping with Behaviour Priors
The KL between a distribution and a mixture distribution with components { } is upper bounded, up to a constant defined in terms of the mixture weights, by the minimum KL between and any of the components:

B.7. Multi-Agent Population Fitness Measure
We continuously keep track of each agent's fitness, as outlined by the Fitness Update in Algorithm 1.
In contrast to the single-agent setting, where the reward function offers a direct performance ranking of population members, the stochastic game does not by itself offer a well-defined complete ordering. Specifically, the terminal reward of win, loss or draw from a match (corresponding to a terminal reward of +1, -1 and 0) between agents ( , ) is only informative insofar as to compare the relative strength of the pair of agents involved. Relative performance between agents also need not be transitive (162).
We continuously keep track of an empirical payoff matrix M : W × W → ℝ between all pairs of continuously learning agents within a finite population of size 16. We model the ternary terminal rewards as a beta distribution ( , ) where ( ) corresponds to the counts of wins (losses) from sampled match-ups. A result of draw counts towards both and . To account for the continual learning of agents, we exponentially decay the counts of pairwise win/loss results throughout training. Based on the empirical payoff matrix M, we define a fitness vector ∈ ℝ | W | measuring the empirical performance of agents in the population. While popular fitness measure such as Elo have been used extensively in the MARL literature (18,47), we adopted Nash Averaging (65) which is invariant to the introduction of agents that win or lose to the same set of opponents. Treating the task as a two-player zero-sum game, we can solve for the unique mixed Nash strategy represented by the Nash distribution over the population W. The fitness vector of agents is defined as = M · or their expected payoff when playing against the mixed Nash strategy. Note that agents with non-zero support under the Nash equilibrium by definition have the maximum fitness of 0.5, representing a 50% win-rate against the Nash mixture.
In short, our population-based training scheme amounts to evaluating agents against the Nash mixture player, while improving over the average player of the population.

C.1. Behavior Statistics
Basic locomotion skills: we measure the agent's speed, and ability to get up -defined as the proportion of times an agent is able to recover from being fallen.
Football skills: we measure (1) the proportion of timesteps in which the closest player to the ball is a member of the team, ball control; (2) the proportion of ball touches which are passes of range 5m or more (pass frequency), and (3) the proportion of passes which are of range 10m or more (pass range).
Teamwork statistics: we firstly design a metric to measure division of labour, which we define as where − − is an indicator for the event that one player on the team is within 2m of the ball and is an indicator for the event that both players on the team are within 2m of the ball. Expectation is over trajectories encountered by playing policy against a randomly sampled evaluation agent. Thus division of labour is close to 0 if, whenever one player is close to the ball, so is it's teammate, and close to 1 if, whenever one player is close to the ball, it's teammate does not try to possess the ball but adopts an alternative behaviour (typically turning and heading up-field in anticipation of an up-field kick, pass or shot). We secondly consider Receiver off-ball scoring opportunity (OBSO), which is described in detail in Section C.4. We do not directly encourage agents to optimize this quantity, but we are interested in whether our agents improve useful metrics known to the sports analytics community.
In addition to the emergence of behaviours reported in Section 5, we analyze emergence of additional behaviours in Figure 12. Additional behaviours, not detailed in Section 5 are detailed in Table 6.

Type Name Description Basic
Upright Proportion of timesteps in which the agent was not fallen. 21 Football 10m passes Number of passes of range 10m or greater per 90s episode.

Close to ball
Proportion of timesteps in which at least one teammate is within 2m of the ball.

Possession
Proportion of timesteps that an team had possession of the ball. A team possess the ball if the last player to make contact with the ball was a member of the team.

Net interceptions
Number of net interceptions (interceptions for -interceptions against) per 90s episode. Interception by opponent Number of interceptions conceded to opponent per 90s episode.

Ball crowding
Proportion of timesteps in which both teammates are within 2m of the ball.
Teammates spread-out Proportion of timesteps in which two teammates are at least 5m apart.

C.2. Collecting Behavioral Statistics
To collect the behavioural statistics of a given snapshot of an agent, it played 100 episodes against the set of evaluation agents described in A.1. The length of each episode is 3000 environment steps (90 seconds), and the behavioural statistics are averaged over environment steps episode-wise. Finally, for a population, for each behavioural statistic, we report corresponding average over the 300 episodes played by the top 3 agents in the population, measured in terms of Elo against evaluation bots, together with standard error of the mean, i.e. √ 300 where is the sample standard deviation of the 300 episode means. Error therefore does not relate to variance across independent experiments, but the across episode variance of statistics for the best agents in a single population.
To plot the progression of the agent's behavioural statistics with respect to environment steps, we take snapshots of the agent at 16 intervals in training time up to 80 × 10 9 environment steps. For each snapshot, we repeat the aforementioned procedure to collect the behavioural statistics.

C.3. Probe Tasks
To test whether the passer kicks the ball in a direction correlated with the receiver position we measure the component (the direction parallel to the goal-line) of the ball velocity when the passer first touches the ball and moves it forwards. The probe score measures the performance of a policy at the probe task. On any epsiode of the probe task an agent scores 1 2 + 1 2 sign( _ ( ))sign( _ ( 0 )) Figure 12 | Locomotion skills, such as the ability to remain upright, are learned quickly, with the majority of improvement occurring within 6 hours of training. The agent is able to stay upright 75% of the time after 10 hours of training but continues to gradually improve its robustness in locomotion for at least 1 week of further refinement. Ball possession is also learned early on but continues to improve for at least 1 week. We also see that the agents improve their ability to intercept, with net interceptions still significantly increasing in phase 2, as well as their ability to avoid being intercepted by opponent, as the agents also improve their awareness of opponents. Passing occurs early in training but passes are initially infrequent and short-range -after one day of training less than 20% of passes are over 10m in range. Long-range pass frequency, reflected by the absolute frequency of 10m passes over a 90 second game, continuously improve for at least 2 weeks of training. Long-range passes eventually represent 40% of passes. Behaviours related to the division of labour are learned more slowly. For 1 day of training the teammates spread out metric significantly decrease, as agents prioritize ball possession, and behaviours are characterized by individualistic ball chasing. After 1 day of training there is a phase shift and the off-ball player starts to reduce ball crowding and cease competing for possession with a teammate. Ball crowding decreases significantly, despite close to ball remaining high, indicating that at least one teammate remains close to the ball and agents have learnt division of labour. After 1 week of training there is also small increase in the average spread of agents measured by the teammates spread out statistic.
where the random variable is first time-point in which the passer touches the ball, or scores 0.5 if the ball is first touched by a defender or if the ball is first kicked backwards. The probe score is averaged over episodes against evaluation agents: where P , is the distribution over trajectories = ( , 1 , . . . , , 1 , . . . , ) ∈ [ ] encountered by playing policy against a randomly sampled evaluation agent in the probe task. Thus a score of 1 means the passer always kicks in the receiver direction, 0 means it never does.
To understand whether the behaviour of the agent is driven by learned knowledge of the value of certain game states we also measure whether the passer's and receiver's value functions register higher value when the ball travels towards the receiver, rather than away: we analyze the pass-value correlation (PVC) statistic defined on any particular episode via is a function indicating whether the ball travels towards the receiver wing. We average this quantity over all initial configurations of the probe task and over all possible ball velocities which are such that the ball will reach the forward right or forward left quadrant (from the passer's perspective) in 1 second, and over ∼ (·| ). Figure 13 | Visualization of the underlying components in the OBSO model for an example play. From left to right: potential Pitch Control Field (PPCF) model, capturing the probability of successful passes from the player in control to off-ball players; ball transition model, capturing the ball transition probability (from its original position to a location on the pitch); score model, capturing the probability of scoring from any position on the pitch; receiver OBSO scalar field, computed from the three preceding model probabilities.

C.4. Off-Ball Scoring Opportunity
Off-ball scoring opportunities (OBSO) (49) quantify the quality of an attacker's positions. Specifically, OBSO models the probability of an off-ball player (i.e., a player currently not in possession of the ball) scoring in the immediate future: in order to convert an opportunity into a goal, the ball first needs to be passed to the off-ball player, the player needs to successfully control the ball, and finally score. Importantly, OBSO provides a spatiotemporally dense measure of performance, allowing one to give each player credit for creating opportunities even if they do not yield a goal. We measure an OBSO statistic at regular snapshots as agent training progresses, by playing matches against a fixed set of opponent evaluation agents. This section provides a high-level description of the OBSO model used for agent evaluation in the main text, with technical details provided in (49).

C.4.1. Model Overview
OBSO is based on three underlying models that prescribe the probability of the events necessary for a goal to be scored (see Figure 13 for an illustrative example): i) the Potential Pitch Control Field model (capturing the probability of a pass being controlled by an off-ball player); ii) the ball transition model (capturing the dynamics of the ball); and iii) the score model (capturing the probability of scoring from a point on the pitch). For each agent, we build each of these three models, fitting model parameters using data collected from the individual agent's play. We next provide an overview of these underlying models at a high level, subsequently detailing how parameters are fit to more accurately reflect the physical characteristics of our particular agents and environment.
Potential Pitch Control Field Potential Pitch Control Fields (PPCF) model probabilities of successful passes using physical concepts such as interception time, ball flight time, and player reaction time, to quantify the spatial control of the football pitch by individual players or their associated teams. Here we use PPCF with a simplified motion model, wherein at the point of passing, we assume the ball travels with a constant reference speed to the target destination. Simultaneously, the off-ball receiving player, , is assumed to continue travelling in a straight line (at their current velocity) during reaction time . Following this reaction period, the off-ball player is assumed to travel to the ball's target destination at their reference top speed, , in a straight line. Under these simplifying assumptions, we use the PPCF model as detailed in (49) to compute the probability of the ball being received by a given off-ball player at all possible ball target locations on pitch.

Ball Transition Model
The OBSO model assumes that the motion model underlying the spatial movement of the ball, on average across all games and plays, is normally distributed due to the aggregate passes, collisions, interceptions, and other interactions (see second panel of Figure 13 for an example). To account for the agency of the players (i.e., the fact that the passing player will choose destinations with high pitch control for their own team), (49) modulates the ball transition probability by the pitch control probability.

Score Model
The scoring model used in OBSO assumes that the probability of scoring is a function of the distance to the goal (see the third panel of Figure 13).
Overall OBSO Model Given the above three models, given any instantaneous game state, the overall OBSO probability for a giving receiving player is simply computed as the product of the above probabilities at any receiving position on the pitch (as exemplified in the final panel of Figure 13).

Data Fitting
The OBSO model requires fitting of the various parameters to ensure a reasonable approximation of scoring opportunities. We fit the OBSO parameters independently for agents and evaluation agents in our evaluation benchmarks; i.e., a distinct set of parameters (e.g., reference velocities, scoring model parameters) are fit independently at each considered point in training. Unlike the work of (49), which used a shared set of parameters across all real-world players considered in their analysis, our implementation uses independent parameter fitting to reflect the progression of performance throughout training and the distinction between learning agents and fixed evaluation agents.
In more detail, we conduct parameter fitting for each player type over the tournament dataset discussed in Appendix C.2. For the PPCF model, we aggregate player speeds across all episodes, and use the mean as the reference, . Likewise, the reference ball speed, , corresponds to the mean ball speed observed across all passes in the dataset. Finally, we found the specific value of the reaction time ( = 0.5sec for all reported figures) to have little impact on the results, compared to the other parameters.
For the raw ball transition model, we filter all consecutive touches by pairs of unique players (i.e., excluding dribbling), using these aggregate transitions to fit the parameters of a 2D Gaussian.
Finally, for the scoring model, we aggregate all touches immediately resulting in a goal and subsequently use the empirical distribution of goal probabilities as a function of distance to goal in the OBSO model.

C.4.2. Additional OBSO Results
Analysis of OBSO in the trained agents is informative from an evaluation perspective, as i) OBSO is an externally-defined performance measure used in real-world football analytics, and ii) is not a measure that is explicitly optimized for by the agents in the training pipeline (i.e., our agents are unaware of OBSO as a measure to maximize during training). Figure 14 provides an overview of the evolution of the OBSO measure throughout training. We differentiate between Receiver OBSO and Total Receiver OBSO; For both, we compute the OBSO measure over the entire pitch at the moment of pass initiation for all passes with range 5m or more. For Receiver OBSO, we use the point evaluation of the OBSO measure for the receiver's position at the moment of pass reception; this captures team coordination, as it emphasizes both the receiver's current location at the time the pass was initiated. For Total Receiver OBSO, we simply spatially integrate the OBSO scalar field of the receiving player over the entire pitch; this measures the overall scoring opportunity of the receiver at the moment of pass initiation. Each series in this plot corresponds to a snapshot of the trained agents, evaluated   Figure 14 | Empirical cumulative distribution functions of (left) receiver OBSO and (right) total receiver OBSO. The environment steps for each of the series in these plots correspond to those also used for performance reporting in Figure 5.
against a static set of pre-trained evaluation agents, see Appendix C.2 for details. It is evident that the number of passes with high OBSO consistently increases with training time, along with the average OBSO across all passes. This result is notable, as it indicates that the trained agents learn to progressively position themselves on the pitch in ways that increases their scoring opportunity, serving as quantifiable evidence of their understanding of the dynamics of the football environment and interactions with the ball and opposing agents.

C.5. Knowledge Representation
We repeat and extend the analysis of agent's knowledge proposed in (18) to help us understand how the agent represents its environment, what aspects of game state are emphasized or de-emphasized, and how efficiently it uses its memory module to represent game features such that the policy head has easy access to corresponding game feature when making decisions.
We say that the agent has game-feature related knowledge of a given piece of information if that information can be decoded with sufficient accuracy from the agent's recurrent hidden state using a linear probe classifier. In particular, we compare three classification methods: 1) logistic regression on the agent's raw observations of game state, 2) logistic regression on the agent's internal state, and 3) a Multi-layer perceptron (MLP) classifier on the agent's internal state. 1 vs 2 indicates which game features are emphasized or de-emphasized in the agent's internal representation, and 2 vs 3 quantifies how efficient the internal representation of a given game feature is.
We define a set of 44 binary features about present game state (listed in Figure 7). Given a game feature, evaluating the three probe classifiers unfolds into the following steps: 1) For each game feature, we collect a dataset consisting of 500k timesteps sampled from 512 game plays, and for each timestep, we label it as positive if it has the feature, negative otherwise. 2) Given the dataset, we split it into training and test sets by uniform sampling with a randomization seed. 3) Fixing the dataset, we report the performance of each classifier on the test set in terms of balanced accuracy evaluated with 3-fold cross-validation. 4) Finally, we repeat Step 2) to 3) 5 times by splitting the dataset with randomization seeds, and report the test accuracy as the final performance of the probe classifiers. The full list of results are shown in in Table 7.
Further insights about the geometry of the raw observation space and the representation space are gleaned by performing a t-SNE dimensionality reduction on the raw observations fed to the agent (Figure 6, B1) and the recurrent hidden state (Figure 6, Panel B2) respectively. We find strong evidence of cluster structure in the agent's representation reflecting conjunction of game features: whether the agent has fallen, which player is closest to the ball, and whether the ball is close to home Figure 15 | Correlation between agent's performance and behavioural statistics of coordination. We investigated four populations with different training regimes as reported in Section 7. For each population, we fixed the environment steps to 40e9 and collected the coordination statistics of passing range (left) and passing frequency (right) for each agent. Each data point in the plots represent the mean value of corresponding behavioural metric collected from 64 episodes for one agent in a population. or away goal.
Finally, we investigate the correlation between agent's performance and behavioural statistics of coordination, i.e., passing range and frequency ( Figure 15). To do this, we investigate the agents from four different training regimes which are used in the ablation study (Section 7). For each regime, we take the snapshot of corresponding population at 40e9 environment steps. For each agent in the snapshot, which is associated with an Elo score, we collect the behavioural statistics from 64 episodes against the set of evaluation agents described in A.1. The length of each episode is 3000 environment steps, and the behavioural statistics are averaged over environment steps episode-wise. Such an (Elo, average behavioural statistic) pair correspond one data point in Figure 15. We find that the coordination statistics are positively correlated with the agent's performance.