Skip to content

ResourceSpecification

rjg1 edited this page Sep 12, 2022 · 9 revisions

Introduction

As resources in the game are procedurally generated, it was important to provide a prospective developer with tools to both add resources or modify the qualities of them. ResourceSpecification is a medium to do so, as it contains all the information required to procedurally generate a resource on the island, as well as all of a Resource's placements (allocated by Resource Generator).

The variables a developer may control when adding or modifying resources in the game are outlined in Adding Resources to the game and coincide with the fields necessary to initialise a ResourceSpecification.

Function

When created, provide a ResourceSpecification with variables : Resource width, resource height, preferred distance from city, name, max amount, min amount. This will create a new ResourceSpecification, holding this data, alongside an integer amount, which is the amount to add to the game - randomly chosen between the ranges min and max amount. ResourceGenerator automatically fills the placement list of each ResourceSpecification, so only this function is necessary to understand when adding resources to the game, as it will provide the tile location to spawn an entity at using a Resource Factory

A ResourceSpecification's getPlacements() function will return a list of Coordinate, corresponding to tiles on the map where this resource is to be placed.

Test Plan

Given the concise nature of the class, it was deemed sufficient to only run unit tests on it, to verify its limited functionality was correct.

The unit tests verify the following:

  1. A ResourceSpecification will throw an exception if initialised with bad data (i.e. the size of a resource is provided as negative, or the minAmount to generate is greater than the maxAmount, etc...)
  2. A ResourceSpecification correctly chooses an amount to place between maxAmount and minAmount
  3. A ResourceSpecification correctly returns all associated variables using getter methods
  4. A ResourceSpecification's placement data can be set and cleared using the associated functions

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