Difference between revisions of "Scenario file"

From SIMA wiki
Jump to: navigation, search
(Entity Groups)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Creation of a Scenario ==
 
== 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.
+
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".
  
 
== Structure of a Property Line ==
 
== Structure of a Property Line ==
[Key] [‘:’ | ’=’][Associated element]
+
[Key] ‘:’ | ’=’[Associated element]
  
 
e.g.: field_height=200.0 ; field_height:200.0
 
e.g.: field_height=200.0 ; field_height:200.0
Line 19: Line 19:
 
*usedefaults [Boolean] : Highly recommended to set it to true. If false no default properties will be loaded
 
*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_type[String]: use SIMPLE_PROPERTY_LOADER
*loader_version[String]
+
*loader_version[String] use 3
  
  
Line 25: Line 25:
 
*image[String]: path to a screenshot of the scenario
 
*image[String]: path to a screenshot of the scenario
  
==Entities==
+
==Add Entities==
Entities are summarized in entity groups. Each entities within a group has the same properties (except the position).
+
Entities are summarized in entity groups. Each entity within a group has the same properties (except the position).
  
 
===Entity Groups===
 
===Entity Groups===
Line 44: Line 44:
 
**positions.0.pos_y [Integer]
 
**positions.0.pos_y [Integer]
  
===Change Default Properties===
+
===Overwrite Entity 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
 +
 
 +
<nowiki>public static clsProperties getDefaultProperties(String poPrefix) </nowiki>
 +
 
 +
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.
 +
 
 +
#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/
 +
#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.
 
It is possible to change the default properties of an entity of decision unit by adding on of the following keywords.
 
*overwriteentitydefaults
 
*overwriteentitydefaults

Latest revision as of 14:58, 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".

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

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) 

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.