Wiki
Clone wikiFrankenstein / JSON format description
Parts library file
Parts library contain following list of properties:
name | type | description |
partFiles | String[] | List of paths of json files containing individual parts descriptions |
bloodImages | String[] | List of paths to images containing drops of blood. These are used when creating a 'dead' monster sprite |
shadowImages | String[] | Paths to images containing shadows |
defaultColors | Map<Integer, String> | List of base colors used in images in this library. Contains map from color id to color string representation. TBD. If you later need to recolor a monster, you can provide a color mapping to monster generator, and it will replace colors, specified here, with new ones from user-provided mapping with same ids |
Example
{
"partFiles" : [
"resources/test_set/bodies.json"
, "resources/test_set/limbs.json"
, "resources/test_set/eyes.json"
, "resources/test_set/mouths.json"
],
"bloodImages" : [
"resources/test_set/blood.png"
, "resources/test_set/blood2.png"
],
"shadowImages" : [
"resources/test_set/shadow.png"
]
}
Parts descriptions
Each monster part file is a JSON array of objects of class ru.game.frankenstein.MonsterPart These objects have following properties:
name | type | description |
type | Enum {MONSTER_BODY, MONSTER_LIMB, MONSTER_DECORATION} | Type of this monster part |
attachmentPoints | AttachmentPoint[] | List of points for attaching new parts to this one. See below description of AttachmentPoint class |
imageId | String | Id or path of an image for this part. This id will be passed to method load(String) of current implementation of ImageFactory class |
tags | String[] | List of optional tags. If tags are passed for monster generation, only parts that have at least one of those tags will be used for generation |
textDescriptions | String[] | List of optional text descriptions for this part. Some of them will be combined with descriptions from other parts to create monster text description, if it is requested by user |
Important concept in frankenstein is an Attacment Point. These are points where parts of monsters are connected together. AttachmentPoint object specifies, what limbs can be used together, and how they should be drawn relatively to each other.
name | type | description |
x | int | x-coordinate of attachment point |
y | int | y-coordinate of attachment point |
angle | int | Angle in degrees. Monster limb attached to this point will be rotated this number of degrees around its own point |
availableTypes | MonsterPartType[] | Types of monster parts that can be attached to this points. E.g. only eyes. Or legs. |
groupId | String | Optional id of a group this point belongs to. Same monster part is attached to all points that share same group id |
flipHorizontal | boolean | If true, monster part image will be flipped horizontally before applying rotation and translation. This can be used to create symmetrical monsters |
flipVertical | boolean | Same, but for vertical flip |
Example of a monster part file with a single monster part:
[
{
"type":"MONSTER_DECORATION",
"attachmentPoints" : [
{
"x": 13,
"y" : 6,
"availableTypes" : [
"MONSTER_BODY"
]
}
],
"imageId" : "test_set/dec1.png"
}
]
Updated