Keywords

1 Introduction

Over the last couple of years, a complete framework for the specification, execution and graphic design of Setplays was designed and developed [15]. Setplays are sequences of actions and player strategic positions that should be executed cooperatively by a set of players in order to achieve an objective during the match, more commonly following a stoppage, butpossibly also in play-on situations. Setplays are frequently used for corner kicks and direct free kicks. The Setplay Framework evolved to a complete set of concepts, with representation and execution mechanisms, to achieve effective collaborative behavior [1]. The concepts of the framework were developed and used in implementations of the FCPortugal 2D Simulation team since 2009 [6, 7]. In order to simplify the specification and development of the collaborative behavior, a graphical tool was developed [8], which later evolved to a complete environment for collaboration design [9], allowing the graphical definition of complex setplays.

The remainder of the paper presents the Setplay Library (Sect. 2), the SPlanner tool (Sect. 3), and a complete example of a team based on Agent2D (Sect. 4) that uses the library to execute setplays. Finally, in Sect. 5, some conclusions and possibilities of future work are presented.

2 The Setplay Library

Setplays (or set pieces) are pre-planned interactions among team members, used in specific situations by many teams, in collective sports such as football, rugby and soccerFootnote 1. In the scope of the Setplay Framework, setplays are understood as predefined collaborative plays, used most commonly after stoppage situations (corner kicks, throw-ins, etc.). A setplay’s goal is to surprise the opponent team with favorable sequences of passes and movements, ideally leading to a clear chance to shoot at goal.

An initial version of the Setplay Library [1] was developed and evaluated specifically for the FCPortugal 2D Simulation Team. Besides this, the library has also been successfully applied to the FCPortugal3D team (3D Simulation League) and the Middle Size League team CAMBADA [10]. The Setplay Framework is built upon a standardized, league independent, S-Expression based specification language, that defines setplays in enough detail for direct interpretation and execution in any soccer league, possibly including human soccer teams, at run-time.

Fig. 1.
figure 1

Setplay concepts and their relationships

The setplay is defined by a set of basic parameters, such as its name, identification number, the region of the field where it is planned to start, players involved and the game mode (that can be any situation in the game, e.g. Kick-off, Throw-in, Corner-kick). Figure 1 presents a diagram of the entities present in the definition of a setplay. A setplay’s definition is, roughly speaking, a sequence of Steps. Each Step has a waiting time for action execution and a time-out to abort the setplay, as well as a set of Participants. Entering into a Step also depends on a Condition, that must be satisfied beforehand. Steps have one or more possible Transitions that indicate a set of actions that must be executed in order to reach another Step. In Fig. 2 the possible actions are graphically depicted.

Fig. 2.
figure 2

Action base class and its derived classes

The complete library that implements this specification was recently made available as free softwareFootnote 2. Together with the library itself, a complete example of its integration in a fully functional 2D team, Agent2D version 3.1.1 [11], that can use all the functionalities of the library, was also made publicFootnote 3.

3 The SPlanner Graphic Specification Tool

In order to make it easier to specify complex setplays, a graphic tool (Playmaker [8]) was developed to allow the graphic design of setplays. An enhanced version of this tool, resulting from a complete re-design and integration with both the 2D Soccer Simulator and LogPlayer was called SPlanner [9], and has also been made publicly availableFootnote 4.

SPlanner can be used to create a new setplay, or edit an existing one. Figure 3 shows the interface for creating new setplays, while configuring the playmodes in which a setplay can be started. In the example presented in Fig. 3, the setplay is for Direct free kick, and can be executed if the position where the foul occurs is inside one of the accepted areas, an intersection of transverse areas (“our_back”, “our_middle”, “our_front”, “their_front”, “their_middle”, “their_back”) and longitudinal areas (“far_left”, “mid_left”, “centre_left”, “centre_right”, “mid_right”, “far_right”). By combining the selection of these areas, the desired initial position of the setplay is set.

Fig. 3.
figure 3

Creation of new setplay - Types of setplays (left) and setplay position (right).

Fig. 4.
figure 4

Example of setplay definition inside the SPlanner graphic tool

Once a new setplay is created, SPlanner’s main screen is presented (Fig. 4). On the lower left corner of the figure, a representation of the complete setplay as a directed graph is presented, where nodes represent steps, and arcs represent transitions between steps. The initial state of the graph is automatically created, consisting of one player positioned, in possession of the ball, and ready to start the setplay. After the initial positioning the players in the field (realized by simple “drag-and-drop” operations), actions can be assigned to each player by clicking over them, in a context menu.

