-
Notifications
You must be signed in to change notification settings - Fork 2
Interior
Interiors are expressed in their own JSON files in the room sub-directories of "maps". Adding more JSON files using the custom format below will add more interiors (for that room type) to the sample size used by the random generation algorithm, which will enhance the feeling of randomness.
The purpose of this class is to separate the design of the room from its logic. This is needed because a Room
's type, location and size are known at deserialization but its interior design is not.
Since this class is designed to house no complex logic, the variables are injected directly into the Room
instance for convenience. This is better than injecting the whole Interior
instance because of OOP obfuscation.
The Interior
class implements the Json.Serializable
interface to allow for de/serialization of Interior
instances.
This is an ObjectMap
of Character
s to GridObject
s. Objects in this map define the textures used for the tiles belonging to the room.
This is an ObjectMap
of Character
s to GridObject
s. Objects in this map define the entities that will be spawned into the world for the owning room.
This is a Character
grid representation of all tiles defined at the Interior
level. All Character
s specified in the tile map are placed in this grid. If a character not belonging to any key in the tile map is used, then the tile is assumed to be the Floor
's defaultInteriorTile at runtime.
This is a Character
grid representation of all entities defined at the Interior
level. All Character
's specified in the entity map are placed in this grid. If a character not belonging to any key in the entity map is used, then no entity is assumed to be there and nothing will be spawned. This grid can change at runtime if a Floor
overrides an element on top of this grid in its floor grid.
{
tileMap: {
?: {
// Custom GridObject serialization
}
...
}
entityMap: {
?: {
// Custom GridObject serialization
}
...
}
tileGrid: [
// Default JSON Character grid serialization
]
entityGrid: [
// Default JSON Character grid serialization
]
}
This object is typically instantiated in the random generation algorithm of the Room
class. When instantiated, its values extracted from deserialization are injected into the Room
instance. The room then drops the reference to this Interior
so it is subsequently cleaned up by the Java garbage collector.
Entities and Components
Interaction System
Unit Testing
Input Handling
UI
Game Screens and Areas
Map Generation
Basic Interactable Objects Design