-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,352 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#### Base robot | ||
|
||
There must be at most one **base** robot in the world. Since concrete robots can be created | ||
either via the `loc` attribute or via the map and palette, use the following guide to | ||
ensure the base robot is the one you intended: | ||
|
||
1. Always list the intended **base** as the first robot definition in your scenario. | ||
2. The first robot with a `loc` attribute will become the base, even if other robots are defined earlier. | ||
3. Without any located robots, if multiple robots are instantiated on the map from | ||
the first robot definition, the first robot in | ||
[row-major order](https://en.wikipedia.org/wiki/Row-_and_column-major_order) | ||
shall be the base. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#### Capabilities | ||
|
||
Each capability enables the evaluation of execution of one or more | ||
commands or language constructs. Rather than listing all possible | ||
capabilities here, which would be annoying to keep up-to-date, see the | ||
(automatically generated) [Commands cheat | ||
sheet](https://github.com/swarm-game/swarm/wiki/Commands-Cheat-Sheet) | ||
on the Swarm wiki. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#### Cells | ||
|
||
Each cell of the world is specified by a list of terrain, optional entity | ||
and robots present (if any). For example, `[grass]`, `[grass, tree]`, | ||
or `[grass, null, base]`. | ||
|
||
- The first (required) item specifies the terrain. Currently, valid | ||
terrain values are `stone`, `dirt`, `grass`, `ice`, or `blank`. | ||
- The second item (if present) specifies the name of an entity which | ||
should be present in the cell. This may be a built-in entity, or a | ||
custom entity specified in the `entities` section. `null` may be | ||
used to explicitly specify no entity in the cell. | ||
- The third item and later (if present) specifies the names of the robots | ||
which should be present in the cell. These must be names of robots | ||
specified in the `robots` section. A copy of each robot will be | ||
created at each location in the `map` where it is drawn. | ||
|
||
Although multiple robots may be in a single location in general, | ||
there is currently no way to specify more than one robot for a | ||
cell in the world description. | ||
|
||
If a 1-tuple is used, it specifies a terrain value with no entity or | ||
robot. A 2-tuple specifies a terrain value and entity, but no robot. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#### Entity properties | ||
|
||
The properties an entity may possess are listed below. Each entity | ||
may possess any number of properties. | ||
|
||
- `unwalkable`: robots cannot `move` into a cell containing this | ||
entity. If they try, the `move` command will throw an exception. | ||
|
||
- `portable`: robots can pick this up using `grab` or `harvest`. | ||
Trying to execute `grab` or `harvest` on an entity that is not | ||
`portable` will throw an exception. | ||
|
||
- `growable`: when `harvest`ed, the entity will regrow from a seed. | ||
|
||
- `infinite`: when `grab`bed or `harvest`ed, the entity will | ||
immediately respawn. | ||
|
||
- `known`: robots know what this is without having to `scan` it first, | ||
hence it does not show up as a question mark. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Swarm YAML schema | ||
|
||
### YAML conventions | ||
|
||
Objects (key-value mappings) are described below using tables. Note | ||
that a blank "**Default?**" column means the key is required; other keys | ||
are optional and take on the indicated default value when they are not | ||
present. The order of keys in a key-value mapping does not matter. | ||
|
||
YAML is untyped, but we try to give a more precise idea of the | ||
expected types in the tables below. | ||
- `foo list` means a list where all the elements are of type `foo`. | ||
- Some values are tuples. The types and meaning of such tuple element | ||
are presented in tables with an "**Index**" column. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,110 +1,10 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://raw.githubusercontent.com/swarm-game/swarm/main/data/schema/entities.json", | ||
"title": "Swarm entities", | ||
"title": "Entities", | ||
"description": "Description of entities in the Swarm game", | ||
"type": "array", | ||
"items": { | ||
"description": "Description of an entity in the Swarm game", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"description": "The name of the entity. This is what will show up in the inventory and how the entity can be referred to." | ||
}, | ||
"display": { | ||
"type": "object", | ||
"$ref": "./display.json", | ||
"description": "Display information for the entity." | ||
}, | ||
"plural": { | ||
"default": "null", | ||
"type": "string", | ||
"description": "An explicit plural form of the name of the entity. If omitted, standard heuristics will be used for forming the English plural of its name." | ||
}, | ||
"description": { | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"type": "string" | ||
} | ||
], | ||
"description": "A description of the entity, as a list of paragraphs." | ||
}, | ||
"orientation": { | ||
"default": "null", | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"name": "X coordinate", | ||
"type": "number" | ||
}, | ||
{ | ||
"name": "Y coordinate", | ||
"type": "number" | ||
} | ||
], | ||
"description": "A 2-tuple of integers specifying an orientation vector for the entity. Currently unused." | ||
}, | ||
"growth": { | ||
"default": "null", | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"name": "minimum", | ||
"type": "number" | ||
}, | ||
{ | ||
"name": "maximum", | ||
"type": "number" | ||
} | ||
], | ||
"description": "For growable entities, a 2-tuple of integers specifying the minimum and maximum amount of time taken for one growth stage. The actual time for one growth stage will be chosen uniformly at random from this range; it takes two growth stages for an entity to be fully grown." | ||
}, | ||
"combustion": { | ||
"type": "object", | ||
"$ref": "./combustion.json", | ||
"description": "Properties of combustion." | ||
}, | ||
"yields": { | ||
"default": "null", | ||
"type": "string", | ||
"description": "The name of the entity which will be added to a robot's inventory when it executes grab or harvest on this entity. If omitted, the entity will simply yield itself." | ||
}, | ||
"properties": { | ||
"default": "[]", | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"type": "string", | ||
"examples": [ | ||
"unwalkable", | ||
"portable", | ||
"infinite", | ||
"known", | ||
"growable" | ||
] | ||
} | ||
], | ||
"description": "A list of properties of this entity. See Entity properties." | ||
}, | ||
"capabilities": { | ||
"default": "[]", | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"type": "string" | ||
} | ||
], | ||
"description": "A list of capabilities provided by entity, when it is equipped as a device. See Capabilities." | ||
} | ||
}, | ||
"required": [ | ||
"name", | ||
"display", | ||
"description" | ||
] | ||
"$ref": "entity.json" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://raw.githubusercontent.com/swarm-game/swarm/main/data/schema/entity-count.json", | ||
"title": "Entity count", | ||
"description": "One row in an inventory list", | ||
"type": "array", | ||
"items": [ | ||
{ | ||
"name": "Quantity", | ||
"type": "number" | ||
}, | ||
{ | ||
"name": "Entity name", | ||
"type": "string" | ||
} | ||
] | ||
} |
Oops, something went wrong.