Difference between revisions of "Scenario file"

From SIMA wiki
Jump to: navigation, search
(overwrite Default Properties)
Line 48: Line 48:
 
**positions.0.pos_y [Integer]
 
**positions.0.pos_y [Integer]
  
===overwrite Default Properties===
+
===Overwrite Entity Properties===
 
Each entity implements the method getDefauktProperties(). this method returns the default properties of this class, the super classes and all associated classes like body, decision unit,...
 
Each entity implements the method getDefauktProperties(). this method returns the default properties of this class, the super classes and all associated classes like body, decision unit,...
  

Revision as of 14:53, 17 January 2013

Creation of a Scenario

Each Scenario displayed in the scenario list of the scenario selector is based on a property file located in “sim/config/scenarios”. For an example you can look at the file “tutorial.properties".

The scenario files are used to configure the simulated world. This includes properties of agents and their decision units. You can configure any properties that are listed in a class under

public static clsProperties getDefaultProperties(String poPrefix) 

Structure of a Property Line

[Key] ‘:’ | ’=’[Associated element]

e.g.: field_height=200.0 ; field_height:200.0

Scenario Properties

Each scenario file must include a set of properties which describes the simulation environment.

Mandatory properties:

  • title [String]: The title will be shown in the shortlist of the scenario selector
  • short_ description [String]
  • description [String]
  • field_height [real]
  • field_width [real]
  • worldboundarywalls [Boolean]: If true a wall around the world will be added
  • usedefaults [Boolean] : Highly recommended to set it to true. If false no default properties will be loaded
  • loader_type[String]: use SIMPLE_PROPERTY_LOADER
  • loader_version[String] use 3


Optional Properties:

  • image[String]: path to a screenshot of the scenario

Add Entities

Entities are summarized in entity groups. Each entity within a group has the same properties (except the position).

Entity Groups

Each entity group gets an ID

e.g.: entitygroups.0.

  • groupentitytype[String]: Defines the type of the entities of this group
  • groupdecisionunittype [String]:Defines the decision unit type
  • numentities [Integer]:the number of entities in this group
  • positions.positiontype [String]: RANDOM | LIST
    • RANDOM: the entities will be placed randomly
    • LIST: you have to define positions for each entity
  • positions - used if position.positiontyp= LIST
    • positions.0.pos_angle [Real]: orientation in radiant
    • positions.0.pos_x [Integer]: position (top-left is (0/0))
    • positions.0.pos_y [Integer]

Overwrite Entity Properties

Each entity implements the method getDefauktProperties(). this method returns the default properties of this class, the super classes and all associated classes like body, decision unit,...

There are two ways to detect which properties are associated with an entity.

  1. run the class Sim/src/sim/GetDefaultConfig.java - for each entity and decision unit a file with its default properties is generated in Sim/config/default_not_in_use/
  2. Look at the getDefaultProperties method in the source code. Attention: Within these method getDefaultProperty methodes from other classes (body, decision unit,...) are called.

It is possible to change the default properties of an entity of decision unit by adding on of the following keywords.

  • overwriteentitydefaults
  • removeentitydefaults
  • overwritedecisionunitdefaults
  • removedecisionunitdefaults

e.g.: entitygroups.1.overwriteentitydefaults.shape.shape_fresh.image_path=/World/src/resources/images/carrot_grayscale.png

changes the property “shape.shape_fresh.image_path” of entity group 1.