Skip to content
kaitlyn-lake edited this page Sep 12, 2022 · 8 revisions

MapService

Overview

Accessible through ServiceLocator. For an entity to be registered with MapService it must add a MapComponent. Entities registered with MapService are displayable on the minimap, are treated as obstacles to avoid during path finding and have their positions tracked in the game throughout their entire lifecycle. Available map tiles and MapComponent positions are accessible through MapService methods, which is helpful for movement functionality and interactions of game units.

Notable methods

List getPath(GridPoint2, GridPoint2) -> returns the shortest path from a start tile position to end tile position in a sequential list of tile positions using BFS (see MapSerice Path finding)

boolean isOccupied(GridPoint2) -> returns true if tile is occupied, else false

Entity getEntityAt(GridPoint2) throws NoEntityException -> returns the entity occupying the tile, else throws an exception

Path finding

MapService implements a Breadth First Search (BFS) algorithm for path finding to be later implemented in other features.

Testing

Visual and game play tests:

  • Registering functionality: Entities registered with MapService and with a MapComponent set to display will be displayed on the mini map. When all entities set to display, the number of icons on the mini map equals the number of game play entities.
  • Disposal functionality: When entities are removed from the map (e.g. through resource collection) their icon disappears from the mini map and the game runs without exception.
  • Tracking functionality: Entities with a MapComponent and that are set to display show up on the mini map in a position relative to where they are on the game. As they move, their mini map icon moves relatively.

MapComponent

Overview

Added to an entity to an entity to register it with the MapService, and to be rendered to the mini map. By default it does not display on the mini map.

Notable methods

void display() -> sets the entity to be displayed on the mini map.

void setDisplayColour(Color) -> sets the colour the entity appears as on the mini map.

Testing

Visual and game play tests:

  • Display functionality: Entities with a MapComponent set to display will be rendered to the mini map.
  • Icon colouring functionality: Entities with a MapComponent set to display will be rendered to the mini map to the colour that has been manually set for them, else they will render with the default colour red.
  • Registering functionality: Entities registered with MapService and with a MapComponent set to display will be displayed on the mini map. When all entities set to display, the number of icons on the mini map equals the number of game play entities. (See MapService Testing)
  • Disposal functionality: When entities are removed from the map (e.g. through resource collection) their icon disappears from the mini map and the game runs without exception. (See MapService Testing)
  • Update functionality: Entities with a MapComponent and that are set to display show up on the mini map in a position relative to where they are on the game. As they move, their mini map icon moves relatively. (See MapService Testing)

Code design

Sequence diagram as it interfaces with the Entity and MinimapComponent classes

image

Table of Contents

Home

Game

Game Home

Design Influences

Gameplay Features

Style

Story

Friendly Units
Map
City
Buildings
Unit Selections

Spell

Game User Testing: Theme of Unit Selection & Spell System

UI User Testing

Tutorial

Resource Stats Display

Loading Screen Bar

Health Bars
In Game menu
  • Feature
  • User Testing:In Game Menu

Landscape Tile Design

Landscape Tile Design Feedback

Weather Design

Weather Design Feedback

Camera Movement

Enemy design

Enemy Units

Enemy AI

How Animation Works

Map Flooding

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally