Jump to content
  • Advertisement
Sign in to follow this  
Si Robertson

Implementing Waves of Enemies - Classic Shooter Style

This topic is 3879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, Are there any good articles/threads here that cover the logic behind implementing/programming waves of enemies in a game similar to something like R-Type? I did search a few times but didn't find anything. Thanks, Si ++

Share this post


Link to post
Share on other sites
Advertisement
You're not going to find anything this specific. What this comes down to is common sense and general programming experience. To create a wave of enemies, you'll need a collection of some kind. A simple array will probably do fine, but depending on your programming language there will probably be a number of options. Once you have the collection of enemies, all there is left is to move them onto the screen. Add some scripting of some kind to define how many and what type of enemy and making waves of enemies will be easy.

Share this post


Link to post
Share on other sites
Thanks for the reply, I think I should have been a little more specific in my original post though. I'm more interested in how the waves are generated throughout a level, what determines when each wave is created etc. My initial guess is that each wave would be created at a set time, or are waves created back-to-back so when wave X has been destroyed or has moved off-screen wave Y is then created?

I guess I'm just curious about how you guys would approach this, and hopefully I might pickup a few nuggets of wisdom along the way. :)

Share this post


Link to post
Share on other sites
Quote:
Original post by Si Robertson
Thanks for the reply, I think I should have been a little more specific in my original post though. I'm more interested in how the waves are generated throughout a level, what determines when each wave is created etc. My initial guess is that each wave would be created at a set time, or are waves created back-to-back so when wave X has been destroyed or has moved off-screen wave Y is then created?

I guess I'm just curious about how you guys would approach this, and hopefully I might pickup a few nuggets of wisdom along the way. :)


One method might be to create a 2D array or vector, where the outer array stores the "waves" (inner arrays), and the inner arrays consist of the each individual enemy of that wave. If you use a dynamic container (vector), you could generate just the first inner array (first wave), and only create the next inner array (next wave) when the first wave was destroyed by the player. This way you do not waste memory by creating 10 waves when the player cannot even get past the first wave.

There are plenty of ways to do this, this is just my initial, basic idea.

Share this post


Link to post
Share on other sites
Quote:
Original post by Si Robertson
Thanks for the reply, I think I should have been a little more specific in my original post though. I'm more interested in how the waves are generated throughout a level, what determines when each wave is created etc. My initial guess is that each wave would be created at a set time, or are waves created back-to-back so when wave X has been destroyed or has moved off-screen wave Y is then created?

I did this just by defining "waves" in xml (basically a combination of an enemy type, a formation and a path to take), then having a list of waves and a time to trigger them at (again stored in xml). Bosses and sub-bosses might need behaviour to only trigger the next set of waves when they're destroyed however.

Also, see this: http://www.flipcode.com/archives/Strayfire_Writing_A_Simple_Game.shtml

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!