Orchestrating Enemy Waves
Hi guys
In Manic Shooters what is the ideal way of creating enemy waves? Like
Enemy wave 1 - Should appear at start of level
Enemy wave 2 - Should appear after first wave of enemies has all been destroyed or have left the screen
Enemy wave 3 - Should appear when player is half the length of the entire level
Boss - Should appear once all enemies are gone and player have reached a certain length of the level?
The way I did this before is create a map in a text file like
xxxx0x0
000xx00
xxx0000
0000000
I hope you could relate to what I'm trying to say. I'm just trying to move all objects at once at preferably the same speed until they reach the screen. This is a little messy from my experience as enemies sometimes tend to overlap each other. I can't seem to orchestrate the scene as I want to.
Any ideas?
Thanks!
The text file would probably work fine. You can also add some parameters to each wave, like, the number of seconds after the previous wave that this wave should appear, even if the previous wave hasn't been completely destroyed yet.
Also, your post is a bit vague, but from what I gather you want to load this text file, create all the enemies, and then slowly move them down towards the player. This is not a good approach. Instead, I would create some sort of Wave class, which would have a list of Enemies. Then the game would spawn each wave at the appropriate time. For example, if Wave1 has been destroyed, Wave2 would be spawned (and all the enemies in that wave would be spawned) and you could start moving that wave down toward the player. Then, if enough time has passed and Wave2 still isn't completely destroyed, Wave3 might be spawned and moved toward the player. This approach would give you a bit more fidelity in timing the rhythm of the waves.
Also, your post is a bit vague, but from what I gather you want to load this text file, create all the enemies, and then slowly move them down towards the player. This is not a good approach. Instead, I would create some sort of Wave class, which would have a list of Enemies. Then the game would spawn each wave at the appropriate time. For example, if Wave1 has been destroyed, Wave2 would be spawned (and all the enemies in that wave would be spawned) and you could start moving that wave down toward the player. Then, if enough time has passed and Wave2 still isn't completely destroyed, Wave3 might be spawned and moved toward the player. This approach would give you a bit more fidelity in timing the rhythm of the waves.
@Samith - Yes you got my point right! So having a wave class is preferable over loading from a file? I was hoping to add some flexibility so the game is configurable outside of the executable file. But thanks a lot!
Quote:Original post by armond
@Samith - Yes you got my point right! So having a wave class is preferable over loading from a file? I was hoping to add some flexibility so the game is configurable outside of the executable file. But thanks a lot!
Having a Wave class and loading from a file are not mutually exclusive. Imagine a file type like this:
level.txtwaves 4wave1enemies 5enemyType whateverwaveDelay 1.0 absoluteendwave2enemies 4enemyType whateverelsewaveDelay 1.0 relative start wave1endwave3enemies 6enemyType thingswaveDelay 2.5 relative end wave2endwave4enemies 1enemyType bosswaveDelay 1.0 relative end wave3end
Then in your code, you can load in level.txt, the first line states "waves 4" so you can infer that there will be 4 waves, so create an array or list or something of 4 Wave objects, and initialize the Wave objects with the data in the file. The "enemies" line obviously specifies how many enemies are in this wave, the enemyType defines what type of enemy they are, waveDelay specifies a time and then either "absolute" meaning the time is the absolute time since the start of the level that this wave comes, or "relative start/end waveIdentifier" meaning the time is relative to either the start or end of the specified wave.
This is just a rough sketch of what would be possible. The point is just that you can have a Wave class and initialize it with data from a file in order to have a somewhat flexible data-driven level format.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement