• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
triggdev

Endless enemy wave generation

8 posts in this topic

I'm trying to figure out a way to generate endless waves of enemies in a space shooter. The waves will progress after you kill each enemy in the current wave. I want a way to generate different types of enemies with different strengths. I've already set up all of these enemies, I just need numbers now.

 

I've been thinking you could use prime numbers and the distance between each prime number would be the number of enemies. The problem with this is that you wouldn't really have much of a difference in waves. 

 

My next thought was to use the fibonacci sequence, but I'm still stuck.

 

Does anyone have any ideas on how accomplishing this?

 

I want waves to be something like this - 

 

Wave 1

Tier1: 4

Tier2: 2

Tier3: 0

Tier4: 0

Tier5: 0

 

each tier is a type of enemy varying in health, speed and strength. So wave 1 would have a total of 6 enemies.

0

Share this post


Link to post
Share on other sites

 I am sorry, but your question is a bit vague, and very general in nature .

 

Pass in the "wave number" variable when the enemy object is created, and use that to determine the internal states of speed, health, e.t.c.

 

 Enemies per "stage" can be easily determined by a incremental math.

If you want 8% more enemies per wave ?

" enemy_number *= 1.08 "

 

 I hope I interpreted your question correctly.

0

Share this post


Link to post
Share on other sites

I'm making a space shooter too. I'm not making enemy waves yet, but I'm thinking of this:

 

- a list of tiers has all possible tiers sorted in ascending order

- each wave is a tier window that includes enemies from a low tier to a high tier (for example, a window that starts at 2 and has a size of 3 will include tiers 2, 3 and 4)

- the tier window moves to higher tiers as you defeat more enemies or as you move forward

- the window size may grow or shrink, so that some waves have more different tiers than other waves

0

Share this post


Link to post
Share on other sites

 I am sorry, but your question is a bit vague, and very general in nature .

 

Pass in the "wave number" variable when the enemy object is created, and use that to determine the internal states of speed, health, e.t.c.

 

 Enemies per "stage" can be easily determined by a incremental math.

If you want 8% more enemies per wave ?

" enemy_number *= 1.08 "

 

 I hope I interpreted your question correctly.

Oh sorry, I didn't mean to be vague. 

 

All of the enemies have a predetermined health, speed and power attribute.

 

I have 5 tiers and 4 colors in each tier. 

   blue  green  orange  black

1     

2        

3           

4              

5

 

i want to slowly increase form blue-1 to black-5, hitting all tier/type combinations.

Edited by triggdev
0

Share this post


Link to post
Share on other sites

I think this is more in the range of a algorithm design question I think, If I understand you correctly, you are trying to figure out how to go from wave to wave and with each wave, increase tiers/attributes.

 

I don't think you're having trouble implementing the code, but more on how you want to make it happen. Right?

 

The easiest way is to probably simply keep track of the waves, every X waves you increase a tier and/or attributes. How you increase the X is entirely up to you, there are countless of possibilities for that. The same can be done for your tiers. If you up a wave, perhaps shift the numbers in your tiers down (so it becomes, 6, 4, 2, 0, 0).

 

Attribute increments can be done as shippou suggests, but it's all up to you on how you want to do it though.

0

Share this post


Link to post
Share on other sites

Question:  Do you want any variability in the waves of enemies being generated, or do you want the waves to be completely predictable, so that players know what to expect from each wave of enemies?

 

I would probably try some type of point system.  Each enemy is worth a set number of points.  The more power the enemy, the more points they are worth.  Each wave gets something like (wave number) * 10 points worth of enemies.

 

If you want some variability, you randomly select enemies within a certain point range until you've used up all your points.  To avoid having only 1 or 2 enemies in a wave, the total point allocation should have to be some multiple of the enemy point value for it to have a chance of being generated, say 5x.  So for wave 1, you have a total of 10 points, but you will only randomly selecting enemies that are worth 1 or 2 points.  At wave 2, you have 20 points, so you can randomly select enemies that are worth from 1 to 4 points, etc.  You may want a lower cap as well, so at wave ten with 100 points, you are no longer potentially generating lvl 1 enemies.

 

If you want it completely deterministic, then you just need to replace the random selection with a deterministic selection.  A simple solution would be to add (point total / 4) point enemy to the wave, until your point total is 0.

So for wave 1:

10 / 4 = 2 point enemy;

8 / 4 = 2 point enemy;

6 / 4 = 1 point enemy;

