Hey, I’m creating a game that has waves, I have been watching the wave manager code from unity but I want something different… The enemies of my game don’t have health, they have weak points that you have to destroy, I have enemies that has 1 weak point, 2 weak points, 3 and bosses. I was thinking about how to create that, I don’t know if it’s better to create a table that has all waves, how many enemies to spawn and what enemies spawn on every wave. But I don’t know if some pro player can reach some wave that I haven’t created. I want to create a difficulty curve that it goes up and down to don’t saturate the player. Which is the best way of doing that that player can’t modify it easily?
Thanks.
A wave manager just does two things:
- initialize the wave
- wait until the wave is “over”, whatever that means
Don’t make it do any more than that.
Enemies do their thing and weakpoints or health or outright destruction, whatever, doesn’t matter.
You need to manage the enemies (enemy manager!) and decide:
- there are enough to keep the player busy
- there are not enough, spawn more
- they are all gone, set the “wave is over” flag (which the wave manager above observes)
Here we go again with this “KEEP OUT LEET HAXORS!” silliness. The end users computer is not a trusted machine to you. There is nothing you can do to prevent him from doing whatever he wants with his computer. ALL of your efforts towards this will produce you zero income. I urge you to instead focus your efforts productively.
If you don’t have an infinite amount of waves (and people actually play the game) someone will for sure reach the end, unless you made it literally impossible to finish the last wave, like the end level in Halo: Reach where stuff keep spawning until you die.
you just need to have a factor for the wave difficulty that determines how many enemies spawn, how strong each enemy is, and whatever other variables an enemy can have, maybe even spawn rate, and multiple this factor with the wave number.
you can play with the factor to make the game increase in difficulty differently during different stages, so at level 1 though 100 it grows linearly and from 101+ it grows exponentially for example.
adding to what @Kurt-Dekker said, not only is this not a good use of your time, it’s actually very counter productive imo, and not only in the time wasted on an unneeded system manner.
how is this adding value to the playability of the game?
answer - it doesn’t, it actually makes it less playable.
if someone doesn’t want to modify the game, he won’t even know you did it.
and if someone (using myself as an example) takes my money for a game and doesn’t grant me full access - I’m asking for a refund and not looking at any more of your games.
This is not online hacking that derails other peoples play experience. (i’m assuming that this game is single player, probably TD-ish based on the enemy wave mechanic)
If you’re looking for an example wave generator example, I’ve written one long ago over here. A lot people did not grasp the idea initially, so pay attention how it’s supposed to be used. It’s actually quite versatile. However it’s meant to be a “blind time based spawner”. So it does not track your progress of destroying the enemies. So it’s an endless stream of waves with specific delayed between the spawns and waves. Of course it could be made much more versatile by including optional conditions when to proceed based on certain in game states. Though this would make the whole system quite more complex.
This wave generator will infinitely loop through all the configured waves and simply decreases the spawn times with each iteration. Of course you could implement a health increase or other random configuration steps on your actual enemies. Note that the actual spawning of the enemies has been left out. You could use a simple Instantiate call but in larger systems, using object pools would probably make more sense.
This is meant more as a template and not meant as a drop-in and ready to use solution. It should give you some ideas how you could create such a system. Keep in mind that this is just a spawner. Specific mechanics of a single enemy would be up to the enemy itself. Implementing your weak point mechanic in the spawner would not make much sense. Keep that on the actual enemy. That way you can add completely new types of enemies in the future without the need to modify the spawner. Just keep your individual systems as simple and seperate as possible. If you need information flow between them, you may want to use interfaces to allow communication between say an enemy and the spawner. As always avoid tight coupling between classes and use KISS where possible.