Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (790)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Wave Generation  (Read 2883 times)
0 Members and 1 Guest are viewing this topic.
Offline Agro
« Posted 2012-12-03 03:19:48 »

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?

Offline Vladiedoo
« Reply #1 - Posted 2012-12-03 03:40:16 »

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);
Offline Agro
« Reply #2 - Posted 2012-12-03 05:18:02 »

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Phased
« Reply #3 - Posted 2012-12-03 05:22:19 »

Maybe some more detail in "how they spawn"

Do you mean their position?
The amount that spawn?
The chance of a certain mob?
Offline Vladiedoo
« Reply #4 - Posted 2012-12-03 05:29:20 »

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.
Offline Agro
« Reply #5 - Posted 2012-12-03 22:27:21 »

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.

Offline Best Username Ever

Junior Devvie

« Reply #6 - Posted 2012-12-04 03:39:06 »

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.
Pages: [1]
  ignore  |  Print  

hadezbladez (2842 views)
2018-11-16 13:46:03

hadezbladez (1024 views)
2018-11-16 13:41:33

hadezbladez (2809 views)
2018-11-16 13:35:35

hadezbladez (549 views)
2018-11-16 13:32:03

EgonOlsen (3821 views)
2018-06-10 19:43:48

EgonOlsen (4232 views)
2018-06-10 19:43:44

EgonOlsen (2542 views)
2018-06-10 19:43:20

DesertCoockie (3353 views)
2018-05-13 18:23:11

nelsongames (3468 views)
2018-04-24 18:15:36

nelsongames (4466 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!