Skip to content

Landscapes

Rubén Rodríguez edited this page Sep 26, 2020 · 2 revisions

Landscapes

In order to generate the landscapes of the game, an automatic map generator has been implemented. The automatic map generator generates the game mode scenarios from the LandScape1, Landscape2, ..., LandscapeN folders, located in the World Tour, Out Run, Pole Position, Driving Fury and Demarrage directories, accessible from the GameModes directory, present in the main Data directory. Each of these folders contains the information relating to each scenario, structured as follows.

 

Objects of the map

The objects are defined both by the images of the sprites, identified by a correlative digit ranging from the value 1 to the number of objects on that map (1.png, 2.png, ..., and so on), and by the optional information of each element. This information is found in XML files whose names coincide with the identifiers of each object (1.xml, 2.xml, ..., and so on).

The files relating to the properties of each element are simple XML files of optional existence. The properties of the landscape elements are specified through the following attributes:

  • Scale.
  • Hit_center.
  • Hit_left.
  • Hit_right.
  • Hit_sides.

The values of all these nodes are decimal numbers. The Scale node can take positive values from 0.0 to 3.40282e+038 and multiplies the size of the object by that value. The remaining types of nodes, Hit_center, ..., Hit_sides, indicate the percentage of the image that is collisions with the player's vehicles. The decimal values accompanying these node types range from 0.0 to 1.0. The value 0.0 states that the object is fully traversable and 1.0 indicates that the entire image is solid and the car can crash.

The Hit_center, ..., Hit_sides nodes define the solid part of the object from the centre of the object, for example to define that only collisions with tree trunks are allowed. Hit_left, Hit_right define the solid part of the object from the right and left of the object respectively. An example of its usefulness would be to define that only collisions with the L-shaped lamp post are allowed. The Hit_sides node is the union of Hit_right and Hit_left simultaneously, used for example to indicate that only collisions with the ends of control points are allowed.

 

Background

The map background is defined in the bg.png file and consists of a solid image of high quality and resolution.

 

The landscape layout

The layout of the stage is defined in the LandScape.xml files and they contain all the information relating to the map, from its colours to its modelling, which is formed by horizontal rectangles. Each rectangle contains the layout of the road, curved or straight, flat or with elevation, and possible decorative elements on the right, left, or both sides of the road. The structure of the landscape is configured through the following XML nodes.

  • Name: this node indicates the name of the circuit, it is a field that may or may not be present in the file. For the World Tour scenarios this node is present but for the other modes it is not.

  • Type: this node represents the type of terrain that the landscape has. This node is used to determine the type of terrain which the vehicle has to lift when it is off the road. Its possible values can be Grass, Land, and Snow.

  • Sprites: this node contains a list of all the decorative elements present in the landscape. For each of these elements, the path of the image to be loaded into the simulator file system is indicated in the file.

  • Terrain: this is the most important node in the file as it is where the entire landscape layout appears. The circuit is divided into different parts or fragments represented by the nodes with the identification code PX, where P is an abbreviation of Part and X is the number of the scene fragment.

  • Color_grass: this node represents the colours with which the non-road scenery is painted.

  • Color_road: this node represents the colours with which the road is painted.

  • Color_rumble: this node represents the colours with which the edges of the road should be painted.

  • Color_dash: This node represents the colour to paint the lanes that the road has been divided into.

All these colours are specified in RGB format. The decision that the scenarios are divided into parts or fragments results in the file sizes being much smaller than if the scenarios had been built gradually, i.e. rectangle by rectangle. Intervals are therefore sets of scenario rectangles that share common properties.

Each of the intervals into which the circuit is divided can be a straight line, a curve or a change of gradient (up or down). For each of these sections, its original position and its finishing position are specified. According to the syntax of the file, every interval is defined with the Road node followed by the start and end positions of that interval. Such limits are marked by the attributes startPosGE, startPosGT, finalPosLT or finalPosLE followed by the number of the rectangle where it starts or ends. The endings GE, GT, LT and LE are abbreviations for the logical comparators Greater Equal, Greater Than, Lower Than and Lower Equal.

