-
Notifications
You must be signed in to change notification settings - Fork 1
Map
The terrain in the provided example game uses tiles, placed orthogonally. The game includes functionality for creating terrains in different orientations, and converting from tile positions to world-space positions.
-
TerrainComponent
: This component, when attached to an entity, can be used to create and render a terrain. This is generally done through theTerrainFactory
rather than directly instantiating it. -
TerrainFactory
: Where terrains get created, by choosing the orientation and filling in the tiles. When creating the factory, the desired tile orientation can be chosen. TheTerrainFactory
can then be used to create all the terrains in your game. -
TerrainLoaderComponent
: This component is responsible for dynamically loading and unloading terrain chunks based on the player's position, ensuring that only the relevant sections of the terrain are rendered as the player moves through the game world. -
TerrainTile
: Represents a single tile in the terrain. This can be modified to add features like walking speed, particle effects, and sound effects. -
GameAreaDisplay
: Represents the UI ascpect of map generation. This class sets up a Minimap frame in the top-right corner of the screen which will eventually house the minimap in later iterations of the game (a task reserved for future sprints). The minimap frame will change aesthetically based on what kingdome the player is in.
This UML class diagram presents four main classes along with their attributes, methods, and relationships: ForestGameArea
, GameArea
, TerrainLoaderComponent
, Component
, and TerrainFactory
. The UML class diagram provides a detailed description of the collaboration between ForestGameArea
and TerrainFactory
, showcasing how TerrainLoaderComponent
is used to load terrain chunks, thereby illustrating a hierarchical system for creating and managing game areas.
This UML diagram shows the relationship between the GameAreaDisplay and UIComponent classes. GameAreaDisplay is a concrete class responsible for displaying game area information, such as the title, player icon, and minimap frame. It has attributes like gameAreaName, title, playerIconTexture, and minimapFrameTexture, and methods for creating the display, drawing it, and disposing of resources.
TerrainComponent class manages the game's tiled map, rendering it with a camera and loading or unloading terrain chunks as needed. It uses the TerrainResource class to handle the game's tiles. TerrainResource stores a collection of Tile objects, which represent individual terrain units. Each Tile has a texture and directional connections defined by BitSet attributes (up, right, down, left), which manage how tiles connect to each other. The orientation of each tile is determined by the TerrainOrientation enum, which specifies four possible directions: UP, RIGHT, DOWN, and LEFT.
- ForestGameArea: Manages the game environment, entities, and music.
- TerrainLoaderComponent: Handles terrain loading and updates.
- TerrainFactory: Creates terrain and renderer.
- TerrainChunk: Represents terrain chunks, managing tiles and grids.
##Minimap
- Note: The appearence and positioning of the minimap frame assets are subject to change.
The minimap will be housed in a different frame depending on the player's location on the map (kingdoms).
- Since there isn't a seamless way to switch maps implemented as of sprint-2, the minimap frame changes with the animal the player chose for now.
- This can easily be changed whenever proper progression mechanics to change kingdoms will be implemented given how
GameAreaDisplay
is set up. - The same applies to UI component positioning on the HUD.
To change the orientation, you need to:
- Change the
TerrainOrientation
in the constructor ofTerrainFactory
. This will likely be somewhere in theGameArea
. - Update
TerrainFactory.createTerrain()
to use the tile textures you've created for your orientation. In the example game, one terrain of each type is given. Orthogonal tile textures should be square, isometric tile textures should be a 'diamond' shape, and hexagonal tiles should be... hexagonal.
The test plan for map is detailed in Map Testing