Figure 5 presents all the possible actions that can be assigned to a player. The context menus only allow possible actions to be assigned to each player. As such, the player with the ball can execute the actions direct pass(a), forward pass(b), dribble(c), hold ball(d) or shot at goal(e). In any step of the setplay execution, the following positioning actions can be associated to each player not in possession of the ball: hold(f), run(g), or run to the offside line(h). If no action is specified, the player will remain in its initial position.

Fig. 5.
figure 5

Graphic design of the actions a player can execute during a setplay: (a) direct pass, (b) forward pass, (c) dribble, (d) hold ball, (e) shoot at goal, (f) hold, (g) run, (h) run to the offside line

Fig. 6.
figure 6

Complete example of setplay in SPlanner

In Fig. 6, the steps of a setplay following a corner kick are detailed. The setplay starts on the left side of the field, with player 6 taking the kick and passing the ball to player 7, while player 8 runs to a point inside the goal area (a). In the next step, player 7, after receiving the ball, forwards the ball to the free space in front of player 8 (b). Finally, player 8 tries to shoot at goal(c). If the setplay is labeled as invertible, it can also be executed on corner kicks on the right side of the field: all player positions and actions will simply be mirrored about the x-axis.

By assigning actions to different players at each step, it is possible to create complex collaborative setplays for each situation. The SPlanner tool allows for the graphic specification of such complex behavior, with an user-friendly interface. To evaluate and test the execution of setplays, it is possible to export the setplay to a configuration file, and even start the simulation directly from the application.

4 Using the Setplay Library to Obtain Coordinated Colaborative Soccer Playing Behavior

In order to enhance a robot-soccer playing team with the ability to execute a coordinate collaborative behavior, as the one described in SPlanner and made possible by the Setplay Library, it is necessary to apply the framework to a team with good performance. As Agent2D’s [11] source code is well known and used by various teams from the 2D Soccer simulation community, this code was chosen to be the basis of an example integration of the Setplay Framework.

Fig. 7.
figure 7

Execution flow while executing a setplay

The application of the Framework to a team depends on the implementation of an interface between the soccer-playing agent and the library. This interface depends mostly on the State-of-the-World (SoW: which agent has the ball, where each agent is positioned on the field, what is the current play-mode, etc.). The Framework defines an abstract class (Context) to model the SoW, whose functions have to be implemented. These functions are mostly lookup functions for predicates (ball possession, ability to shoot at goal, etc.). Other methods allow the inspection of important information: current time of play, ball position, player position, the play-mode and field dimensions.

As the Framework manages setplay execution, it will need to have some actions executed. It is thus required that an abstract class (Action::Executor) is implemented, which has methods to execute all the Actions defined by the Framework, such as forwarding or passing the ball, dribble, shoot or move to a position on the field.

Each agent can at anytime use the Framework to determine if some setplay is available for execution, i.e., that setplay’s pre-conditions are satisfied. If this happens to be the case, the Framework can also choose the players in the most favorable positions to participate in the setplay.

After the setplay has been started, the control flow will be as presented in Fig. 7: repeatedly, the agent will update the Framework’s internal state and check if the setplay has ended. If this is the case, it will exit setplay execution and resume normal behavior. If the setplay is running, it will check if some action should be executed. If this is not the case, due to, e.g., the wait time not having elapsed, it will move to the setplay position.

5 Conclusions

This paper presents the Setplay Framework, composed of the C++ Setplay Library, the SPlanner graphic specification tool, and a complete example of the application of the framework to a team, based on the Agent2D code. Since Agent2D and its related libraries are used by a large portion of the teams participating in the 2D Simulation Robocup league, this release of the framework as free software will certainly be of interest to this community. It allows easy integration of complex collaborative setplays with minimal programming effort. Such collaboration scenarios can easily be planned, designed and tuned using a dedicated graphic tool.

The main contributions in this work to the Robocup community are thus: development and release, as free software, of the Setplay Library, the SPlanner graphical specification tool, and the complete functional example of its use based on the Agent2D source code. The framework is not limited to application to the 2D simulation league, as its generality allows the use by any Robocup soccer team, both in simulated and real robots leagues. Experiments using the setplay library, with both FCPortugal3D and CAMBADA Middle Size League team [10], have proved the generality of the proposed approach. The availability of the complete framework as free software can allow teams from every league to execute complex collaborative behavior, making robotic soccer matches more realistic and exciting to program and watch.

In terms of future development, it is planned to apply the Setplay Framework to teams from other leagues (such as Standard Platform), which will provide new feedback about possible future improvements. The Framework will also be used to bring together players from different teams, by making them commonly execute setplays.