Download presentation

Presentation is loading. Please wait.

Published bySam Collie Modified over 2 years ago

1
Soccer Field Dimensions 130 (-65, -65) (65, 65) (65, -65) (-65, 65) Angles are measured in radians going anti-clockwise from the positive x – axis. Goal Size (radius) was 7.5m by default, I had to increase it to 13m to cover the actual goal nets adequately. All other parameters were left at their defaults. Parameters are set inside default.sma inside the engine sub-directory of Gun-Tactyx

2
Math Requirements You must be competent with basic trigonometry and geometry. You need to be confident converting between Polar and Cartesian coordinates. You’ll need to convert between relative and absolute vectors and handle vector arithmetic such as normalising vectors, adding vectors and doing dot and cross products. You also need to remember your SOHCAHTOA rules and how to calculate distances between two Cartesian points using the Pythagoras formula.

3
Useful Functions 1 float:BoundAngle(float:angle) { if(angle >= 0.0) { angle = mod(angle, 2*PI); } else { angle = 2.0*PI - mod(-angle, 2*PI); } if(angle > PI) { angle -= (2.0*PI); } return angle; }//end BoundAngle Takes an unbounded angle and returns a bounded angle between 0 and 2π, without using any loops.

4
Useful Functions 2 ConvertCartesian(float:yaw,float:dist,&float:x,&float:y) { x = dist * cos(yaw); y = dist * sin(yaw); }//end ConvertCartesian Takes a Polar coordinate, such as returned by one of the sensor functions and converts it to Cartesian coordinates.

5
Useful Functions 3 ConvertPolar(float:x,float:y,&float:yaw,&float:dist) { //new const float PI = dist = sqrt(x*x + y*y) if((x -0.01)) { if(y > 0) { yaw = PI / 2.0 } else { yaw = PI * 3.0 / 2.0 } }//end if - check if x is close to zero else { yaw = atan(y / x); if(x < 0.0) yaw += PI; else if(y < 0.0) yaw += (2.0 * PI); }//end else yaw = BoundAngle(yaw); } Takes a Cartesion coordinate, such as the goal to aim for and converts it to polar coordinates to steer the bot with.

6
Last Year’s League Winners RankNameWin/LossWin/Loss % 1David43/ % 2Roland30/ % 3Jeff23/ % 4Recruit26/ % Map: Field Teams: 2 Players: 8 Match Length:30 mins Start Corners:0 and 1, 2 and 3 (opposite sides) Description:All on all tournament, each bot played every other bot 4 times, once from each starting corner (total 48 matches per bot). Drawn game results not shown.

7
David’s bot Pros Only bot that could accurately kick towards the goals (calculated a vector between the ball and the goals, then projected a perpendicular vector from the bot’s position to the ball to “sideswipe” the ball in the right direction). Often made it to the ball before opponents since it took a very direct approach. Premier bot, consistently beat every other opponent. Very simple code, one of the smallest bots in terms of source code. Cons No team play whatsoever, each bot behaved exactly the same and ignored team mates. Could only kick the ball within 90 degrees of the direction it was currently travelling. Prone to kicking own goals if the ball was on the opposite side of the bot to the direction it wanted to kick in.

8
Roland’s bot Pros Best team play, reserved 3 bots as defenders and while the rest roamed. Defenders were well organised and effective. Attackers were reasonable and never kicked own goals. Cons Attacking bots had no memory, when they got too close to the ball it would go beneath their field of vision and they would forget it was there, turning away at the last moment to look for the ball else where.

9
Jeff’s bot Pros Sophisticated attack code for circling onto the ball and kicking it directly in the desired direction. Best coding standards, most readable and efficient code (all the useful functions copied straight from Jeff’s code). Also showed team behaviour with three bots allocated to defensive (but not as effective as Roland’s). Cons The circling attack took too long to make contact with the ball, opponents would often kick it away first. Had poor thrashing behaviour, so could get tangled up with allied and opposing bots easily and never break free.

10
Recruit Pros Took the most direct path to the ball, usually making contact before the opponents and spoiling their more sophisticated tactics. Would widely disperse around the field and rarely get tangled up when colliding for long. Despite completely goalless behaviour still beat all last year’s the students bots (in every league that was played) with the exception of David’s, Roland’s and Jeff’s bots. Cons Just wanted to kick the ball, doesn’t care where. So just as likely to kick own goals as opposing goals.

11
General tips Take the time to learn the keys, especially the time modifiers (-/+) on the number pad… Watching games in x1 speed gets boring really fast and it’s a big waste of time. Remember the bots angles are absolute, not relative, use the functions in these notes to take a relative angle you wish to turn and add it to the bots absolute angle. Otherwise your bots will spend most of their time spinning in circles. The 2d view is generally more useful for judging the bots behaviours and team play. Use the provided gtplaylist and gtstat command line tools to set up your own tournaments to play at high speed. They are simple to use and let you quickly evaluate the performance of your bot versus the others. They also allow you to specify the start locations of the bots, which saves time having to reset when the bots are not assigned goals which are opposite one another.

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google