In order to represent whether that piece of road contained in the Road node is a straight line, a curve or a change of grade, the following nodes are used:

  • Straight: indicates that the interval marked from the start coordinate, reflected by the startPosGE or startPosGT attributes, to the finish coordinate, marked by the finalPosLT or finalPosLE attributes, is a straight line.

  • Curve: indicates that the interval marked from the start coordinate, reflected by the startPosGE or startPosGT attributes, to the finish coordinate, marked by the finalPosLT or finalPosLE attributes is a curved line. Parallel to the previous attributes, there is another additional attribute, the Direction attribute, whose value is a decimal number that indicates the direction of the curve, left if it is negative and right if it is positive. The more positive or negative the decimal value, the more pronounced the radius of the curve will be in one direction or the other.

  • Climbing: indicates that the interval marked from the start coordinate, reflected by the startPosGE or startPosGT attributes, to the finish coordinate, marked by the finalPosLT or finalPosLE attributes is an upward (upward) gradient change. As with curves, a Direction attribute is used to determine the possible curve path. If the decimal is positive the rise is to the right, if it is negative the rise is to the left and if it takes value 0.0 the rise is straight. Additionally, there is an Elevation attribute that indicates how steep the slope is, marked with a positive integer.

  • Dropping: indicates that the interval marked from the start coordinate, reflected by the attributes startPosGE or startPosGT, to the finish coordinate, marked by the attributes finalPosLT or finalPosLE is a downward change of slope (descent). The direction of the descent is coded exactly the same as the direction of the rise.

Unlike straight lines and curves, the changes in gradient can be made up of several internal fragments. Thus, in the same ascent or descent there can be both curves and straights. These fragments are coded with PX identifiers, where P is an abbreviation for Part and X is the fragment number of the rise or fall.

Finally, for each of the fragments of the circuit, it is specified which are the decorative elements to be drawn. This information is represented by the following nodes:

  • SpriteNearLeft: this node represents the elements that appear near and to the left of the road.
  • SpriteNearRight: this node reflects the elements that appear near and to the right of the road.
  • SpriteFarLeft: This node represents the elements that appear far away and to the left of the road.
  • SpriteFarRight: This node represents elements that appear far away and to the right of the road.

The previous nodes, to represent the decorative elements, have the following properties:

  • The Each node reflects how often that element should be shown in the interval.
  • The Offset node indicates the distance at which the element appears from the road. If the offset takes a positive value, it moves away from the road. If it takes a negative value, it is closer to the road, and if it takes a value of 0.0, it is stuck to the edge. If it takes a random value, it appears in a random position.
  • The Code node indicates the identification code of the decorative element on the map.

The CheckPoint node is used to indicate the control points in the scenarios. As with the decorative elements, the Offset node indicates at what distance the checkpoint appears from the road. The Position node marks the exact point in the interval where the checkpoint appears. Unlike normal decorative elements, checkpoints only appear once. Finally, the Code node marks the identification code of the checkpoint on the map.

An important aspect to emphasize is that not only the individual configuration of the scenarios is possible. It is also possible to configure all scenarios at the same time in a specific game mode. Within the folders World Tour, Out Run, Pole Position, Driving Fury and Demarrage, located in the directory GameModes, accessible from the main folder Data, there is a folder called Configuration that contains a file in XML format where the general configuration aspects of all the scenarios of a mode are saved. Such configuration aspects are the width of the road, the number of lanes it has and its thickness.

The syntax of the XML file is extremely simple. First you specify the XML version and the character encoding of the file. Then there is the main node of the file, called Configuration, where the properties are specified as such. Next, there are the following nodes:

Width_road: represents the width of the road. It should take positive values, preferably between 1000 and 3000. The units do not express magnitude of length or distance, it is an invented metric.

Number_tracks: represents the number of lanes into which the roadway should be divided. All of them of equal size.

Rumble_limit: represents the limit of thickness of the lines that represent the lanes of the road.

It is important to bear in mind that although the range of values for each factor is quite wide, not all combinations render a correct landscape, but it can be distorted. For this reason, it is recommended that you use settings similar to those provided by default.