data module¶
Data package.
It holds data-related modules needed to determine how the game will behaved and what it should do when it does.
data.data_translate¶
Module name: data_translate
This module manages the translation of all data constants (states, properties, etc.)
data.items¶
Items package.
data.items.item¶
Module name: item
This module defines the item object and its properties.
- class game.data.items.item.Item(x: int = 0, y: int = 0, tooltip_name: str = '')¶
Bases:
objectClass for creating a usable item.
- DEFAULT_ATLAS: str = '/home/docs/checkouts/readthedocs.org/user_builds/tile-game/checkouts/latest/game/assets/items.png'¶
data.items.item_types¶
Module name: item_types
This module defines the item types. Need I say more?
data.items.items¶
Module name: items
This module defines the different game items.
data.keys¶
Module name: keys
This module defines all the hotkeys, linked to specific in-game actions.
data.properties¶
Properties package.
Properties are just constants that define most of the game’s behaviour.
data.properties.camera_properties¶
Module name: camera_properties
This module defines the camera properties.
data.properties.game_properties¶
Module name: game_properties
This module defines the main game properties.
data.properties.gui_properties¶
Module name: gui_properties
This module defines the GUI properties.
data.properties.item_properties¶
Module name: item_properties
This module defines the item properties.
data.properties.player_properties¶
Module name: player_properties
This module defines the player entity properties.
- class game.data.properties.player_properties.PlayerProperties¶
Bases:
objectClass for player properties.
- MAX_PLAYER_NAME_SIZE = 16¶
- SPEED = 350¶
- SPEED_IN_LAVA = 116¶
- SPEED_IN_WATER = 175¶
data.properties.screen_properties¶
Module name: screen_properties
This module defines the screen properties.
data.properties.server_properties¶
Module name: server_properties
This module defines the server properties.
data.properties.tile_properties¶
Module name: tile_properties
This module defines the tile properties.
data.properties.world_properties¶
Module name: world_properties
This module defines the world properties.
- class game.data.properties.world_properties.WorldProperties¶
Bases:
objectClass for world properties.
- MAP_LARGE = 'Large'¶
- MAP_MEDIUM = 'Medium'¶
- MAP_SMALL = 'Small'¶
- MAX_MAP_HEIGHT = 192¶
- MAX_MAP_WIDTH = 192¶
- MIN_MAP_HEIGHT = 64¶
- MIN_MAP_WIDTH = 64¶
- SKY_COLOUR = (140, 150, 235)¶
- static translate()¶
Translate the world properties.
data.states¶
States package.
States are values that describe the condition that something is in. A server can be starting, a player can be moving left, a connection can time out. Those are all states. They don’t define behaviour but report behaviour.
data.states.connection_states¶
Module name: connection_states
This module defines the different states of a connection.
data.states.map_states¶
Module name: map_states
This module defines the different states of the map.
data.states.mouse_states¶
Module name: mouse_states
This module defines the different states of the mouse.
data.states.player_states¶
Module name: player_states
This module defines the different states of the player.
data.states.server_states¶
Module name: server_states
This module defines the different states of the server.
data.structures¶
Structures package.
Structures are classes containing constants of size, position and other properties of different attributes of an object. They are used to build compressed packets that aim to be sent to and from the server.
TYPES OF SIZE CONSTANTS:
- BIT_SIZE
The bit size constant represents the size of a specific object attribute in bits. This means dividing the value by 8 is necessary to obtain a size in bytes.
- BYTE_SIZE
The byte size constant represents, as its name suggests, the size of a specific attribute in bytes.
The reason to having different types of sizes is based on how the “compact packets” are created. If they are created specifically utilising bit manipulation operators (<<, >>, &, |, ~, etc.), then bit size constants are required, as they are very precise. If they are created from direct int to byte conversion (using int.to_bytes() and int.from_bytes()), then the precision of the sizes become less important. Direct int - byte conversions are usually done on attributes that require more allocated memory and where precision becomes too tedious.
POSITION CONSTANTS:
The position constants are used to determine where the attributes will be located at in the “compact packet”. This is only used for packets that require precise bit manipulation in order to build.
STRUCTURES:
- PLAYER STRUCTURE
This contains all constants for player-related packets.
- MAP STRUCTURE
This contains all constants for map-related packets.
- TILE STRUCTURE
This contains all constants for tile-related packets.
data.structures.map_structure¶
Module name: map_structure
This module defines the byte (or data packet) structure for the world map.
data.structures.player_structure¶
Module name: player_structure
This module defines the byte (or data packet) structure for the player entity.
data.structures.tile_structure¶
Module name: tile_structure
This module defines the byte (or data packet) structure for the map tile.
- class game.data.structures.tile_structure.DynatileStructure¶
Bases:
objectByte structure for the dynamic tile. No pre-defined dynatile bit size as it can vary.
- DYNATILE_ADJACENT_DUPLICATES_BYTE_SIZE = 2¶
- DYNATILE_STATE_BYTE_SIZE = 1¶
- class game.data.structures.tile_structure.TileStructure¶
Bases:
objectByte structure for the tile.
- TILE_ADJACENT_DUPLICATES_BYTE_SIZE = 2¶
- TILE_BYTE_SIZE = 3¶
- TILE_DAMAGE_BIT_SIZE = 7¶
- TILE_DAMAGE_BYTE_POS = 5¶
- TILE_DAMAGE_DELAY_BIT_SIZE = 3¶
- TILE_DAMAGE_DELAY_BYTE_POS = 2¶
- TILE_RESISTANCE_BIT_SIZE = 6¶
- TILE_RESISTANCE_BYTE_POS = 12¶
- TILE_X_BIT_SIZE = 3¶
- TILE_X_BYTE_POS = 21¶
- TILE_Y_BIT_SIZE = 3¶
- TILE_Y_BYTE_POS = 18¶
data.themes¶
Themes packages.
data.themes.theme¶
Module name: theme
This module allows for creating world themes.
- class game.data.themes.theme.Theme(_id: int)¶
Bases:
objectClass for creating a world theme object.
- add_layer(layer_type: str, min_height: int, max_height: int, tile: Tile) Self¶
Add a theme layer, then return the theme itself.
data.themes.theme_layers¶
Module name: theme_layers
This module defines all the different theme layers
data.themes.themes¶
Module name: themes
This module defines the different world themes.
data.tiles¶
Tiles package.
data.tiles.tile¶
Module name: tile
This module defines the map tile object and its properties.
- class game.data.tiles.tile.Tile(_id: str = '', x: int = 0, y: int = 0)¶
Bases:
objectClass for creating a map tile.
- DEFAULT_ATLAS: str = '/home/docs/checkouts/readthedocs.org/user_builds/tile-game/checkouts/latest/game/assets/atlas.png'¶
- decompress(compressed_tile: int) Self¶
Extract the tile attributes from the compressed tile and set them accordingly.
data.tiles.tile_types¶
Module name: tile_types
This module defines the different types of map tiles.
data.tiles.tiles¶
Module name: tiles
This module defines the different map tiles.
- class game.data.tiles.tiles.Tiles¶
Bases:
objectClass for creating a collection of tiles.