Next Previous Contents

6. Arena construction

In RealTimeBattle, it is very simple to construct your own arenas. The language consists of only eleven commands, and there are essentially four building blocks: line, circle, inner_circle and arc. This is mainly because of speed reason, for circles and lines it is very easy to check if a collision has occured. Circle and inner_circle prevents robots from entering into a circle or getting out of a circle respectively. The line and the arc stop the robots from entering through the long side ( the curved for the arc ), but no check is made on the short side, so you have to put circles at each end of the line to make it a solid object. The commands polygon, closed_polygon and poly_curve are intended to simplify this procedure, always giving a proper object.

All angles are by default in radians but can be changed to degrees by the command angle_unit degrees.

Note that RealTimeBattle does not check whether the arena file gives a correct arena, it is entirely up to you. However, it will complain if there are violations to the language rules.

Arena files should be given the postfix .arena and be stored in the arena directory for RealTimeBattle to find them.

The bounce coefficient and hardness argument given to all wall creating commands, determines the material of the wall. They are both values between 0 and 1. Harder walls will injure colliding robots more and higher bounce coefficient make them bounce better.

You are also encouraged to study the arenas included and learn from the examples.

6.1 Arena commands

A command consists of the command name and the arguments separated by whitespace. Be sure to give the right number of arguments!

In the command list, the arguments are given in square brackets.

scale [value]

This value times the arena scale will give the scale factor, by which all coordinates are multiplied. This command must be, if it exists, the very first in the file, default is 1.0.

angle_unit [unit]

Switches to the selected angle unit, which can be either of degrees or radians. Default is radians.

boundary [left] [up] [right] [down]

The boundary encloses the area, in which robot, cookies and mines are placed. It also determines the visible area in the arena window. This command is required and may only be preceded by scale.

inner_circle [bounce] [hardness] [center_x] [center_y] [radius]

Robots are limited to the inside of this circle.

circle [bounce] [hardness] [center_x] [center_y] [radius]

Circle shaped wall.

line [bounce] [hardness] [thickness] [start_x] [start_y] [end_x] [end_y]

Creates a line. It only prevents the robot from passing through to long side, so remember to put circles at the short ends.

arc [bnc] [hardn] [thickn] [center_x] [ctr_y] [inner_radius] [outer_rds] [angle1] [angle2]

An arc is a sector of a ring within two angles. Like the line, it needs circles at both the ends.

polygon [bounce] [hardn] [thickn] [number of vertices] ([center_x] [center_y])...

This will create a number of circles, connected by lines.

closed_polygon [bounce] [hardn] [thickn] [number of vertices] ([center_x] [center_y])...

As a polygon, but the first and the last vertices are also connected by a line.

poly_curve [bnc] [hardn] [thickn] [start_x] [start_y] [dir_x] [dir_y] ([command args ...]) ...

The poly_curve is the most powerful of the arena commands. It is used to build walls with lines and arcs. At each step you have a current position and direction, which are affected by the subcommands. The last subcommand must be C or Q.

L [length]

Draw a line with given length in the current direction.

T [angle]

Turn the current dircetion.

A [angle] [radius]

Draw an arc.

C

Finish by connecting with the starting point.

Q

Quit.

exclusion_point [position_x] [position_y]

When the arena inside the boundary consists of several separated areas, you should exclude all but one by inserting exclusion points. All points from which you can draw a straight line to an exclusion point without crossing a wall, are considered to be outside the arena.


Next Previous Contents