Soccer Simulation

The brief: It's RoboCupJunior Soccer, but simulated! Program two robots in either a drag and drop Blocks interface, or in JavaScript, to battle it out in a simulated soccer field.

Challenge details

The final competition will be run using the Australian Blocks/JS SoccerSim rules (2021).

There is one division this year. Programs can be written in either Blocks or JavaScript.

Scoring will be based on round robin competitions. The top 8 teams will enter a knockout competition to determine the final winners. If there are any technical issues during rounds, the round will be restarted and re-simulated.

Submission

Blocks challenge: two files ending in .xml should be submitted.

JavaScript challenge: two files ending in .js should be submitted.

Please submit your files as TeamName-robot1 and TeamName-robot2. Please also include a description with your uploads, with the following information:

  • Which robot to use as a kicker/goalie when starting a round

  • Where to place your robots, if you are not using the 'set initial position' block

  • Whether your robots are dual or tri bots.

Please see the submission details on the Submissions page.

Getting started with Blocks

To get started, go to https://rcjnsw.github.io/soccersim/blocks. On the left, you'll see your Blocks interface, and on the right, the Simulation. You can write Blocks programs for each of the blue robots, and use different blocks to loop forever, check the ball angle, or move the motors.

The most common and useful blocks are:

  • Motors: Here you'll find ways to set the motor speed!

  • Control: You'll find a 'repeat forever' block to keep your program running, 'if' blocks for testing.

  • Operators: To make comparisons with 'if' blocks, you will find 'equals', 'greater than' and most other blocks here.

  • Sensors: for your ball direction (in degrees), ball distance (in pixels) and robot heading (in degrees)

The best way to start is to try get the robot moving! Place a 'repeat forever' block into the workspace, and then two 'set motor speed' blocks - one for motor A (left) and motor B (right). Change the speeds to 50.

Then hit the green Run all button! You should see the robot move forward. You can click and drag on the robot to move it back. To rotate the robot, click and drag on the robot's wheels.

To stop the robot, click the red 'Stop all' button.

Getting started with JavaScript

To get started, go to https://rcjnsw.github.io/soccersim/javascript. All custom robot functions you might need to use are defined in the SoccerSim docs. If you have done text-based programming but haven't touched JavaScript, that's totally fine! The basics of JavaScript is pretty simple, and most of the things you need to learn is the syntax.

A good gentle introduction to JavaScript is https://javascript.info/first-steps. You can also use Mozilla's crash course, if you just want the syntax of the basic building blocks.

The best way to start is to try get the robot moving! The following code will get your robot moving forward:

while (1) {
setMotorSpeed('motorA', 50);
setMotorSpeed('motorB', 50);
}

Then hit the green Run all button! You should see the robot move forward. You can click and drag on the robot to move it back. To rotate the robot, click and drag on the robot's wheels.

To stop the robot, click the red 'Stop all' button.

For more in depth instructions, see our playlist tutorial.

Playlist: https://www.youtube.com/playlist?list=PL3BA7TyCKOr-rPOv9suLmuvuKRCPMXfcK

SoccerSim docs: https://tools.robocupjunior.org.au/soccersim/docs/