5 / 4 = 1 point enemy;

4 / 4 = 1 point enemy;

3 / 4 = 0 point enemy (automatically elevated to minimum 1 point enemy)

 

In both scenarios you can tweak point totals/values, multipliers, divisors to adjust wave generation and scaling.

1

Share this post


Link to post
Share on other sites
If you want pseudo-random or random content you can use a sequence for the creation.
You can use creators as a framework that offers great prototyping flexibility.
 
You can define a source interface for values that you use for decisions:
public interface StreamSource {
int consumeInt();
long consumeLong();
char consumeChar();
byte consumeByte();
float consumeFloat();
double consumeDouble();
}
Then use another interface that creates objects using the value source:
public interface ObjectCreator<OBJ> {

OBJ create(StreamSource streamSource);
}
Now you can write data containers (e.g. the classes Wave and Enemy) and creator implementations that create actual content.
There are dependencies between Waves and Enemies ... a Wave creator will use an Enemy creator to create enemies that are right for the level of the wave instance, for example.
 
The way I accomplish that is with Context interfaces (obviously this is just to show the basic idea ... no null checks, do default behaviour etc.):
public interface EnemyContext {

int getMinStrength();
int getMaxStrength();
}

public class WaveCreator implements ObjectCreator<Wave>, EnemyContext {

private final EnemyCreator enemyCreator = new EnemyCreator();

private WaveContext context = null;

public WaveCreator() {
enemyCreator.setContext(this);
}

public void setContext(WaveContext context) {
this.context = context;
}

public int getMinStrength() {
return getMinStrengthByWaveLevel(context.getWaveLevel());
}
public int getMaxStrength() {
return getMaxStrengthByWaveLevel(context.getWaveLevel());
}

public int getMinStrengthByWaveLevel(int waveLevel) {.
...
}
...

public Wave create(StreamSource streamSource) {

Wave wave = new Wave();

int numberOfEnemies = 10;
numberOfEnemies += streamSource.consumeChar() % 10;

for (int i=0; i<numberOfEnemies; i++) {
wave.registerEnemy(enemyCreator.create(streamSource));
}

return wave;
}
}
The game itself or a module would register itself as the wave context and increment the level. That change would create different waves.
Notice how the context influences the object creation in a controllable way while the streamSource is responsible for (pseudo) random decisions.

This is Java code, but I hope the concept translates well ... you have a lot of freedom in the create functions so you can play with different approaches and add complexity pretty easily.
 
I can attach a Java implementation of a random stream source and a fixed stream source (fibonacci sequence - for reproduceable content with a random character) if you are interested ... if you do not see how it all would come together feel free to ask ...
 
Guess for what you have in mind the streamSource is irrelevant, though.
You would just ask the context for the current wave level and play with implementations of create until you find a strategy that produces waves that you are happy with.
 
Rough fibonacci implementation without a random character:
public Wave create(StreamSource streamSource) {

Wave wave = new Wave();

for (int tierNumber=1; tierNumber<=5; tierNumber++) {

setCurrentTier(tierNumber);
int numberOfEnemies = getNumberOfEnemies();

for (int i=0; i<numberOfEnemies; i++) {
wave.registerEnemy(enemyCreator.create(streamSource));
}
}

return wave;
}

private int getNumberOfEnemies() {
return (3 + getFibonacci(context.getWaveLevel())) / getCurrentTier();
}

private int getFibonacci(int n) {
if (n == 0 || n == 1)  return n;
else
return Fibonacci(n - 1) + Fibonacci(n - 2);
}
Obviously in this case the enemy context must contain the method getCurrentTier(), so that the EnemyCreator knows what tier it has to create an enemy for. Edited by DareDeveloper
2

Share this post


Link to post
Share on other sites

Btw. I think that something linear will probably be fine if you combine several properties that define a wave. Fibonacci would get too crazy too fast.

 

For example, using level classes that have the same number of enemies in a peak tier might work. The peak tier changes from 1 to 5 ... within one level class.

Another property could be a factor that determines how many enemies the neighbouring tiers have (e.g. peakAmount / (2 * tierDistance)).

 

Then you'd have to ensure that with each class change the number of enemies in the peak tier changes enough that it is harder than the last wave of the previous class. That might be the tricky part.

1

Share this post


Link to post
Share on other sites

Thanks for the help everyone!

 

I decided to go with a simple y = 7 * sqrt(x) curve and i just generate a percentage of y for each type of enemy in the tier.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0