Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
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 1069 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.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
   // 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 Member





« 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (12 views)
2014-10-02 14:36:20

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (48 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!