Skip to content

WaveFactory

samsully edited this page Oct 17, 2023 · 4 revisions

Introduction

The purpose of the WaveFactory is to store the different configurations of mobs/waves that will occur during gameplay. Based on the selected level, by the user when they pick a planet, a series of waves will be created and passed to the WaveClass. These will then run, as described below.

Usage

To create a new instance of waves in the game, the following code should be run in ForestGameArea. This creates new instances of the waves depending on the chosen level.

waves = WaveFactory.createWaves();
spawnEntity(waves);
waves.getEvents().addListener("spawnWave", this::spawnMob);

createWaves()

This method is responsible for defining the appropriate inputs to create the waves for a level. When the level begins, it will detect the planet selected and will generate the appropriate waves for the planet.

createLevel()

The purpose of this function is to construct the level, based on the planet the user selects. To ensure that the waves increase in difficulty in as many ways as possible, the waves for the levels are constructed to distribute the abilities. The first wave of each planet is a melee, which will bring in different melee attacks over time, and later on phase in other abilities. The last wave of every planet is a boss with no minor mobs.

  • 1 -> easy, water planet, 5 waves, start wave of 5
  • 2 -> medium, magic planet, 10 waves, start wave of 6
  • 3 -> hard, fire planet, 15 waves, start wave of 8 mobs

The types of mobs are predefined for each wave, however the number of each is randomised to provide some uniqueness to each instance.

As the difficulty increases the following occurs:

  • The health increment increases
  • The number of mobs increases
  • The number of waves increases

Note that the health of melee mobs are greater than ranged mobs since ranged causes more damage which melee have to reach their target before attacking.

Wave Structure

The table shows the structure of the mobs for each wave in each planet. The only variation that will occur is the proportions of each mob in the waves. There is a minimum of 2 entities for each type of mob per wave.

image

Planet Mobs

The following table depicts all mobs that are included in the waves (excluding bosses), which planet they are assigned to, their type of combat and any special abilities if they have them. Top to bottom also indicates the order in which they are intended to be introduced based on their ability difficulty.

image

Clone this wiki locally