Wave Generation

Currently, I’m working on a tower defense styled game, and I wanted to know if there was some way to create a randomized wave. Like for example, if I give it a difficulty of “8” and I define different sets of difficulties, it would proportionally generate all these waves of monsters. Any ideas?

What do you mean when you say difficulty? How many of the following are you looking to define?

  • HP of creeps
  • Armour/Resistances of creeps
  • Speed of creeps
  • Abilities of creeps
  • Size (if this is a factor) of creeps
  • Number of creeps (the more there are the less hp they have but also the less effective single target towers are and vise versa)
  • Time before the next wave starts

Keep in mind difficulty can be controlled by limiting the player’s resources when building towers, reducing the sell value of towers, restricting tower placement, hiding information from the player, adding game play elements such as towers being damaged, etc.

A more refined question: Are you looking to randomize the “strength” of creeps and have each wave be the same creep x50 or have randomized “strengths” and randomized creeps (thus waves can consist of different types of creeps with different attributes)?

EDIT: Without the following information hopefully I can guide you in the right direction with this.

	// Just a vague example.
	private Random dice = new Random();
	private int difficulty = 8;

	public int getRandomNumberFrom_To_(int min, int max) {
		return dice.nextInt((max - min + 1)) + min;
	}

	public void setCreepHP() {
		// This system would set the creep HP to a random number from 1 + half the difficulty level through the difficulty level then
		// multiply it by 10. So as the difficulty level goes up, so does the average HP level.
      // NOTE: This system will not have an increase in difficulty going from an even number to an odd number because of rounding.
		creepObject.setHP(getRandomNumberFrom_To_(1 + (difficulty / 2), difficulty) * 10);
	}

Well, I was looking for more of it related to how they are spawned in relation to their health and speed.

Maybe some more detail in “how they spawn”

Do you mean their position?
The amount that spawn?
The chance of a certain mob?

Do you want every mob/creep spawned that wave to have the same randomly generated speed and health or do you want every mob/creep spawned that wave to have their own randomly generated speed and health? (Speed and health will depend on difficulty level)

EDIT: The reason we are asking these question is because your original post is a bit vague and there are many solutions.

Yeah, game dev has too many variables. So what I’m asking for is this:

  • Amount of monsters to be spawned
  • What monsters to be spawned
  • When the monsters should be spawned

In one map, I have six spawn points.

It’s definitely game specific, so as the developer you might want to go through trial and error testing to see what accounts for a certain level of difficulty.

Here are some general rules:

  1. The number of monsters should increase
  2. Their HP should increase between levels
  3. Waves should be varied to keep the player’s attention
  4. There should always be a pause between waves unless the player can only manage to slow down monsters but not defeat them
  5. Pauses between waves should stay relatively constant
  6. Pauses between groups in the same rule should follow 4
  7. More specialized monsters should not be spawned in early waves.
  8. Stronger monsters should not be spawned as early as specialized ones

Because there are so many variables, it’s unpredictable what makes a difficult wave, and it requires trial and error, this might be a good case for a genetic algorithm. Create several tower layouts (by hand with infinite money), and keep sending (simulating) waves of vanilla monsters with the different tower layouts, increasing their HP each wave. Rank the layouts by their success on vanilla waves, so that the worst layouts are associated with level one difficulty and the best with level 10. Make some tweaks to the tower layouts for specialized guys if necessary and repeat with non-vanilla monster waves. Use mutations like the number of monsters, the spacing between monsters, the mix of types of monsters, and other factors. Classify the strength of a wave according to the minimum tower layout difficulty level that managed to defeat it. Then by the time you’re done you will have a bunch parameters you can feed to random wave generators and a typical difficulty level associated with those parameter sets.

Of course, I think most tower defense developers just use simple pre-programmed sets of monsters and increase their HP according to some increasing function of the wave number. You’re way too vague, so I don’t know what features you want or if you want a complicated or simple solution.