Prison Architect

Prison Architect

Not enough ratings
Materials.txt – Materials – Prison Architect
By leftbehind
This guide shows how to define materials (ground textures, walls, etc) in materials.txt...
   
Award
Favorite
Favorited
Unfavorite
Introduction
Materials are things like ground textures (grass, tiles, wooden floors) and walls (fences, brick wall, perimiter wall).

Note: This is an add-on to the main Materials.txt – Overview guide – if you are new to modding PA, it's recommended that you read that guide first to get a basic understanding of how materials.txt works.
Example Material
To give a quick overview, here's an example material definition that comes with the game:

BEGIN Material Name FancyTiles ConstructionTime 1.00000 SoftEdged -1 IndoorOutdoor 2 ObjectRequired Concrete SpriteType AlignedArea NumSprites 2 BEGIN Sprite0 x 20 y 8 END BEGIN Sprite1 x 2 y 2 END END

There are a few other properties that we'll cover later, but the example above covers the basics.
Physical Attributes
BlockMovement

Does this material block movement?
  • Optional: Defaults to false
  • Value type: Boolean (true or false)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example:

Properties BlockMovement

See also: Properties – BlockMovement in Materials.txt – Objects and Utilities.

BlockVisibility

Does this ,aterial block vision (clearing fog of war) of Entity objects?
  • Optional: Defaults to false
  • Value type: Boolean (true or false)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example:

BlockVisibility true

See also: ViewRange property in Materials.txt – Entities.

MoveCost

How does this material affect movement speed?
  • Optional: Defaults to 1.0 (Normal speed)
  • Value type: Number (<1 = Slow, 1 = Normal, >1 = Fast)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example (Slow - half speed):

MoveCost 0.5

See also: MoveSpeedFactor property in Materials.txt – Entities and Materials.txt – Objects and Utilities.
Delivery Attributes
Object Required

What type of object (having Properties – Material) is required before this material can be placed?
  • Optional: Defaults to not requiring any resources
  • Value type: Object name
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example:

ObjectRequired GrassTurf

In this example a stack of grass turf (a consumable, see Materials.txt – Consumables for details) will be delivered and moved to the location where the material is being placed.

Price

How much does the material cost to place/build?
  • Optional: Defaults to 0 (free)
  • Value type: Negative integer (eg. -100 means it costs $100)
  • Singleton: Can be used only once per definition
  • Lua scripts: Not accessible
Example:

Price -50
Placement Attributes
ConstructionTime

How long does it take (in game seconds) to construct the material?
  • Optional: Defaults to 0.0
  • Value type: Number >= -1.0
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example (most terrain textures are 1.0, walls are 5.0, fences and road are 10.0):

ConstructionTime 1.00000

A time of 0.0 or -1 will prevent the material from showing up on the Materials menu. The materials defined by the game tend to use -1 to clearly indicate that they shouldn't appear on the menu.

IndoorOutdoor

Where can this material be placed?
  • Optional: Defaults to 0
  • Value type: Enum (0 = Both?, 1 = Outdoor only, 2 = Indoor only)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example:

IndoorOutdoor 1

In the example above the material can only be constructed outdoors.
Sprites
will clean up this section at a later date

If you haven't already done so, read the guide on Sprites to learn the basics of working with sprite files. (not written yet)

Materials have some unique properties relating to sprites, primarily because materials will cover an area and the sprites often have to align with adjacent map tiles.

SoftEdged

Should the edges of the material be transparency blurred, giving a soft blend with adjacent materials?
  • Optional: Defaults to 0
  • Value type: Enum (-1 = sharp edged, 0 = normal, 1 = soft edged)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Examples:

SoftEdged -1
<pic>

SoftEdged 0
<pic>

SoftEdged 1
<pic>

SpriteType

What type of sprite drawing should be used?
  • Optional: Defaults to SingleSprite
  • Value type: Enum (SingleSprite, RandomList, RandomArea, AlignedArea, Linked, Connected)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Details of the types are as follows:
  • SingleSprite – A single sprite is defined (NumSprites 1) and used for every map tile that the material is applied to.
  • RandomList – Two or more sprites are defined and the game engine will choose a random sprite from the list for every map tile. (Similar to SpriteVariants for Entities.)
  • RandomArea – A sprite will be chosen at random for each map tile from an area in the tileset. The area is defined via two sprites (NumSprites 2). The first sprite defines the top-left corner, the second sprite defines the width and height of the area.
  • AlignedArea – A repeating seamless texture that's more than 1x1 tiles in size. The area is defined in same way as RandomArea. Sprite is then chosen based on map co-ordinates. For example, if the area has width of 4 and you start drawing from map x position 0 to 8, the tiles drawn will be 1, 2, 3, 4, 1, 2, 3, 4. The same applies to the height and y-axis.
  • Linked – Used for walls, etc. Seems to work the same way as Connected (below), but instead of being area based you have to define all 18 tiles individually (and I assume the sequence matters).
  • Connected – Used for walls, fences, etc. The top-left corner of a 7x4 area containing all possible scenarios is defined by the first sprite (NumSprites 1). When rendering sprites the game engine choses the relevant sprite from the area based on the adjacent tiles. If adjacent tiles change at any time the game will update based on the new layout.
Example:

SpriteType RandomArea


SpriteOverlayScale

Not srue what this does, defaults to 0.

NumSprites

How many sprite properties are defined for this material?
  • Optional: Defaults to 1
  • Value type: Integer >= 1 (the number generally depends on the SpriteType being used)
  • Singleton: Can be used only once per definition
  • Lua script: Not accessible
Example:

NumSprites 2

The example shown above is used for SpriteType's of RandomArea and AlignedArea.
3 Comments
Zangish 4 Jan, 2020 @ 5:56pm 
hello, I have been wondering where I could find a guide to making sprites.
leftbehind  [author] 14 Nov, 2015 @ 4:45pm 
@toy maker I've been working on an updated guide if it's any use: https://github.com/aubergine10/Prison-Architect-API/wiki/Materials
Peace_Maybe 14 Nov, 2015 @ 4:39pm 
not good:steamsad: