-
Notifications
You must be signed in to change notification settings - Fork 48
Interactions
This section explains the InteractionSet
section in the Game Description File. The InteractionSet
section is responsible for defining the actions that happens when two sprites collides. The defined action affects the first object only. Interactions are written in the following way:
InteractionSet
sprite_1 sprite_2 > interaction parameters
where sprite_1
and sprite_2
are two sprite objects defined in the sprite section, interaction
is the action taken place over sprite_1
due to the collision followed by its parameters. At each interaction line scoreChanged
parameter can be added which takes an integer number that add it to the current score. For example:
enemy bullet > killSprite scoreChange=1
This line says when an enemy collides with a bullet then kill the enemy and change the score by 1.
In multi player games, the score change must be specified for each player, for example, in a 2 player game, meaning first player gets 5 points, while the second's score remains unchanged:
enemy bullet > killSprite scoreChange=5,0
One last thing, the current VGDL Engine applies the interaction rules once per time tick. The following list contains all the supported interactions in the current GVG-AI Framework.
Description: Kill the first sprite.
Description: Kills all sprites of a given type.
Properties:
- stype: type of the sprite to kill. All sprites present in the game at this moment of this type are killed.
Description: Kill the first sprite if it has a resource value larger than or equal to a certain limit.
Properties:
- resource: The resource name used in checking.
- limit: The limit which the resource is compared with.
Description: Kill the first sprite if it has a resource value smaller than or equal to a certain limit.
Properties:
- resource: The resource name used in checking.
- limit: The limit which the resource is compared with.
Description: Kill the first sprite if the second object approached the first object from above (like in Super Mario).
Description: Kill the first sprite if the second object has a resource value larger than or equal to a certain limit.
Properties:
- resource: The resource name used in checking.
- limit: The limit which the resource is compared with.
Description: It transform all sprites of stype
to stype_other
then create a new stype at the collision location.
Properties:
- stype: The destroyed sprite name.
- stype_other: The transformed sprite name.
Description: Create a new sprite behind the second sprite in the interaction. Properties:
- stype: the spawned sprite name.
Description: Create a new sprite if the first object has a resource value larger than or equal to a certain limit.
Properties:
- stype: the spawned sprite name.
- resource: the resource name used for checking.
- limit: The limit which the resource is compared with.
Description: Create a new sprite if the first object has a resource value smaller than or equal to a certain limit.
Properties:
- stype: the spawned sprite name.
- resource: the resource name used for checking.
- limit: The limit which the resource is compared with.
Description: Clone the first sprite with same current parameters.
Description: change the first sprite into stype
.
Properties:
- stype: the target sprite name to be transformed to.
- forceOrientation: forces an orientation copy from the initial sprite. Default is false.
Description: change the first sprite into stype
if there is a determined amount of sprites of stypeCount in the game.
Properties:
- stype: the target sprite name to be transformed to.
- stypeCount: the reference sprite to check the count.
- geq: Condition "Greater or equal than" to check the amount of sprites of the reference type stypeCount. Default value is 0.
- leq: Condition "Less or equal than" to check the amount of sprites of the reference type stypeCount. Default value is Game.MAX_SPRITES.
Description: variation of the transformTo effect which changes the first sprite into a random child of stype
.
Properties:
- stype: the target sprite parent name.
Description: updates the spawn type of a SpawnPoint, to replace the second sprite in the interaction.
Properties:
- stype: the new spawn type.
- spawnPoint: the SpawnPoint which should receive the update.
Description: resets the score of the avatar to 0, if the first sprite in the interaction is an avatar. If an 'stype' is supplied, it resets that sprites score to 0, if it is an avatar.
- stype: the avatar whose score should be reset.
Description: adds health points to the first sprite in the interaction. If the value supplied added to the current number of health points would exceed the maximum number of health points, this interaction is ignored.
- value: how many health points should be added.
Description: adds health points to the first sprite in the interaction. If the value supplied added to the current number of health points would exceed the maximum number of health points, the new number of health points is set to the maximum allowed.
- value: how many health points should be added.
Description: subtracts health points from the first sprite in the interaction. If an 'stype' is supplied, the health points are subtracted from that sprite instead.
- value: how many health points should be subtracted.
- stype: sprite from which health points should be subtracted. Default is 'null'.
Description: increase speed to all sprites of type 'stype' by the value specified.
- value: how much the speed should be increased.
- stype: sprite type whose speed should be increased.
Description: decrease speed to all sprites of type 'stype' by the value specified.
- value: how much the speed should be decreased.
- stype: sprite type whose speed should be decreased.
Description: set the speed of all sprites of type 'stype' to the value specified.
- value: new speed of the sprites.
- stype: sprite type whose speed should be adjusted.
Description: undo the last movement of first sprite.
Description: undo all actions happened in the last time tick (not only the collided objects).
Description: Change the first sprite orientation to a new random orientation.
Description: Reverse the first sprite orientation to the opposite direction.
Description: Change the first sprite orientation to be equal to the second sprite orientation.
Description: Change the first sprite's position and orientation to that of the second one.
Description: Reverse the first sprite direction to the opposite direction and change the sprite position to one tile below.
Description: Wrap the first sprite around in the game screen.
Description: Teleport the first object to a certain sprite position defined in the second sprite (Second sprite should be Portal sprite). If the certain sprite is not found, it will kill the first sprite.
Description: Move the first sprite the same amount and direction like the second sprite (used for moving platforms).
Description: Push the first sprite one step in same direction of the second sprite.
Description: Destroy the first object and change the resource value of the second sprite by the a certain amount (The first sprite must be of type Resource).
Description: Change the a certain resource value in the first sprite by a certain amount.
Properties:
- resource: the resource name in the first object.
- value: the amount of change to that resource.
enemy missile > killSprite scoreChange=1
When an enemy
sprite collided with a missile
sprite, the enemy
sprite will be destroyed and the score will be changed by 1.
avatar log > pullWithIt
When an avatar
sprite collides with a log
sprite, both sprites will move in the same direction every update.
enemy wall > reverseDirection
When an enemy
sprite collides with a wall
sprite, the enemy
sprite will reverse its orientation.
weapon avatar > collectResource scoreChange=2
When avatar B collides with a 'blue' type, update the spawn type 'blue' to 'blueB' in all SpawnPoints of type blockSpawn.
avatarB blue > updateSpawnType stype=blueB spawnPoint=blockSpawn
When a weapon
sprite (weapon
is a defined as Resource in the SpriteSet) collides with an avatar
sprite, the weapon
sprite will be destroyed and the avatar
resource will be updated based on the weapon
defined parameters.
-
GVG Framework
- Tracks Description
- Code Structure
- Creating Controllers
- Creating Multi Player Controllers
- Creating Level Generators
- Running & Testing Level Generators
- Creating Rule Generators
- Running & Testing Rule Generators
-
Forward Model and State Observation
- Advancing and copying the state
- Advancing and copying the state (2 Player)
- Querying the state of the game
- Querying the state of the game (2 Player)
- Information about the state of the Avatar
- Information about the state of the Avatar (2 Player)
- Information about events happened in the game
- Information about other sprites in the game
- Game Description Class
- Constraints
- Game Analyzer Class
- Level Analyzer Class
- Sprite Level Description Class
- Sprite, Termination, and Interaction Data Class
- Level Mapping Class
- Competition Specifications
- VGDL Language